From hakchi
Revision as of 16:46, 30 May 2018 by DanTheMan827 (talk | contribs)
Jump to: navigation, search

/bin/hakchi is a helper script that can be used a couple different ways

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.



This will read the variable that gets passed as the argument and output the value, e.g: hakchi get cfg_myvariable


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"


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.


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


This will run the contents of a script in an environment similar to preinit, e.g: hakchi source /tmp/myscript.sh