diff options
author | Alex Harpin <development@landsofshadow.co.uk> | 2015-01-24 13:57:44 +0000 |
---|---|---|
committer | Alex Harpin <development@landsofshadow.co.uk> | 2015-01-24 19:05:11 +0000 |
commit | de086b75445f50cec560791aa5abd22347c563a2 (patch) | |
tree | 8b49f6f1ee32d76b0a589bd6ebd3f0898437fbf8 /scripts/system | |
parent | 7a78f9c54453338202b4b02576a588fcd3814803 (diff) | |
download | vyatta-cfg-system-de086b75445f50cec560791aa5abd22347c563a2.tar.gz vyatta-cfg-system-de086b75445f50cec560791aa5abd22347c563a2.zip |
vyatta-cfg-system: changes to update_inittab for xen console access
Update the update_inittab function so when the system is configured for
Xen console (hvc0) access, the correct values are written out to
/etc/inittab.
Diffstat (limited to 'scripts/system')
-rwxr-xr-x | scripts/system/vyatta_update_console.pl | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/scripts/system/vyatta_update_console.pl b/scripts/system/vyatta_update_console.pl index 38c03744..7c36ec7f 100755 --- a/scripts/system/vyatta_update_console.pl +++ b/scripts/system/vyatta_update_console.pl @@ -55,7 +55,8 @@ sub update_inittab { or die "Can't open $TMPTAB: $!"; # Clone original inittab but remove all references to serial lines - print {$tmp} grep {!/^T|^# Vyatta/} <$inittab>; + # and Xen consoles + print {$tmp} grep {!/^T|^# Vyatta|^h/} <$inittab>; close $inittab; my $config = new Vyatta::Config; @@ -63,22 +64,30 @@ sub update_inittab { print {$tmp} "# Vyatta console configuration (do not modify)\n"; - my $id = 0; + my $serial_id = 0; + my $xen_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; + if ($tty =~ /^hvc\d/) { + $speed = 38400 unless $speed; + printf {$tmp} "h%d:23:respawn:", $xen_id; + printf {$tmp} "/sbin/getty %d %s\n", $speed, $tty; + $xen_id++; + } else { + $speed = 9600 unless $speed; + printf {$tmp} "T%d:23:respawn:", $serial_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 (++$serial_id >= 1000) { + warn "Ignoring $tty only 1000 serial devices supported\n"; + last; + } } } close $tmp; |