diff --git a/data/tools/EFI/BOOT/bootx64.efi b/data/tools/EFI/BOOT/bootx64.efi new file mode 100644 index 0000000..84c4745 Binary files /dev/null and b/data/tools/EFI/BOOT/bootx64.efi differ diff --git a/data/tools/EFI/BOOT/multibootusb_grub2.txt b/data/tools/EFI/BOOT/multibootusb_grub2.txt new file mode 100644 index 0000000..572f61b --- /dev/null +++ b/data/tools/EFI/BOOT/multibootusb_grub2.txt @@ -0,0 +1 @@ +This file is created by multibootusb. \ No newline at end of file diff --git a/scripts/distro.py b/scripts/distro.py index f568251..e6b6ea3 100644 --- a/scripts/distro.py +++ b/scripts/distro.py @@ -84,7 +84,7 @@ def distro(iso_cfg_ext_dir, iso_link): return "wifislax" elif re.search(r'slax', string, re.I): return "slax" - elif re.search(r'sms |vector|autoexec', string, re.I) and isolinux_bin_exist(iso_link): + elif re.search(r'sms.jpg|vector|autoexec', string, re.I) and isolinux_bin_exist(iso_link): return "sms" elif re.search(r'antix', string, re.I): return "antix" @@ -98,7 +98,7 @@ def distro(iso_cfg_ext_dir, iso_link): return "finnix" elif re.search(r'wifiway', string, re.I): return "wifiway" - elif re.search(r'puppy|quirky', string, re.I): + elif re.search(r'puppy|quirky|fatdog', string, re.I): return "puppy" elif re.search(r'ipcop', string, re.I): return "ipcop" diff --git a/scripts/grub.py b/scripts/grub.py index e8878f7..b5dadbd 100644 --- a/scripts/grub.py +++ b/scripts/grub.py @@ -47,8 +47,8 @@ def mbusb_update_grub_cfg(): syslinux_menu = iso_iso_cfg_path.replace('\\', '/') efi_grub_cfg = get_grub_cfg(config.iso_link) - loopback_cfg_path = iso.iso_file_path(config.iso_link, 'loopback.cfg') boot_grub_cfg = get_grub_cfg(config.iso_link, efi=False) + loopback_cfg_path = iso.iso_file_path(config.iso_link, 'loopback.cfg') if loopback_cfg_path is not False: grub_cfg_path = loopback_cfg_path.replace('\\', '/') @@ -102,9 +102,11 @@ def get_grub_cfg(iso_link, efi=True): if os.path.exists(iso_link): grub_path = False iso_file_list = _7zip.list_iso(iso_link) - if any("grub.cfg" in s.lower() for s in iso_file_list): + if any("grub" in s.lower() for s in iso_file_list): for f in iso_file_list: - if 'grub.cfg' in f.lower(): + f_basename = os.path.basename(f).lower() + if f_basename.startswith('grub') and f_basename.endswith('.cfg'): + #if 'grub.cfg' in f.lower(): if efi is True: if 'efi' in f.lower(): grub_path = f.replace('\\', '/') @@ -114,7 +116,10 @@ def get_grub_cfg(iso_link, efi=True): grub_path = f.replace('\\', '/') gen.log('Found ' + grub_path) break - + else: + grub_path = f.replace('\\', '/') + gen.log('Found ' + grub_path) + break return grub_path @@ -319,6 +324,7 @@ def iso2grub2(iso_dir): write_to_file(grub_file_path, '}\n') if os.path.exists(grub_file_path): + gen.log('loopback.cfg file successfully created.\nYou must send this file for debugging if something goes wrong.') return 'loopback.cfg' else: gen.log('Could not convert syslinux config to loopback.cfg') diff --git a/scripts/uninstall_distro.py b/scripts/uninstall_distro.py index e825a4c..312d8c6 100644 --- a/scripts/uninstall_distro.py +++ b/scripts/uninstall_distro.py @@ -155,6 +155,19 @@ def uninstall_distro(): update_sys_cfg_file() update_grub_cfg_file() + # Check if bootx64.efi is replaced by distro + efi_grub_img = os.path.join(config.usb_mount, 'EFI', 'BOOT', 'bootx64.efi') + if not os.path.exists(efi_grub_img): + gen.log('EFI image does not exist. Copying now...') + shutil.copy2(gen.resource_path(os.path.join("data", "EFI", "BOOT", "bootx64.efi")), + os.path.join(config.usb_mount, 'EFI', 'BOOT')) + elif not gen.grub_efi_exist(efi_grub_img) is True: + gen.log('EFI image overwritten by distro install. Replacing it now...') + shutil.copy2(gen.resource_path(os.path.join("data", "EFI", "BOOT", "bootx64.efi")), + os.path.join(config.usb_mount, 'EFI', 'BOOT')) + else: + gen.log('multibootusb EFI image already exist. Not copying...') + def update_sys_cfg_file(): """ diff --git a/scripts/update_cfg_file.py b/scripts/update_cfg_file.py index 33a71b3..0ce8b4c 100644 --- a/scripts/update_cfg_file.py +++ b/scripts/update_cfg_file.py @@ -111,12 +111,20 @@ def update_distro_cfg_files(iso_link, usb_disk, distro, persistence=0): elif distro == "ipcop": string = re.sub(r'ipcopboot=cdrom\S*', 'ipcopboot=usb', string) elif distro == "puppy": - string = re.sub(r'pmedia=cd\S*', - 'pmedia=usbflash psubok=TRUE psubdir=/multibootusb/' + iso_basename(iso_link) + '/', - string) + if 'pmedia=cd' in string: + string = re.sub(r'pmedia=cd\S*', + 'pmedia=usbflash psubok=TRUE psubdir=/multibootusb/' + iso_basename(iso_link) + '/', + string) + elif 'rootfstype' in string: + string = re.sub(r'rootfstype', + 'pmedia=usbflash psubok=TRUE psubdir=/multibootusb/' + iso_basename(iso_link) + '/ rootfstype', + string) elif distro == "slax": string = re.sub(r'initrd=', r'from=/multibootusb/' + iso_basename(iso_link) + '/slax fromusb initrd=', string) + elif distro == "finnix": + string = re.sub(r'initrd=', + r'finnixdir=/multibootusb/' + iso_basename(iso_link) + '/finnix initrd=', string) elif distro == "knoppix": string = re.sub(r'initrd=', 'knoppix_dir=/multibootusb/' + iso_basename(iso_link) + '/KNOPPIX initrd=', string) elif distro == "gentoo": @@ -242,7 +250,7 @@ def update_distro_cfg_files(iso_link, usb_disk, distro, persistence=0): shutil.copy2(resource_path(os.path.join("data", "EFI", "BOOT", "bootx64.efi")), os.path.join(config.usb_mount, 'EFI', 'BOOT')) else: - gen.log('multibootusb EFI image already exist. No copying...') + gen.log('multibootusb EFI image already exist. Not copying...') def update_mbusb_cfg_file(iso_link, usb_uuid, usb_mount, distro): diff --git a/setup.py b/setup.py index 6bb51d5..7a85ea7 100644 --- a/setup.py +++ b/setup.py @@ -37,15 +37,17 @@ setup( ('/usr/share/multibootusb/data/tools/dd', ["data/tools/dd/dd.exe"]), ('/usr/share/multibootusb/data/tools/dd', ["data/tools/dd/diskio.dll"]), ('/usr/share/multibootusb/data/tools/mkfs', ["data/tools/mkfs/mke2fs.exe"]), - ('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/chain.c32"]), - ('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/bg.png"]), - ('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/extlinux.cfg"]), - ('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/grub.exe"]), - ('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/memdisk"]), - ('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/menu.c32"]), - ('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/menu.lst"]), - ('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/syslinux.cfg"]), - ('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/vesamenu.c32"]), + ('/usr/share/multibootusb/data/tools/EFI', ["data/EFI/*"]), + ('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/chain.c32"]), + ('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/bg.png"]), + ('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/extlinux.cfg"]), + ('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/grub.exe"]), + ('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/memdisk"]), + ('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/menu.c32"]), + ('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/menu.lst"]), + ('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/syslinux.cfg"]), + ('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/vesamenu.c32"]), + ('/usr/share/multibootusb/data/multibootusb/grub', ["data/multibootusb/grub/*"]), ('/usr/share/multibootusb/data/tools/syslinux', ["data/tools/syslinux/syslinux_modules.zip"]), ('/usr/share/multibootusb/data/tools/syslinux', ["data/tools/syslinux/syslinux_linux.zip"]), ('/usr/share/multibootusb/data/tools/syslinux', ["data/tools/syslinux/syslinux_linux_64.zip"]),