diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2007-10-22 15:58:35 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2007-10-22 15:58:35 -0700 |
commit | 569281b60a664213fc60ab34fadd7bcdfe47b03c (patch) | |
tree | 74377a9f039d61b16a83dacf1e0d3f12503bb41a /etc/init.d/vyatta-ofr | |
parent | 61514272a6ad4ca2c9dec0ec97005b13022bcc7e (diff) | |
download | vyatta-cfg-569281b60a664213fc60ab34fadd7bcdfe47b03c.tar.gz vyatta-cfg-569281b60a664213fc60ab34fadd7bcdfe47b03c.zip |
add 'config_dev' and 'config_path' kernel command-line options to allow
a user to specify the device and path of the startup configuration
file, e.g., '... config_dev=sda1 config_path=/config.boot'.
Diffstat (limited to 'etc/init.d/vyatta-ofr')
-rwxr-xr-x | etc/init.d/vyatta-ofr | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/etc/init.d/vyatta-ofr b/etc/init.d/vyatta-ofr index f8782ec..6492b59 100755 --- a/etc/init.d/vyatta-ofr +++ b/etc/init.d/vyatta-ofr @@ -95,6 +95,32 @@ try_floppy () { fi } +get_config () { + declare config_mount=/opt/vyatta/etc/config-mnt + declare -a boot_args=($( cat /proc/cmdline )) + declare config_dev='' + declare config_path='' + for arg in ${boot_args[@]}; do + case "$arg" in + config_dev=*) eval "$arg";; + config_path=*) eval "$arg";; + *) ;; + esac + done + if [ -z "$config_dev" ]; then + return 1 + fi + [ -n "$config_path" ] || config_path='/config.boot' + mkdir -p $config_mount + mount -t ext2 /dev/$config_dev $config_mount -o sync 2>/dev/null + test $? -eq 32 && mount -t vfat /dev/$config_dev $config_mount 2>/dev/null + if [ ! -f ${config_mount}${config_path} ]; then + return 1 + fi + BOOTFILE=${config_mount}${config_path} + return 0 +} + # if necessary, provide initial config init_bootfile () { if [ ! -f $BOOTFILE ] ; then @@ -131,7 +157,9 @@ load_bootfile () start () { log_daemon_msg "Starting Vyatta Router" - try_floppy + if ! get_config; then + try_floppy + fi init_bootfile migrate_bootfile for s in ${subinit[@]} ; do |