Improvements, bug fix and new distros:-

1. Simplified 7zip listing to include directories as well
2. Correctly remove files installed outside multibootusb directory when uninstalling
3. Added Liberte
4. Added option to select zip files when choosing files
5. Added INSERT ISO
6. Added option to choose between two methods when syslinux shipped by ISO is version 3 or below
pull/166/head
mbusb 7 years ago
parent 75ea234d1c
commit 85d3b5b4a4

@ -6,7 +6,6 @@
# Licence: This file is a part of multibootusb package. You can redistribute it or modify
# under the terms of GNU General Public License, version 2 or above.
import logging
import getopt
import sys
import os

@ -60,7 +60,7 @@ def list_iso(iso_link, suppress_out=True):
List the content of ISO files. It does'nt work with non 'utf' characters (simply ignores them).
:param iso_link:Path to ISO link
:param suppress_out: Option to suppress output to stdout. Default True.
:return: Path to files as a list
:return: Path to files and directories as a list
"""
if platform.system() == 'Windows':
if suppress_out is True:
@ -75,6 +75,12 @@ def list_iso(iso_link, suppress_out=True):
file_list = []
_cmd = _7zip + ' l ' + gen.quote(iso_link) + suppress_out
_cmd_out = subprocess.check_output(_cmd, stderr=subprocess.PIPE, shell=True).decode('utf-8', 'ignore').splitlines()
for line in _cmd_out:
if '...' in line:
line = line.split()
_path = line[-1]
file_list.append(_path)
'''
for line in _cmd_out:
line = line.split()
if '.....' in line:
@ -85,6 +91,7 @@ def list_iso(iso_link, suppress_out=True):
else:
f_path = line[-1]
file_list.append(f_path)
'''
return file_list

@ -95,7 +95,7 @@ def distro(iso_cfg_ext_dir, iso_link):
return "porteus"
elif re.search(r'livecd=livecd|PCLinuxOS', string, re.I):
return "pclinuxos"
elif re.search(r'looptype=squashfs', string, re.I):
elif re.search(r'looptype=squashfs|http://dee.su/liberte', string, re.I):
return "gentoo"
elif re.search(r'finnix', string, re.I):
return "finnix"
@ -142,6 +142,8 @@ def distro(iso_cfg_ext_dir, iso_link):
return 'Avira-RS'
elif any("alpine-release" in s.lower() for s in iso_file_list):
return 'alpine'
elif re.search(r'BOOT_IMAGE=insert', string, re.I):
return 'insert'
distro = detect_iso_from_file_list(iso_link)

@ -214,8 +214,10 @@ def copy_mbusb_dir_usb(usb_disk):
if not os.path.exists(os.path.join(usb_mount_path, 'EFI', 'BOOT', 'multibootusb_grub2.txt')):
if not os.path.exists(os.path.join(usb_mount_path, 'EFI', 'BOOT')):
log('EFI directory does not exist. Creating new.')
log('EFI/BOOT directory does not exist. Creating new.')
os.makedirs(os.path.join(usb_mount_path, 'EFI', 'BOOT'), exist_ok=True)
if os.path.exists(os.path.join(usb_mount_path, 'EFI')):
shutil.rmtree(os.path.join(usb_mount_path, 'EFI'))
try:
log('Copying EFI directory to ' + usb_mount_path)
shutil.copytree(resource_path(os.path.join("data", "EFI")), os.path.join(usb_mount_path, "EFI"))

@ -117,6 +117,11 @@ def install_distro():
if os.path.exists(os.path.join(usb_mount, 'apks')):
shutil.rmtree(os.path.join(usb_mount, 'apks'))
shutil.move(os.path.join(install_dir, 'apks'), os.path.join(usb_mount))
elif config.distro == 'insert':
iso_extract_full(config.image_path, install_dir)
if os.path.exists(os.path.join(usb_mount, 'INSERT')):
shutil.rmtree(os.path.join(usb_mount, 'INSERT'))
shutil.move(os.path.join(install_dir, 'INSERT'), os.path.join(usb_mount))
else:
iso.iso_extract_full(config.image_path, install_dir)

@ -229,7 +229,7 @@ Are you SURE you want to enable it?",
if os.path.exists(preference_file_path):
dir_path = open(preference_file_path, 'r').read()
config.image_path = QtWidgets.QFileDialog.getOpenFileName(self, 'Select an iso...', dir_path, 'ISO Files (*.iso)')[0]
config.image_path = QtWidgets.QFileDialog.getOpenFileName(self, 'Select an iso...', dir_path, 'ISO Files (*.iso);; Zip Files(*.zip)')[0]
if config.image_path:
default_dir_path = os.path.dirname(config.image_path)

@ -155,6 +155,7 @@ def uninstall_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...')
os.makedirs(os.path.join(config.usb_mount, 'EFI', 'BOOT'), exist_ok=True)
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):

@ -133,6 +133,10 @@ def update_distro_cfg_files(iso_link, usb_disk, distro, persistence=0):
string = re.sub(r'append ',
'append real_root=' + usb_disk + ' slowusb subdir=/multibootusb/' +
iso_basename(iso_link) + '/ ', string, flags=re.I)
string = re.sub(r'slowusb', 'slowusb loop=/multibootusb/' +
iso_basename(iso_link) + '/liberte/boot/root-x86.sfs', string, flags=re.I)
string = re.sub(r'cdroot_hash=\S*', '', string, flags=re.I)
elif distro == "systemrescuecd":
rows = []
subdir = '/multibootusb/' + iso_basename(iso_link)
@ -380,6 +384,9 @@ def update_mbusb_cfg_file(iso_link, usb_uuid, usb_mount, distro):
if config.syslinux_version == '3':
config_file.write("CONFIG /multibootusb/" + iso_basename(iso_link) + '/' + isolinux_bin_dir(iso_link).replace("\\", "/") + '/isolinux.cfg\n')
config_file.write("APPEND /multibootusb/" + iso_basename(iso_link) + '/' + isolinux_bin_dir(iso_link).replace("\\", "/") + '\n')
config_file.write("# Delete or comment above two lines using # and remove # from below line if "
"you get not a COM module error.\n")
config_file.write("#BOOT " + distro_sys_install_bs.replace("//", "/") + "\n")
else:
config_file.write("BOOT " + distro_sys_install_bs.replace("//", "/") + "\n")

Loading…
Cancel
Save