diff options
-rwxr-xr-x | etc/init.d/vyatta-ofr | 5 | ||||
-rwxr-xr-x | scripts/vyatta-load-config.pl | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/etc/init.d/vyatta-ofr b/etc/init.d/vyatta-ofr index b1e7a69..776aaf4 100755 --- a/etc/init.d/vyatta-ofr +++ b/etc/init.d/vyatta-ofr @@ -66,6 +66,11 @@ have_rl_system () { # if necessary, provide initial config init_bootfile () { + if [ -f $BOOTFILE ] && grep -q '/\*XORP Configuration File, v1.0\*/' \ + $BOOTFILE >&/dev/null; then + CURTIME=$(date +%F-%H%M%S) + mv $BOOTFILE $BOOTFILE.pre-glendale.$CURTIME + fi if [ ! -f $BOOTFILE ] ; then if [ -f $vyatta_sysconfdir/config.boot.default ]; then cp $vyatta_sysconfdir/config.boot.default $BOOTFILE diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl index a432d8c..05323e3 100755 --- a/scripts/vyatta-load-config.pl +++ b/scripts/vyatta-load-config.pl @@ -40,6 +40,24 @@ if (!($load_file =~ /^\//)) { $load_file = "$bootpath/$load_file"; } +if (!open(CFG, "<$load_file")) { + print "Cannot open configuration file $load_file\n"; + exit 1; +} +while (<CFG>) { + if (/\/\*XORP Configuration File, v1.0\*\//) { + print "Warning: Loading a pre-Glendale configuration.\n"; + print "Do you want to continue? [no] "; + my $resp = <STDIN>; + if (!($resp =~ /^yes$/i)) { + print "Configuration not loaded\n"; + exit 1; + } + last; + } +} +close CFG; + # do config migration system("$sbindir/vyatta_config_migrate.pl $load_file"); |