default='stable')
self.settings.add_string_list_setting(['package'],
'install PACKAGE onto system')
+ self.settings.add_boolean_setting(['enable-dhcp'],
+ 'enable DHCP on eth0')
def process_args(self, args):
if not self.settings['image']:
self.debootstrap(rootdir)
self.set_root_password(rootdir)
self.remove_udev_persistent_rules(rootdir)
+ self.setup_networking(rootdir)
self.install_extlinux(rootdev, rootdir)
except:
self.cleanup()
else:
logging.debug('not removing non-existent %s' % pathname)
+ 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 self.settings['enable-dhcp']:
+ f.write('\n')
+ f.write('allow-hotplug eth0\n')
+ f.write('iface eth0 inet dhcp\n')
+
+ f.close()
+
def install_extlinux(self, rootdev, rootdir):
self.message('Installing extlinux')
.I PACKAGE
on the system.
Can be given multiple times.
+.TP
+.BR \-\-enable-dhcp
+Create an
+.I /etc/network/interfaces
+file that sets up DHCP on the eth0 interface.
+This means the system booted from the image will bring up networking
+automatically in typical environments.
.SH EXAMPLE
To create an image for the stable release of Debian:
.nf