X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=blobdiff_plain;f=grml2usb;h=70fbfe100a19d69f1d4ebf9196fe6c532ccb9e6c;hp=e42deb68cd185f5f5b09b81f34f9a637fe6fe440;hb=569dfb3b782eca77cef9cf619d543e2522a8e12f;hpb=4f47c040948e1a6c09484ef14edffb38ee26b528 diff --git a/grml2usb b/grml2usb index e42deb6..70fbfe1 100755 --- a/grml2usb +++ b/grml2usb @@ -21,8 +21,10 @@ import glob import uuid import struct +# The line following this line is patched by debian/rules and tarball.sh. +PROG_VERSION='***UNRELEASED***' + # global variables -PROG_VERSION = "0.9.31" MOUNTED = set() # register mountpoints TMPFILES = set() # register tmpfiles DATESTAMP = time.mktime(datetime.datetime.now().timetuple()) # unique identifier for syslinux.cfg @@ -950,19 +952,19 @@ def copy_system_files(grml_flavour, iso_mount, target): if os.path.isdir(iso_mount + '/boot/release'): prefix = release_path + '/' - kernel = search_file(prefix + 'linux26', iso_mount) + kernel = search_file(prefix + 'vmlinuz', iso_mount) + initrd = search_file(prefix + 'initrd.img', iso_mount) if kernel is None: - logging.critical("Fatal kernel not found") - raise CriticalException("error locating kernel file") - else: - exec_rsync(kernel, release_target + '/linux26') + # compat for releases < 2011.12 + kernel = search_file(prefix + 'linux26', iso_mount) + initrd = search_file(prefix + 'initrd.gz', iso_mount) - initrd = search_file(prefix + 'initrd.gz', iso_mount) - if initrd is None: - logging.critical("Fatal: initrd not found") - raise CriticalException("error locating initrd file") - else: - exec_rsync(initrd, release_target + '/initrd.gz') + if kernel is None or initrd is None: + logging.critical("Fatal: kernel or initrd not found") + raise CriticalException("error locating kernel or initrd file") + + exec_rsync(kernel, release_target + '/') + exec_rsync(initrd, release_target + '/') def update_grml_versions(iso_mount, target): @@ -1202,27 +1204,12 @@ def copy_bootloader_files(iso_mount, target, grml_flavour): search_and_copy('hidden.cfg', iso_mount + source_dir, syslinux_target + "new_" + 'hidden.cfg') - - grub_target = target + '/boot/grub/' - execute(mkdir, grub_target) - - if not os.path.isfile(GRML2USB_BASE + "/grub/splash.xpm.gz"): - logging.critical("Error: %s/grub/splash.xpm.gz can not be read.", GRML2USB_BASE) - logging.critical("Please make sure you've installed the grml2usb (Debian) package!") - raise - else: - exec_rsync(GRML2USB_BASE + '/grub/splash.xpm.gz', grub_target + 'splash.xpm.gz') - - # grml splash in grub - copy_if_exist(GRML2USB_BASE + "/grub/grml.png", grub_target + 'grml.png') - - # font file for graphical bootsplash in grub - copy_if_exist('/usr/share/grub/ascii.pf2', grub_target + 'ascii.pf2') - - # always copy grub content as it might be useful - + # copy all grub files from ISO glob_and_copy(iso_mount + '/boot/grub/*.mod', grub_target) + glob_and_copy(iso_mount + '/boot/grub/*.lst', grub_target) glob_and_copy(iso_mount + '/boot/grub/*.img', grub_target) + glob_and_copy(iso_mount + '/boot/grub/*.pf2', grub_target) # fonts for splash + glob_and_copy(iso_mount + '/boot/grub/*.png', grub_target) # splash image glob_and_copy(iso_mount + '/boot/grub/stage*', grub_target) def install_iso_files(grml_flavour, iso_mount, device, target): @@ -1333,20 +1320,15 @@ def handle_grub2_config(grml_flavour, grub_target, bootopt): global GRML_DEFAULT # install main configuration only *once*, no matter how many ISOs we have: - grub_flavour_is_default = False + install_main_config = True if os.path.isfile(grub2_cfg): string = open(grub2_cfg).readline() main_identifier = re.compile(".*main config generated at: %s.*" % re.escape(str(DATESTAMP))) - if not re.match(main_identifier, string): - grub2_config_file = open(grub2_cfg, 'w') - GRML_DEFAULT = grml_flavour - grub_flavour_is_default = True - grub2_config_file.write(generate_main_grub2_config(grml_flavour, bootopt)) - grub2_config_file.close() - else: + if re.match(main_identifier, string): + install_main_config = False + if install_main_config: grub2_config_file = open(grub2_cfg, 'w') GRML_DEFAULT = grml_flavour - grub_flavour_is_default = True grub2_config_file.write(generate_main_grub2_config(grml_flavour, bootopt)) grub2_config_file.close() @@ -1362,7 +1344,7 @@ def handle_grub2_config(grml_flavour, grub_target, bootopt): if grub_flavour_config: grub2_config_file = open(grub2_cfg, 'a') # display only if the grml flavour isn't the default - if not grub_flavour_is_default: + if GRML_DEFAULT != grml_flavour: GRML_FLAVOURS.add(grml_flavour) grub2_config_file.write(generate_flavour_specific_grub2_config(grml_flavour, bootopt)) grub2_config_file.close()