Conventions for adding code to kuhbs.
kuhbs reserves itself the qube (or VM) label color purple and uses
gray for listing absent VMs in kuhbs ls
and
kuhbs show <kuhb>
. All kuhbs VMs, except the VMs you
actually use (like an AppVM for firefox), are purple by default. kuhbs
provides serveral network kuhb’s called kuhbs-nic
,
kuhbs-firewall
, kuhbs-gateway
,
kuhbs-usb
. These kuhb’s have the label blue by default. You
can configure this in defaults.sh
.
Indentation 4 whitespaces
Variables - config file variables (defaults.sh and
config.sh) are always UPPERCASE (and read only) - all variables are
immutable by default (declared with declare -r var=value
) -
all variables are quoted when used in bash scripts - arguments directly
extracted from arguments, like the KUHB_NAME=tool-firefox with
kuhbs create tool/firefox
, are uppercase and read only so
they don’t have to be passed to each function
Functions - all variables except UPPERCASE ones have to be passed as arguments - 3 newlines between functions - internal variables are declared with local - input given to a function as well as variables used by a function must be verified before function is executed
Logging - log in the functions that perform the action (spammy but more secure) - first letter in log message is lowercase
General Style - [[ bash-statement ]]
instead of test -f file.txt