mirror of
https://github.com/mbusb/multibootusb
synced 2024-11-18 15:25:46 +00:00
Improvements and bug fixes
1. Added Finnix 2. Check for EFI binary after uninstalling a distro (and copy mbusb binary if not present) 3. Added Fatdog 4. Improved way to detect grub*.cfg file 5. Corrected spelling mistake
This commit is contained in:
parent
2fc61df51e
commit
7b92c2021b
BIN
data/tools/EFI/BOOT/bootx64.efi
Normal file
BIN
data/tools/EFI/BOOT/bootx64.efi
Normal file
Binary file not shown.
1
data/tools/EFI/BOOT/multibootusb_grub2.txt
Normal file
1
data/tools/EFI/BOOT/multibootusb_grub2.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file is created by multibootusb.
|
@ -84,7 +84,7 @@ def distro(iso_cfg_ext_dir, iso_link):
|
|||||||
return "wifislax"
|
return "wifislax"
|
||||||
elif re.search(r'slax', string, re.I):
|
elif re.search(r'slax', string, re.I):
|
||||||
return "slax"
|
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"
|
return "sms"
|
||||||
elif re.search(r'antix', string, re.I):
|
elif re.search(r'antix', string, re.I):
|
||||||
return "antix"
|
return "antix"
|
||||||
@ -98,7 +98,7 @@ def distro(iso_cfg_ext_dir, iso_link):
|
|||||||
return "finnix"
|
return "finnix"
|
||||||
elif re.search(r'wifiway', string, re.I):
|
elif re.search(r'wifiway', string, re.I):
|
||||||
return "wifiway"
|
return "wifiway"
|
||||||
elif re.search(r'puppy|quirky', string, re.I):
|
elif re.search(r'puppy|quirky|fatdog', string, re.I):
|
||||||
return "puppy"
|
return "puppy"
|
||||||
elif re.search(r'ipcop', string, re.I):
|
elif re.search(r'ipcop', string, re.I):
|
||||||
return "ipcop"
|
return "ipcop"
|
||||||
|
@ -47,8 +47,8 @@ def mbusb_update_grub_cfg():
|
|||||||
syslinux_menu = iso_iso_cfg_path.replace('\\', '/')
|
syslinux_menu = iso_iso_cfg_path.replace('\\', '/')
|
||||||
|
|
||||||
efi_grub_cfg = get_grub_cfg(config.iso_link)
|
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)
|
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:
|
if loopback_cfg_path is not False:
|
||||||
grub_cfg_path = loopback_cfg_path.replace('\\', '/')
|
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):
|
if os.path.exists(iso_link):
|
||||||
grub_path = False
|
grub_path = False
|
||||||
iso_file_list = _7zip.list_iso(iso_link)
|
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:
|
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 is True:
|
||||||
if 'efi' in f.lower():
|
if 'efi' in f.lower():
|
||||||
grub_path = f.replace('\\', '/')
|
grub_path = f.replace('\\', '/')
|
||||||
@ -114,7 +116,10 @@ def get_grub_cfg(iso_link, efi=True):
|
|||||||
grub_path = f.replace('\\', '/')
|
grub_path = f.replace('\\', '/')
|
||||||
gen.log('Found ' + grub_path)
|
gen.log('Found ' + grub_path)
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
grub_path = f.replace('\\', '/')
|
||||||
|
gen.log('Found ' + grub_path)
|
||||||
|
break
|
||||||
return grub_path
|
return grub_path
|
||||||
|
|
||||||
|
|
||||||
@ -319,6 +324,7 @@ def iso2grub2(iso_dir):
|
|||||||
write_to_file(grub_file_path, '}\n')
|
write_to_file(grub_file_path, '}\n')
|
||||||
|
|
||||||
if os.path.exists(grub_file_path):
|
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'
|
return 'loopback.cfg'
|
||||||
else:
|
else:
|
||||||
gen.log('Could not convert syslinux config to loopback.cfg')
|
gen.log('Could not convert syslinux config to loopback.cfg')
|
||||||
|
@ -155,6 +155,19 @@ def uninstall_distro():
|
|||||||
update_sys_cfg_file()
|
update_sys_cfg_file()
|
||||||
update_grub_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():
|
def update_sys_cfg_file():
|
||||||
"""
|
"""
|
||||||
|
@ -111,12 +111,20 @@ def update_distro_cfg_files(iso_link, usb_disk, distro, persistence=0):
|
|||||||
elif distro == "ipcop":
|
elif distro == "ipcop":
|
||||||
string = re.sub(r'ipcopboot=cdrom\S*', 'ipcopboot=usb', string)
|
string = re.sub(r'ipcopboot=cdrom\S*', 'ipcopboot=usb', string)
|
||||||
elif distro == "puppy":
|
elif distro == "puppy":
|
||||||
string = re.sub(r'pmedia=cd\S*',
|
if 'pmedia=cd' in string:
|
||||||
'pmedia=usbflash psubok=TRUE psubdir=/multibootusb/' + iso_basename(iso_link) + '/',
|
string = re.sub(r'pmedia=cd\S*',
|
||||||
string)
|
'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":
|
elif distro == "slax":
|
||||||
string = re.sub(r'initrd=',
|
string = re.sub(r'initrd=',
|
||||||
r'from=/multibootusb/' + iso_basename(iso_link) + '/slax fromusb initrd=', string)
|
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":
|
elif distro == "knoppix":
|
||||||
string = re.sub(r'initrd=', 'knoppix_dir=/multibootusb/' + iso_basename(iso_link) + '/KNOPPIX initrd=', string)
|
string = re.sub(r'initrd=', 'knoppix_dir=/multibootusb/' + iso_basename(iso_link) + '/KNOPPIX initrd=', string)
|
||||||
elif distro == "gentoo":
|
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")),
|
shutil.copy2(resource_path(os.path.join("data", "EFI", "BOOT", "bootx64.efi")),
|
||||||
os.path.join(config.usb_mount, 'EFI', 'BOOT'))
|
os.path.join(config.usb_mount, 'EFI', 'BOOT'))
|
||||||
else:
|
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):
|
def update_mbusb_cfg_file(iso_link, usb_uuid, usb_mount, distro):
|
||||||
|
20
setup.py
20
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/dd.exe"]),
|
||||||
('/usr/share/multibootusb/data/tools/dd', ["data/tools/dd/diskio.dll"]),
|
('/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/mkfs', ["data/tools/mkfs/mke2fs.exe"]),
|
||||||
('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/chain.c32"]),
|
('/usr/share/multibootusb/data/tools/EFI', ["data/EFI/*"]),
|
||||||
('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/bg.png"]),
|
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/chain.c32"]),
|
||||||
('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/extlinux.cfg"]),
|
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/bg.png"]),
|
||||||
('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/grub.exe"]),
|
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/extlinux.cfg"]),
|
||||||
('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/memdisk"]),
|
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/grub.exe"]),
|
||||||
('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/menu.c32"]),
|
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/memdisk"]),
|
||||||
('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/menu.lst"]),
|
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/menu.c32"]),
|
||||||
('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/syslinux.cfg"]),
|
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/menu.lst"]),
|
||||||
('/usr/share/multibootusb/data/tools/multibootusb', ["data/multibootusb/vesamenu.c32"]),
|
('/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_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.zip"]),
|
||||||
('/usr/share/multibootusb/data/tools/syslinux', ["data/tools/syslinux/syslinux_linux_64.zip"]),
|
('/usr/share/multibootusb/data/tools/syslinux', ["data/tools/syslinux/syslinux_linux_64.zip"]),
|
||||||
|
Loading…
Reference in New Issue
Block a user