babeld: add support for dynamic config files
authorSteven Barth <steven@midlink.org>
Thu, 21 May 2015 06:22:37 +0000 (08:22 +0200)
committerSteven Barth <steven@midlink.org>
Tue, 26 May 2015 06:55:51 +0000 (08:55 +0200)
Signed-off-by: Steven Barth <steven@midlink.org>
Signed-off-by: Markus Stenberg <markus.stenberg@iki.fi>
babeld/files/babeld.init

index ae1e6786756734fc9f1a8e9ef8a6cc827de9ddcd..05e4e708f8d4c50503ad37feaff4d06ab1166d48 100755 (executable)
@@ -7,6 +7,7 @@ START=70
 pidfile='/var/run/babeld.pid'
 CONFIGFILE='/var/etc/babeld.conf'
 OTHERCONFIGFILE="/etc/babeld.conf"
 pidfile='/var/run/babeld.pid'
 CONFIGFILE='/var/etc/babeld.conf'
 OTHERCONFIGFILE="/etc/babeld.conf"
+OTHERCONFIGDIR="/tmp/babeld.d/"
 EXTRA_COMMANDS="status"
 EXTRA_HELP="        status Dump Babel's table to the log file."
 
 EXTRA_COMMANDS="status"
 EXTRA_HELP="        status Dump Babel's table to the log file."
 
@@ -204,8 +205,14 @@ babel_config_cb() {
 start() {
        mkdir -p /var/lib
        mkdir -p /var/etc
 start() {
        mkdir -p /var/lib
        mkdir -p /var/etc
+       mkdir -p $OTHERCONFIGDIR
+
        # Start by emptying the generated config file
        >"$CONFIGFILE"
        # Start by emptying the generated config file
        >"$CONFIGFILE"
+       # Import dynamic config files
+       for f in $OTHERCONFIGDIR/*.conf; do
+               [ -f "$f" ] && cat $f >> $CONFIGFILE
+       done
        # First load the whole config file, without callbacks, so that we are
        # aware of all "ignore" options in the second pass.
        config_load babeld
        # First load the whole config file, without callbacks, so that we are
        # aware of all "ignore" options in the second pass.
        config_load babeld