From 445a7a4cad127b9f587ac8ef8d4a911eb35c77fb Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sun, 3 Nov 2013 18:26:21 +0100 Subject: Add kernel commandline option to boot with specific config. vyos-config=/config/something --- etc/init.d/vyatta-router | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 -- cgit v1.2.3