summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-12-20 16:22:43 +0000
committerLars Wirzenius <liw@liw.fi>2011-12-20 16:22:43 +0000
commit6ae74289015820ae2d2825790988fb882c7e3b8c (patch)
treea61523c81edcd526656f705e3f9b3f4fbc608ef2
parentd4538dd8232752804485f0b75558f0f07b74ce19 (diff)
downloadvmdebootstrap-6ae74289015820ae2d2825790988fb882c7e3b8c.tar.gz
add --serial-console option
-rwxr-xr-xvmdebootstrap14
1 files changed, 13 insertions, 1 deletions
diff --git a/vmdebootstrap b/vmdebootstrap
index 05178ea..b6d6a48 100755
--- a/vmdebootstrap
+++ b/vmdebootstrap
@@ -61,6 +61,8 @@ class VmDebootstrap(cliapp.Application):
self.settings.string_list(['user'],
'create USER with PASSWORD',
metavar='USER/PASSWORD')
+ self.settings.boolean(['serial-console'],
+ 'configure image to use a serial console')
def process_args(self, args):
if not self.settings['image']:
@@ -272,13 +274,23 @@ timeout 1
label linux
kernel %(kernel)s
-append initrd=%(initrd)s root=UUID=%(uuid)s ro quiet
+append initrd=%(initrd)s root=UUID=%(uuid)s ro quiet %(kserial)s
+%(extserial)s
''' % {
'kernel': kernel_image,
'initrd': initrd_image,
'uuid': uuid,
+ 'kserial':
+ 'console=ttyS0,115200' if self.settings['serial-console'] else '',
+ 'extserial': 'serial 0 115200' if self.settings['serial-console'] else '',
})
f.close()
+
+ if self.settings['serial-console']:
+ logging.debug('adding getty to serial console')
+ inittab = os.path.join(rootdir, 'etc/inittab')
+ with open(inittab, 'a') as f:
+ f.write('\nS0:23:respawn:/sbin/getty -L ttyS0 115200 vt100\n')
self.runcmd(['extlinux', '--install', rootdir])
self.runcmd(['sync'])