From: Neil Williams Date: Tue, 23 Dec 2014 16:25:39 +0000 (+0000) Subject: Fix package lists if no necessary packages exist X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=b1545572859794a22a085f755988693b8d2d3377;p=forks%2Fvmdebootstrap.git Fix package lists if no necessary packages exist On foreign architectures, it is quite possible to not have "necessary_packages", so append the user- specified list and the necessary list separately. Tidy up undefined local variables. --- diff --git a/vmdebootstrap b/vmdebootstrap index ab9486b..aae437a 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -318,6 +318,7 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth self.runcmd(['install-mbr', self.settings['image']]) def setup_kpartx(self): + bootindex = None out = self.runcmd(['kpartx', '-avs', self.settings['image']]) if self.settings['bootsize']: bootindex = 0 @@ -326,7 +327,7 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth else: rootindex = 0 parts = 1 - boot = None + boot = None devices = [line.split()[2] for line in out.splitlines() if line.startswith('add map ')] @@ -367,9 +368,12 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth include.append('sudo') args = ['debootstrap', '--arch=%s' % self.settings['arch']] - if self.settings['package'] and len(necessary_packages) > 0: + if self.settings['package']: args.append( - '--include=%s' % ','.join(necessary_packages + include)) + '--include=%s' % ','.join(include)) + if len(necessary_packages) > 0: + args.append( + '--include=%s' % ','.join(necessary_packages)) if self.settings['foreign']: args.append('--foreign') if self.settings['variant']: