]> git.ipfire.org Git - network.git/blobdiff - functions
Fix weird device CLI command.
[network.git] / functions
index 5c5372d9f48619a4f9ac6a2c1591fbd120a73f81..befdd14555318daf501c4fb49e68894f5e2447da 100644 (file)
--- a/functions
+++ b/functions
@@ -1,8 +1,43 @@
 #!/bin/bash
 
+INIT_FUNCTIONS=""
+
+function init_register() {
+       INIT_FUNCTIONS="${INIT_FUNCTIONS} $@"
+}
+
+function init_run() {
+       local init
+       for init in ${INIT_FUNCTIONS}; do
+               ${init}
+       done
+}
+
 for file in /lib/network/functions.*; do
        . ${file}
 done
 
 # Reading in network tool configuration
 network_config_read
+
+# Create run dir
+if ! [ -d "${RUN_DIR}" ]; then
+       mkdir ${RUN_DIR}
+fi
+
+# Set colour mode
+case "${COLOURS}" in
+       auto)
+               colours_auto_disable
+               ;;
+       off|0)
+               colours_disable
+               ;;
+       on|1)
+               # Do nothing
+               ;;
+       *)
+               warning_log "Unknown parameter given for COLOURS: ${COLOURS}"
+               ;;
+esac
+