]> git.siccegge.de Git - forks/vmdebootstrap.git/commitdiff
handle missing customise scripts cleanly with fallback to upstream examples.
authorNeil Williams <codehelp@debian.org>
Thu, 28 Aug 2014 17:12:02 +0000 (10:12 -0700)
committerNeil Williams <codehelp@debian.org>
Thu, 28 Aug 2014 17:12:02 +0000 (10:12 -0700)
vmdebootstrap

index 80089a513c8961c70d74a9e8c9c00457088c3f1d..546742985f7ec6d936f8ddab8d258618a22ba1f5 100755 (executable)
@@ -567,10 +567,17 @@ append initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s
 
     def customize(self, rootdir):
         script = self.settings['customize']
 
     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
 
     def create_tarball(self, rootdir):
         # Create a tarball of the disk's contents