diff options
author | Neil Williams <codehelp@debian.org> | 2014-08-28 10:12:02 -0700 |
---|---|---|
committer | Neil Williams <codehelp@debian.org> | 2014-08-28 10:12:02 -0700 |
commit | cd21365ff16bb2a7224bd4815a7616a2aa639825 (patch) | |
tree | ac31e8347e87b66bfa5936fff9343995f943fa77 /vmdebootstrap | |
parent | 9d8a5152b0a56ec94bbf43c37539f6760a3a1404 (diff) | |
download | vmdebootstrap-cd21365ff16bb2a7224bd4815a7616a2aa639825.tar.gz |
handle missing customise scripts cleanly with fallback to upstream examples.
Diffstat (limited to 'vmdebootstrap')
-rwxr-xr-x | vmdebootstrap | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/vmdebootstrap b/vmdebootstrap index 80089a5..5467429 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -567,10 +567,17 @@ append initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s def customize(self, rootdir): script = self.settings['customize'] - if script: - self.message('Running customize script %s' % script) - with open('/dev/tty', 'w') as tty: - cliapp.runcmd([script, rootdir], stdout=tty, stderr=tty) + if not script: + return + if not os.path.exists(script): + example = os.path.join("/usr/share/vmdebootstrap/examples/", script) + if not os.path.exists(example): + self.message("Unable to find %s" % script) + return + script = example + self.message('Running customize script %s' % script) + with open('/dev/tty', 'w') as tty: + cliapp.runcmd([script, rootdir], stdout=tty, stderr=tty) def create_tarball(self, rootdir): # Create a tarball of the disk's contents |