X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=blobdiff_plain;f=grml2usb;h=8560f34396123529e2b690958e300ecf4ab52a94;hp=a13e6eac9c18f9f523830b5cb8f7910e97aab7eb;hb=3836a7165cd7f3e82ffca1b841fca16eb789a6ce;hpb=e3271ff457c955c12b859591542b3e597677d584 diff --git a/grml2usb b/grml2usb index a13e6ea..8560f34 100755 --- a/grml2usb +++ b/grml2usb @@ -22,7 +22,7 @@ import uuid import struct # global variables -PROG_VERSION = "0.9.25" +PROG_VERSION = "0.9.26" MOUNTED = set() # register mountpoints TMPFILES = set() # register tmpfiles DATESTAMP = time.mktime(datetime.datetime.now().timetuple()) # unique identifier for syslinux.cfg @@ -699,18 +699,12 @@ def install_bootloader(device): # 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) - else: - try: - install_grub(device) - except CriticalException, error: - logging.critical("Fatal: %s", error) - cleanup() - sys.exit(1) else: try: install_syslinux(device) @@ -910,8 +904,8 @@ def mount(source, target, mount_options): for x in file('/proc/mounts').readlines(): if x.startswith(source): - raise CriticalException("Error executing mount: %s already mounted - " - + "please unmount before invoking grml2usb" % source) + raise CriticalException("Error executing mount: %s already mounted - " % source + + "please unmount before invoking grml2usb") if os.path.isdir(source): logging.debug("Source %s is not a device, therefore not mounting.", source) @@ -990,8 +984,9 @@ def check_for_fat(partition): " (wrong UID/permissions or device/directory not present?)" % partition) if filesystem != "vfat": - raise CriticalException("Partition %s does not contain a FAT16 filesystem. " - + "(Use --fat16 or run mkfs.vfat %s)" % (partition, partition)) + raise CriticalException( + "Partition %s does not contain a FAT16 filesystem." % (partition) \ + + "(Use --fat16 or run mkfs.vfat %s)" % (partition)) except OSError: raise CriticalException("Sorry, /sbin/blkid not available (install e2fsprogs?)") @@ -2056,7 +2051,6 @@ def main(): 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] @@ -2070,6 +2064,18 @@ def main(): 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)