diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-10-15 15:54:50 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-10-15 15:54:50 -0700 |
commit | 22f82a0fb8ad3ed890c82a7a568390a29cf5116e (patch) | |
tree | a93e8b6879565004a0da64cde679f93162c00e6b | |
parent | 806a705775387fff477999ceed051b5aa29d6084 (diff) | |
download | vyatta-cfg-system-22f82a0fb8ad3ed890c82a7a568390a29cf5116e.tar.gz vyatta-cfg-system-22f82a0fb8ad3ed890c82a7a568390a29cf5116e.zip |
Handle error cases on console update
If inittab doesn't exist or console not configured, just
do nothing.
-rw-r--r-- | scripts/system/vyatta_update_console.pl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/system/vyatta_update_console.pl b/scripts/system/vyatta_update_console.pl index 3c3b7d2d..2ee57583 100644 --- a/scripts/system/vyatta_update_console.pl +++ b/scripts/system/vyatta_update_console.pl @@ -41,7 +41,7 @@ sub update_inittab { my ($inpath, $outpath) = @_; open (my $inittab, '<', $inpath) - or die "Can't open $inpath: $!"; + or return; open (my $tmp, '>', $outpath) or die "Can't open $outpath: $!"; @@ -81,7 +81,10 @@ sub update_grub { my ($inpath, $outpath) = @_; my $config = new Vyatta::Config; - my $speed = $config->returnValue("system console device ttyS0 speed"); + $config->setlevel("system console device"); + return unless $config->exists("ttyS0"); + + my $speed = $config->returnValue("ttyS0 speed"); $speed = "9600" unless defined($speed); open (my $grub, '<', $inpath) |