From: Lars Wirzenius Date: Tue, 20 Dec 2011 16:22:43 +0000 (+0000) Subject: add --serial-console option X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=6ae74289015820ae2d2825790988fb882c7e3b8c;p=forks%2Fvmdebootstrap.git add --serial-console option --- 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'])