X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=blobdiff_plain;f=grml2usb;h=414b9c5af49f4484f6f22c7a68861a2273a7957a;hp=ccdb4db45107f44b180994fdb718fa026a0f3d7e;hb=779a8334c32bb2389e2cffb32a3fefeb9b3f415c;hpb=c70267a95f93aff25600404e127a6f80f48ff084 diff --git a/grml2usb b/grml2usb index ccdb4db..414b9c5 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 @@ -910,8 +910,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 +990,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?)") @@ -1538,6 +1539,20 @@ def handle_grub2_config(grml_flavour, grub_target, bootopt): modify_grub_config(grub2_cfg) +def get_bootoptions(grml_flavour): + """Returns bootoptions for specific flavour + + @grml_flavour: name of the grml_flavour + """ + # do NOT write "None" in kernel cmdline + if options.bootoptions is None: + bootopt = "" + else: + bootopt = options.bootoptions + bootopt = bootopt.replace("%flavour", grml_flavour) + return bootopt + + def handle_grub_config(grml_flavour, device, target): """Main handler for generating grub (v1 and v2) configuration @@ -1557,11 +1572,8 @@ def handle_grub_config(grml_flavour, device, target): else: raise CriticalException("error validating partition schema (raw device?)") - # do NOT write "None" in kernel cmdline - if options.bootoptions is None: - bootopt = "" - else: - bootopt = options.bootoptions + + bootopt = get_bootoptions(grml_flavour) # write menu.lst handle_grub1_config(grml_flavour, install_grub1_partition, grub_target, bootopt) @@ -1624,11 +1636,7 @@ def adjust_syslinux_bootoptions(src, flavour): bootid_re = re.compile("bootid=[\w_-]+") live_media_path_re = re.compile("live-media-path=[\w_/-]+") - # do NOT write "None" in kernel cmdline - if options.bootoptions is None: - bootopt = "" - else: - bootopt = options.bootoptions + bootopt = get_bootoptions(flavour) regexe = [] option_re = None