summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2013-11-03 18:26:21 +0100
committerDaniil Baturin <daniil@baturin.org>2013-11-03 18:26:21 +0100
commit445a7a4cad127b9f587ac8ef8d4a911eb35c77fb (patch)
tree66f4659e6496b17e3669c36bd66524c8d51a41b6
parentded81deb74940b38abbc73152919e24d04a0f462 (diff)
downloadvyatta-cfg-445a7a4cad127b9f587ac8ef8d4a911eb35c77fb.tar.gz
vyatta-cfg-445a7a4cad127b9f587ac8ef8d4a911eb35c77fb.zip
Add kernel commandline option to boot with specific config.
vyos-config=/config/something
-rwxr-xr-xetc/init.d/vyatta-router12
1 files changed, 12 insertions, 0 deletions
diff --git a/etc/init.d/vyatta-router b/etc/init.d/vyatta-router
index ef76eba..9d11aab 100755
--- a/etc/init.d/vyatta-router
+++ b/etc/init.d/vyatta-router
@@ -38,6 +38,18 @@ declare action=$1; shift
declare -x BOOTFILE=$vyatta_sysconfdir/config/config.boot
+# If vyos-config= boot option is present, use that file instead
+VYOS_CONFIG=$(cat /proc/cmdline | grep -Eo '\bvyos-config=(\S+)\b' /proc/cmdline | awk -F'=' '{print $2}')
+
+if [ ! -z "$VYOS_CONFIG" ]; then
+ if [ -r "$VYOS_CONFIG" ]; then
+ echo "Config selected manually: $VYOS_CONFIG"
+ declare -x BOOTFILE="$VYOS_CONFIG"
+ else
+ echo "WARNING: Could not read selected config file, using default!"
+ fi
+fi
+
declare -a subinit
declare -a all_subinits=(
rl-system