From b89d0fdcb524e475bb8b6c716a3dc7e4af3e1d24 Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Jul 12 2012 15:05:09 +0000 Subject: Fix liveiso detection --- diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py index 7ba1732..f138251 100755 --- a/multiboot-media-creator.py +++ b/multiboot-media-creator.py @@ -26,7 +26,7 @@ import subprocess import sys name = 'Multiboot Media Creator' -version = 0.5 +version = 0.6 my_description = '{0} {1}'.format(name, version) def makehelperdirs(imagedir, iso_basename, type, verbose): @@ -206,13 +206,20 @@ def makeisolinuximage(isolist, imagedir, mountdir, timeout, bootdefaultiso, targ result = os.system(mount_command) if result: sys.exit('I tried to run {0}, but it failed. Exiting.'.format(mount_command)) - isolinux_config = open(os.path.join(mountdir, 'isolinux/isolinux.cfg'), 'r') - isolinux_config_text = isolinux_config.read() - isolinux_config.close() - search_string = 'live' - index = isolinux_config_text.find(search_string) - # If index is -1, then the search_string is not in the text. - if index >= 0: + # We used to check for "live" in the isolinux/isolinux.cfg, but all Fedora ISOs now + # pass that check, including the install media! Now, we just look for .discinfo. If it + # is present, we know we're not on a live ISO. + discinfo_file = os.path.join(mountdir, '.discinfo') + if os.path.isfile(discinfo_file): + if verbose: + print '{0} found. Must be an InstallISO.'.format(discinfo_file) + iso_type_live = False + else: + if verbose: + print '{0} _NOT_ found. Must be a LiveISO.'.format(discinfo_file) + iso_type_live = True + + if iso_type_live: # Okay, this is a Live ISO. if verbose: print '{0} is a Live ISO. Copying files to {1}.'.format(iso, os.path.join(imagedir, iso_basename)) @@ -623,13 +630,20 @@ def makegrubimage(isolist, imagedir, mountdir, timeout, bootdefaultnum, grubarch result = os.system(mount_command) if result: sys.exit('I tried to run {0}, but it failed. Exiting.'.format(mount_command)) - isolinux_config = open(os.path.join(mountdir, 'isolinux/isolinux.cfg'), 'r') - isolinux_config_text = isolinux_config.read() - isolinux_config.close() - search_string = 'live' - index = isolinux_config_text.find(search_string) - # If index is -1, then the search_string is not in the text. - if index >= 0: + # We used to check for "live" in the isolinux/isolinux.cfg, but all Fedora ISOs now + # pass that check, including the install media! Now, we just look for .discinfo. If it + # is present, we know we're not on a live ISO. + discinfo_file = os.path.join(mountdir, '.discinfo') + if os.path.isfile(discinfo_file): + if verbose: + print '{0} found. Must be an InstallISO.'.format(discinfo_file) + iso_type_live = False + else: + if verbose: + print '{0} _NOT_ found. Must be a LiveISO.'.format(discinfo_file) + iso_type_live = True + + if iso_type_live: # Okay, this is a Live ISO. if verbose: print '{0} is a Live ISO. Copying files to {1}.'.format(iso, os.path.join(imagedir, iso_basename))