Hakchi:/bin/hakchi

From hakchi
Jump to: navigation, search

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

Executing functions[edit source]

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, e.g: hakchi findGameStorage

Variables[edit source]

get[edit source]

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

set[edit source]

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[edit source]

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[edit source]

You can run code in an environment similar to preinit one of two ways.

eval[edit source]

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[edit source]

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