summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-01-24 11:32:05 +0000
committerAlex Harpin <development@landsofshadow.co.uk>2015-01-24 11:32:05 +0000
commit7a78f9c54453338202b4b02576a588fcd3814803 (patch)
treeb67d69abdc7014311e7ec06e5b1a3e5c297e9092
parenta24607a4078ae35bb711e44c4d1f1d42eaebf73a (diff)
downloadvyatta-cfg-system-7a78f9c54453338202b4b02576a588fcd3814803.tar.gz
vyatta-cfg-system-7a78f9c54453338202b4b02576a588fcd3814803.zip
vyatta-cfg-system: formatting changes for style consistency
Update scripts/system/vyatta_update_console.pl to have consistent identation levels and style throughout.
-rwxr-xr-xscripts/system/vyatta_update_console.pl79
1 files changed, 40 insertions, 39 deletions
diff --git a/scripts/system/vyatta_update_console.pl b/scripts/system/vyatta_update_console.pl
index 0ee6a6e5..38c03744 100755
--- a/scripts/system/vyatta_update_console.pl
+++ b/scripts/system/vyatta_update_console.pl
@@ -34,13 +34,13 @@ die "$0 expects no arguments\n" if (@ARGV);
sub update {
my ($old, $new) = @_;
- if ( compare($old, $new) != 0) {
- move($new, $old)
- or die "Can't move $new to $old";
- return 1;
+ if (compare($old, $new) != 0) {
+ move($new, $old)
+ or die "Can't move $new to $old";
+ return 1;
} else {
- unlink($new);
- return;
+ unlink($new);
+ return;
}
}
@@ -48,14 +48,14 @@ my $INITTAB = "/etc/inittab";
my $TMPTAB = "/tmp/inittab.$$";
sub update_inittab {
- open (my $inittab, '<', $INITTAB)
- or die "Can't open $INITTAB: $!";
+ open(my $inittab, '<', $INITTAB)
+ or die "Can't open $INITTAB: $!";
- open (my $tmp, '>', $TMPTAB)
- or die "Can't open $TMPTAB: $!";
+ open(my $tmp, '>', $TMPTAB)
+ or die "Can't open $TMPTAB: $!";
# Clone original inittab but remove all references to serial lines
- print {$tmp} grep { ! /^T|^# Vyatta/ } <$inittab>;
+ print {$tmp} grep {!/^T|^# Vyatta/} <$inittab>;
close $inittab;
my $config = new Vyatta::Config;
@@ -65,27 +65,28 @@ sub update_inittab {
my $id = 0;
foreach my $tty ($config->listNodes()) {
- my $speed = $config->returnValue("$tty speed");
- $speed = 9600 unless $speed;
-
- printf {$tmp} "T%d:23:respawn:", $id;
- if ($config->exists("$tty modem")) {
- printf {$tmp} "/sbin/mgetty -x0 -s %d %s\n", $speed, $tty;
- } else {
- printf {$tmp} "/sbin/getty -L %s %d vt100\n", $tty, $speed;
- }
-
- # id field is limited to 4 characters
- if (++$id >= 1000) {
- warn "Ignoring $tty only 1000 serial devices supported\n";
- last;
- }
+ my $speed = $config->returnValue("$tty speed");
+ $speed = 9600 unless $speed;
+
+ printf {$tmp} "T%d:23:respawn:", $id;
+ if ($config->exists("$tty modem")) {
+ printf {$tmp} "/sbin/mgetty -x0 -s %d %s\n", $speed, $tty;
+ } else {
+ printf {$tmp} "/sbin/getty -L %s %d vt100\n", $tty, $speed;
+ }
+
+ # id field is limited to 4 characters
+ if (++$id >= 1000) {
+ warn "Ignoring $tty only 1000 serial devices supported\n";
+ last;
+ }
}
close $tmp;
if (update($INITTAB, $TMPTAB)) {
- # This is same as telinit q - it tells init to re-examine inittab
- kill 1, 1;
+
+ # This is same as telinit q - it tells init to re-examine inittab
+ kill 1, 1;
}
}
@@ -104,20 +105,20 @@ sub update_grub {
my $speed = $config->returnValue("ttyS0 speed");
$speed = "9600" unless defined($speed);
- open (my $grub, '<', $GRUBCFG)
- or die "Can't open $GRUBCFG: $!";
+ open(my $grub, '<', $GRUBCFG)
+ or die "Can't open $GRUBCFG: $!";
- open (my $tmp, '>', $GRUBTMP)
- or die "Can't open $GRUBTMP: $!";
+ open(my $tmp, '>', $GRUBTMP)
+ or die "Can't open $GRUBTMP: $!";
while (<$grub>) {
- if (/^serial / ) {
- print {$tmp} "serial --unit=0 --speed=$speed\n";
- } elsif (/^(.* console=ttyS0),[0-9]+(.*)$/) {
- print {$tmp} "$1,$speed$2\n";
- } else {
- print {$tmp} $_;
- }
+ if (/^serial /) {
+ print {$tmp} "serial --unit=0 --speed=$speed\n";
+ } elsif (/^(.* console=ttyS0),[0-9]+(.*)$/) {
+ print {$tmp} "$1,$speed$2\n";
+ } else {
+ print {$tmp} $_;
+ }
}
close $grub;
close $tmp;