From: Lars Wirzenius Date: Sun, 15 May 2011 11:00:24 +0000 (+0100) Subject: Add --customize script. X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=9a1ad54ad3d28dd96d251e705b8372505d3be761;p=forks%2Fvmdebootstrap.git Add --customize script. --- diff --git a/vmdebootstrap b/vmdebootstrap index f270e5a..5ee3277 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -60,6 +60,9 @@ class VmDebootstrap(cliapp.Application): self.settings.add_string_setting(['root-password'], 'set root password', metavar='PASSWORD') + self.settings.add_string_setting(['customize'], + 'run SCRIPT after setting up system', + metavar='SCRIPT') def process_args(self, args): if not self.settings['image']: @@ -82,6 +85,7 @@ class VmDebootstrap(cliapp.Application): self.remove_udev_persistent_rules(rootdir) self.setup_networking(rootdir) self.install_extlinux(rootdev, rootdir) + self.customize(rootdir) except: self.cleanup() raise @@ -256,6 +260,12 @@ append initrd=%(initrd)s root=UUID=%(uuid)s ro quiet for dirname in self.remove_dirs: shutil.rmtree(dirname) + def customize(self, rootdir): + script = self.settings['customize'] + if script: + self.message('Running customize script %s' % script) + self.runcmd([script, rootdir]) + if __name__ == '__main__': VmDebootstrap().run() diff --git a/vmdebootstrap.8 b/vmdebootstrap.8 index ba3108e..fcb2ffb 100644 --- a/vmdebootstrap.8 +++ b/vmdebootstrap.8 @@ -127,6 +127,14 @@ Without DHCP, only localhost networking is set up. .BR \-\-root\-password =\fIPASSWORD Set password for root. The default is to disable root's password. +.TP +.BR \-\-customize =\fISCRIPT +Run +.I SCRIPT +(typically, but not necessarily, a shell script) +after setting up the new system image. +The script will get a single parameters: +the path to the root directory of the newly installed system. .SH EXAMPLE To create an image for the stable release of Debian: .nf