X-Git-Url: https://git.siccegge.de//index.cgi?a=blobdiff_plain;f=vmdebootstrap;h=4895147457cb7ee06fddc42281b5bd9af5d66e6c;hb=390e883698f85e34433ef79aeabfde77c06b1c22;hp=add3d44165bfd3b1ea14a8a52fb79709b787f8c9;hpb=9904951b643e62d6c36d60132e0e0f56858986d0;p=forks%2Fvmdebootstrap.git diff --git a/vmdebootstrap b/vmdebootstrap index add3d44..4895147 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -184,6 +184,10 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth self.settings.boolean( ['pkglist'], 'Create a list of package names included in the image.') + self.settings.boolean( + ['no-acpid'], + 'do not install the acpid package', + default=False) def process_args(self, args): # pylint: disable=too-many-branches,too-many-statements if not self.settings['image'] and not self.settings['tarball']: @@ -448,7 +452,7 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth include = self.settings['package'] - if not self.settings['foreign']: + if not self.settings['foreign'] and not self.settings['no-acpid']: include.append('acpid') if self.settings['grub']: @@ -620,16 +624,20 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth def setup_networking(self, rootdir): self.message('Setting up networking') - f = open(os.path.join(rootdir, 'etc', 'network', 'interfaces'), 'w') - f.write('auto lo\n') - f.write('iface lo inet loopback\n') + if not os.path.exists(os.path.join(rootdir, 'etc', 'network', 'interfaces')): + with open(os.path.join( + rootdir, 'etc', 'network', 'interfaces'), 'w') as netfile: + netfile.write('source-directory /etc/network/interfaces.d\n') - if self.settings['enable-dhcp']: - f.write('\n') - f.write('auto eth0\n') - f.write('iface eth0 inet dhcp\n') + with open(os.path.join( + rootdir, 'etc', 'network', 'interfaces.d', 'setup'), 'w') as eth: + eth.write('auto lo\n') + eth.write('iface lo inet loopback\n') - f.close() + if self.settings['enable-dhcp']: + eth.write('\n') + eth.write('auto eth0\n') + eth.write('iface eth0 inet dhcp\n') def append_serial_console(self, rootdir): if self.settings['serial-console']: