Hakchi:/bin/hakchi
/bin/hakchi
is a helper script that can be used a couple different ways
Contents
Executing functions
You can execute preinit functions outside of preinit by passing the function name as the first argument, all other arguments are passed to the function being called.
Variables
get
This will read the variable that gets passed as the argument and output the value, e.g: hakchi get cfg_myvariable
set
you can set a configuration variable by passing a variable name prefixed with cfg_
followed by the value, e.g: hakchi set cfg_myvariable "my value"
unset
This will remove a configuration variable from the configuration file.
To use, pass the full variable name as an argument, e.g: hakchi unset cfg_myvariable
Executing code
You can run code in an environment similar to preinit one of two ways.
eval
This will evaluate code sent either as the first argument or data from /dev/stdin
Example 1:
hakchi eval 'echo $rootfs'
Example 2:
hakchi eval <<'EOT' echo $rootfs EOT
source
This will run the contents of a script in an environment similar to preinit, e.g: hakchi source /tmp/myscript.sh