diff options
author | rbalocca <rbalocca@vyatta.com> | 2008-04-24 13:33:46 -0700 |
---|---|---|
committer | rbalocca <rbalocca@vyatta.com> | 2008-04-24 13:33:46 -0700 |
commit | a309f120a9ff472d45544a9101226334e426e76a (patch) | |
tree | bfdb25a51f42443587668e8fd5ba0597b0d744d9 /scripts/vyatta-load-config.pl | |
parent | c29e34d11a22eecbaa50fa134965f2fa036f47f3 (diff) | |
parent | 7fd560b72df1b327b4b47a6232dfcf16d6fae52c (diff) | |
download | vyatta-cfg-a309f120a9ff472d45544a9101226334e426e76a.tar.gz vyatta-cfg-a309f120a9ff472d45544a9101226334e426e76a.zip |
Merge branch 'glendale'
Diffstat (limited to 'scripts/vyatta-load-config.pl')
-rwxr-xr-x | scripts/vyatta-load-config.pl | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl index be3c751..05323e3 100755 --- a/scripts/vyatta-load-config.pl +++ b/scripts/vyatta-load-config.pl @@ -1,5 +1,24 @@ #!/usr/bin/perl -# Perl script for loading config file at run time. + +# Author: An-Cheng Huang <ancheng@vyatta.com. +# Date: 2007 +# Description: Perl script for loading config file at run time. + +# **** License **** +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# This code was originally developed by Vyatta, Inc. +# Portions created by Vyatta are Copyright (C) 2006, 2007, 2008 Vyatta, Inc. +# All Rights Reserved. +# **** End License **** + # $0: config file. use strict; @@ -21,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"); @@ -71,4 +108,3 @@ if ($? >> 8) { print "Done\n"; exit 0; - |