From 8cc248d3d90d606e87adb412049b318dba687487 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 28 Oct 2009 16:02:50 -0700 Subject: Avoid updating config.boot unless necessary On normal boot, no changes to config.boot or modes are needed. --- etc/init.d/vyatta-ofr | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'etc') diff --git a/etc/init.d/vyatta-ofr b/etc/init.d/vyatta-ofr index 45333ac..a3dbc42 100755 --- a/etc/init.d/vyatta-ofr +++ b/etc/init.d/vyatta-ofr @@ -82,18 +82,22 @@ init_bootfile () { CURTIME=$(date +%F-%H%M%S) mv $BOOTFILE $BOOTFILE.pre-glendale.$CURTIME fi - if [ ! -f $BOOTFILE ] ; then + if [ ! -r $BOOTFILE ] ; then if [ -f $vyatta_sysconfdir/config.boot.default ]; then cp $vyatta_sysconfdir/config.boot.default $BOOTFILE else $vyatta_sbindir/vyatta_current_conf_ver.pl > $BOOTFILE fi + + chgrp ${GROUP} $BOOTFILE + chmod 660 $BOOTFILE + fi + + if grep -q -x 'rtrmgr {' $BOOTFILE ; then + ## remove the unnecessary and potentially conflicting + ## config-directory statement (i.e. /mnt/floppy vs. /media/floppy) + sed -i '/^rtrmgr {$/,/^}$/d' $BOOTFILE fi - chgrp ${GROUP} $BOOTFILE - chmod 660 $BOOTFILE - ## remove the unnecessary and potentially conflicting - ## config-directory statement (i.e. /mnt/floppy vs. /media/floppy - sed -i '/^rtrmgr {$/,/^}$/d' $BOOTFILE } # if necessary, migrate initial config -- cgit v1.2.3