partoffset = self.settings['bootoffset'] / (1024 * 1024)
self.message("Using bootoffset: %smib %s bytes" % (partoffset, self.settings['bootoffset']))
if self.settings['bootsize'] and self.settings['bootsize'] is not '0%':
+ if self.settings['grub'] and not partoffset:
+ partoffset = 1
bootsize = self.settings['bootsize'] / (1024 * 1024)
bootsize += partoffset
self.message("Using bootsize %smib: %s bytes" % (bootsize, self.settings['bootsize']))
if line.startswith('add map ')]
if len(devices) != parts:
msg = 'Surprising number of partitions - check output of losetup -a'
- logging.debug("%s" % self.runcmd(['losetup', '-a']))
+ logging.debug("%s", self.runcmd(['losetup', '-a']))
logging.debug("%s: devices=%s parts=%s", msg, devices, parts)
raise cliapp.AppException(msg)
root = '/dev/mapper/%s' % devices[rootindex]
with open(inittab, 'a') as f:
f.write('\nS0:23:respawn:%s\n' % serial_command)
+ # pylint: disable=no-self-use
def _grub_serial_console(self, rootdir):
cmdline = 'GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=tty1 console=ttyS0,38400n8"'
terminal = 'GRUB_TERMINAL="serial gfxterm"'
self.runcmd(['chroot', rootdir, 'grub-install', install_dev])
except cliapp.AppException:
self.message("Failed. Is grub2-common installed? Using extlinux.")
+ self.install_extlinux(rootdev, rootdir)
self.runcmd(['umount', os.path.join(rootdir, 'sys')])
self.runcmd(['umount', os.path.join(rootdir, 'proc')])
self.runcmd(['umount', os.path.join(rootdir, 'dev')])
- self.install_extlinux(rootdev, rootdir)
def install_extlinux(self, rootdev, rootdir):
if not os.path.exists("/usr/bin/extlinux"):
with open('/dev/tty', 'w') as tty:
try:
cliapp.runcmd([script, rootdir, self.settings['image']], stdout=tty, stderr=tty)
- except IOError as e:
+ except IOError:
subprocess.call([script, rootdir, self.settings['image']])
def create_tarball(self, rootdir):