Klone swiss army knife
klone [klone_opts] [-c cmd] [cmd_opts] [cmd_args]
klone performs two different tasks depending on the argument supplied to the -c switch: import a site directory tree into the KLone building environment (i.e. the embedded file system), or translate static and dynamic pages into C files.
The translation phase is rarely seen by the user since it is hidden in the Makefile of the site building directory, i.e. ${KLONE_SRC_DIR}/site. Generally, the developer gets an embedded version of his/her site by providing the following command sequence:
$ cd ${KLONE_SRC_DIR}/site $ ../src/tools/klone/klone -c import ${SITE_BASE_DIR} $ make
The latter make invocation calls 'klone -c translate' over the imported files to perform the needed translation and registering (pre-linking).
Note that whenever a source file is added, removed or renamed, or in case the embedded file system encrypting key changes, the import operation must be done again.
The subsequent phase, by which the embedded site is linked to the kloned server skeleton, does not involve klone anymore. Nevertheless, the steps are illustrated here for reference:
$ cd ${KLONE_SRC_DIR} $ make
That's all.
-h
Display a brief help and exit.
-v
Enable verbose mode.
-V
Print klone version and exit.
klone -c translate -i infile -o outfile -u uri [-E] [-k keyfile] [-z]
Translate the active (i.e. a .klone file) or static page infile into C file outfile.
The -u option specifies the uri associated with the translated file.
The -E option tells klone to encrypt the file content with the key enclosed in the supplied keyfile or in the environment variable KLONE_CIPHER_KEY using AES-256 CBC.
The contents of the translated files are compressed based on their MIME type if the -z flag is given.
klone -c import [-b uri] [-e pattern] [-x pattern] [-k keyfile] [-Z pattern] [-z] dir
Import the site tree starting at dir into the KLone building environment. The command output comprises two makefiles (autogen.mk and autogen.dps) and the register.c file which will gather the imported and translated site files. The latter file is the glue by which the embedded site can afterwards be linked to the HTTP/S server.
When the -e flag is given, the files matching the specified pattern will be encrypted using the key enclosed in the supplied keyfile or in the environment variable KLONE_CIPHER_KEY.
The user can choose whether to compress all the imported files based on their MIME type, using the -z flag, or to select a subset matching the supplied shell pattern.
If, while importing, you don't want to include a set of files you can use the -x argument to provide the pattern of files you want to exclude.
Arguments -x, -Z and -e may be used more then once.
The following environment variable affects the execution of klone:
KLONE_CIPHER_KEY
If set, klone tries to read the embedded file system encryption key from it. It is be overridden by the -k option.
The klone utility exits with EXIT_SUCCESS on success, and with EXIT_FAILURE if an error occurs.
If you find one, please email it to <[email protected]>