From 545b3e5065fa1f57540cb01255d911d3c5ef2f96 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Thu, 25 Dec 2014 15:04:38 +0000 Subject: [PATCH] fix creation of extlinux configuration --- vmdebootstrap | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/vmdebootstrap b/vmdebootstrap index e736c60..99ef256 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -600,11 +600,9 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth conf = os.path.join(rootdir, 'extlinux.conf') logging.debug('configure extlinux %s', conf) - # python multiline string substitution is just ugly. - # use an external file or live with the mangling, no point in - # mangling the string to remove spaces just to keep it pretty in source. - f = open(conf, 'w') - f.write(''' + kserial = 'console=ttyS0,115200' if self.settings['serial-console'] else '' + extserial = 'serial 0 115200' if self.settings['serial-console'] else '' + msg = ''' default linux timeout 1 @@ -616,11 +614,16 @@ append initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s 'kernel': kernel_image, # pylint: disable=bad-continuation 'initrd': initrd_image, # pylint: disable=bad-continuation 'uuid': uuid, # pylint: disable=bad-continuation - 'kserial': # pylint: disable=bad-continuation - 'console=ttyS0,115200' if self.settings['serial-console'] else '', # pylint: disable=bad-continuation - 'extserial': 'serial 0 115200' if self.settings['serial-console'] else '', # pylint: disable=bad-continuation - }) # pylint: disable=bad-continuation - f.close() # pylint: disable=bad-continuation + 'kserial': kserial, # pylint: disable=bad-continuation + 'extserial': extserial, # pylint: disable=bad-continuation + } # pylint: disable=bad-continuation + logging.debug("extlinux config:\n%s", msg) + + # python multiline string substitution is just ugly. + # use an external file or live with the mangling, no point in + # mangling the string to remove spaces just to keep it pretty in source. + f = open(conf, 'w') + f.write(msg) self.runcmd(['extlinux', '--install', rootdir]) self.runcmd(['sync']) -- 2.39.2