]> git.ipfire.org Git - people/arne_f/network.git/blob - functions
network: Add some initialization handlers.
[people/arne_f/network.git] / functions
1 #!/bin/bash
2
3 INIT_FUNCTIONS=""
4
5 function init_register() {
6 INIT_FUNCTIONS="${INIT_FUNCTIONS} $@"
7 }
8
9 function init_run() {
10 local init
11 for init in ${INIT_FUNCTIONS}; do
12 ${init}
13 done
14 }
15
16 for file in /lib/network/functions.*; do
17 . ${file}
18 done
19
20 # Reading in network tool configuration
21 network_config_read
22
23 # Create run dir
24 if ! [ -d "${RUN_DIR}" ]; then
25 mkdir ${RUN_DIR}
26 fi
27
28 # Set colour mode
29 case "${COLOURS}" in
30 auto)
31 colours_auto_disable
32 ;;
33 off|0)
34 colours_disable
35 ;;
36 on|1)
37 # Do nothing
38 ;;
39 *)
40 warning_log "Unknown parameter given for COLOURS: ${COLOURS}"
41 ;;
42 esac
43
44 if [ "$(basename ${0})" = "network" ]; then
45 init_run
46 fi