Difference between revisions of "Hakchi:/bin/hakchi"

From hakchi
Jump to: navigation, search
Line 1: Line 1:
[[Category:Hakchi Files]]
+
[[Category:Hakchi Files and Folders]]
 
<code>/bin/hakchi</code> is a helper script that can be used a couple different ways
 
<code>/bin/hakchi</code> is a helper script that can be used a couple different ways
  

Revision as of 16:47, 30 May 2018

/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.

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