From: Neil Williams Date: Sun, 24 Aug 2014 18:30:35 +0000 (-0700) Subject: Move inittab change outside extlinux install function to allow usage on systems not... X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=487b569ab0d883c342bef4e0d143d5a01e0a296a;p=forks%2Fvmdebootstrap.git Move inittab change outside extlinux install function to allow usage on systems not using extlinux. --- diff --git a/vmdebootstrap b/vmdebootstrap index 64614ad..31e333e 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -151,6 +151,7 @@ class VmDebootstrap(cliapp.Application): if self.settings['image']: if self.settings['extlinux']: self.install_extlinux(rootdev, rootdir) + self.append_serial_console(rootdir) self.optimize_image(rootdir) if self.settings['foreign']: @@ -414,6 +415,14 @@ class VmDebootstrap(cliapp.Application): f.close() + def append_serial_console(self, rootdir): + if self.settings['serial-console']: + serial_command = self.settings['serial-console-command'] + 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:%s\n' % serial_command) + def install_extlinux(self, rootdev, rootdir): self.message('Installing extlinux') @@ -453,13 +462,6 @@ append initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s 'extserial': 'serial 0 115200' if self.settings['serial-console'] else '', }) f.close() - - if self.settings['serial-console']: - serial_command = self.settings['serial-console-command'] - 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:%s\n' % serial_command) self.runcmd(['extlinux', '--install', rootdir]) self.runcmd(['sync'])