Check for precense of grub/syslinux at startup time. [Closes: issue855]
authorMichael Prokop <mika@grml.org>
Fri, 28 May 2010 23:20:52 +0000 (01:20 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 28 May 2010 23:27:18 +0000 (01:27 +0200)
grml2usb

index 414b9c5..8560f34 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -699,18 +699,12 @@ def install_bootloader(device):
 
     # by default we use grub, so install syslinux only on request
     if options.grub:
 
     # by default we use grub, so install syslinux only on request
     if options.grub:
-        if not which("grub-install"):
-            logging.critical("Fatal: grub-install not available (please install the "
-                             + "grub package or use the --syslinux option)")
+        try:
+            install_grub(device)
+        except CriticalException, error:
+            logging.critical("Fatal: %s", error)
             cleanup()
             sys.exit(1)
             cleanup()
             sys.exit(1)
-        else:
-            try:
-                install_grub(device)
-            except CriticalException, error:
-                logging.critical("Fatal: %s", error)
-                cleanup()
-                sys.exit(1)
     else:
         try:
             install_syslinux(device)
     else:
         try:
             install_syslinux(device)
@@ -2057,7 +2051,6 @@ def main():
     if options.dryrun:
         logging.info("Running in simulation mode as requested via option dry-run.")
 
     if options.dryrun:
         logging.info("Running in simulation mode as requested via option dry-run.")
 
-
     # specified arguments
     device = args[len(args) - 1]
     isos = args[0:len(args) - 1]
     # specified arguments
     device = args[len(args) - 1]
     isos = args[0:len(args) - 1]
@@ -2071,6 +2064,18 @@ def main():
             logging.critical("Fatal: installation on raw device not supported. (BIOS won't support it.)")
             sys.exit(1)
 
             logging.critical("Fatal: installation on raw device not supported. (BIOS won't support it.)")
             sys.exit(1)
 
+    if options.grub:
+        if not which("grub-install"):
+            logging.critical("Fatal: grub-install not available (please install the "
+                             + "grub package or drop the --grub option)")
+            sys.exit(1)
+
+    if options.syslinux:
+        if not which("syslinux"):
+            logging.critical("Fatal: syslinux not available (please install the "
+                             + "syslinux package or use the --grub option)")
+            sys.exit(1)
+
     if not which("rsync"):
         logging.critical("Fatal: rsync not available, can not continue - sorry.")
         sys.exit(1)
     if not which("rsync"):
         logging.critical("Fatal: rsync not available, can not continue - sorry.")
         sys.exit(1)