mirror of
https://github.com/mbusb/multibootusb
synced 2024-11-01 15:40:16 +00:00
Improvement under Linux and build improvements
1. Fix for crash when installing under Install syslinux tab 2. Prevent read only filesystem under Linux 3. Corrected setup file copy location preventing crash 4. Improved multibootusb-pkexec script for working under rpm and deb based distros 5. Create correct policy file during build time 6. Modified readme file to point to improved guide
This commit is contained in:
parent
252dee154d
commit
4a41cbbc79
5
.gitignore
vendored
5
.gitignore
vendored
@ -105,4 +105,7 @@ multibootusb*.exe
|
|||||||
# Test file which I work on to test logic before committing to main file.
|
# Test file which I work on to test logic before committing to main file.
|
||||||
mbusb_te*py
|
mbusb_te*py
|
||||||
text.txt
|
text.txt
|
||||||
text.py
|
text.py
|
||||||
|
|
||||||
|
# Temp files
|
||||||
|
*~
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#### User guide is located [here](http://multibootusb.org/page_guide/)
|
### Only limited instructions are provided here. For detailed instruction please refer [User guide ](http://multibootusb.org/page_guide/)
|
||||||
|
|
||||||
What is multibootusb?
|
What is multibootusb?
|
||||||
---------------------
|
---------------------
|
||||||
|
30
build_pkg
30
build_pkg
@ -20,6 +20,7 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import platform
|
import platform
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
@ -34,6 +35,9 @@ else:
|
|||||||
# pyinstaller_path = "/home/sundar/Documents/pyInstaller/pyinstaller.py"
|
# pyinstaller_path = "/home/sundar/Documents/pyInstaller/pyinstaller.py"
|
||||||
pyinstaller_path = "/media/sundar/Data/multibootusb/pyinstaller/pyinstaller.py"
|
pyinstaller_path = "/media/sundar/Data/multibootusb/pyinstaller/pyinstaller.py"
|
||||||
release_dir = "/media/sundar/Data/multibootusb/release"
|
release_dir = "/media/sundar/Data/multibootusb/release"
|
||||||
|
debian_bin_path = '/usr/bin/multibootusb'
|
||||||
|
rpm_bin_path = '/usr/local/bin/multibootusb'
|
||||||
|
|
||||||
sourceforge_release_path = "multibootusb@frs.sourceforge.net:/home/frs/project/multibootusb/"
|
sourceforge_release_path = "multibootusb@frs.sourceforge.net:/home/frs/project/multibootusb/"
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
|
|
||||||
@ -47,6 +51,27 @@ class bcolors:
|
|||||||
ENDC = '\033[0m'
|
ENDC = '\033[0m'
|
||||||
|
|
||||||
|
|
||||||
|
def coorect_bin_path(_file_path, search_bin_path, replace_bin_path):
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
# shutil.move(_file_path, _file_path + "~")
|
||||||
|
# destination = open(_file_path, "w")
|
||||||
|
# source = open(_file_path + "~", "r").read()
|
||||||
|
|
||||||
|
with open(_file_path + "~", 'r') as _infile:
|
||||||
|
data = _infile.read()
|
||||||
|
|
||||||
|
if re.search(search_bin_path, data, re.I):
|
||||||
|
_data = re.search(search_bin_path, data, re.I).group()
|
||||||
|
_mod_text = re.sub(search_bin_path, replace_bin_path, data)
|
||||||
|
print('_mod_text', _mod_text)
|
||||||
|
with open(_file_path, 'w') as _out_file:
|
||||||
|
_out_file.write(_mod_text)
|
||||||
|
else:
|
||||||
|
with open(_file_path, 'w') as _out_file:
|
||||||
|
_out_file.write(data)
|
||||||
|
|
||||||
|
|
||||||
class pkg():
|
class pkg():
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.pkg_name = name
|
self.pkg_name = name
|
||||||
@ -64,6 +89,8 @@ class pkg():
|
|||||||
if not os.path.exists(os.path.join(self.release_upload_dir, "Source")):
|
if not os.path.exists(os.path.join(self.release_upload_dir, "Source")):
|
||||||
os.mkdir(os.path.join(self.release_upload_dir, "Source"))
|
os.mkdir(os.path.join(self.release_upload_dir, "Source"))
|
||||||
if self.pkg_name == "deb":
|
if self.pkg_name == "deb":
|
||||||
|
print('Modifying policy file...')
|
||||||
|
coorect_bin_path('org.debian.pkexec.run-multibootusb.policy', rpm_bin_path, debian_bin_path)
|
||||||
print("Ensure thta you have python-stdeb package installed!")
|
print("Ensure thta you have python-stdeb package installed!")
|
||||||
stdcfg = """[DEFAULT]
|
stdcfg = """[DEFAULT]
|
||||||
Package: multibootusb
|
Package: multibootusb
|
||||||
@ -89,6 +116,8 @@ class pkg():
|
|||||||
print((os.path.join("deb_dist", "python3-multibootusb_" + self.version + "-1_all.deb\n\n\n")))
|
print((os.path.join("deb_dist", "python3-multibootusb_" + self.version + "-1_all.deb\n\n\n")))
|
||||||
result = True
|
result = True
|
||||||
elif self.pkg_name == 'rpm' or self.pkg_name == 'suse' or self.pkg_name == 'mageia':
|
elif self.pkg_name == 'rpm' or self.pkg_name == 'suse' or self.pkg_name == 'mageia':
|
||||||
|
print('Modifying policy file for rpm packages...')
|
||||||
|
coorect_bin_path('org.debian.pkexec.run-multibootusb.policy', debian_bin_path, rpm_bin_path)
|
||||||
if self.pkg_name == 'suse' or self.pkg_name == 'mageia':
|
if self.pkg_name == 'suse' or self.pkg_name == 'mageia':
|
||||||
require = "python3-qt5, parted, util-linux, mtools, python3-dbus, python3-pyudev, p7zip, python3-six"
|
require = "python3-qt5, parted, util-linux, mtools, python3-dbus, python3-pyudev, p7zip, python3-six"
|
||||||
else:
|
else:
|
||||||
@ -282,6 +311,7 @@ if __name__ == '__main__':
|
|||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
print('Converting line ending to Linux for proper functioning.')
|
print('Converting line ending to Linux for proper functioning.')
|
||||||
os.system('dos2unix multibootusb')
|
os.system('dos2unix multibootusb')
|
||||||
|
|
||||||
argv = sys.argv
|
argv = sys.argv
|
||||||
if not os.path.exists(release_dir):
|
if not os.path.exists(release_dir):
|
||||||
print("Release directory does not exist.\nPlease mount and rerun the script.")
|
print("Release directory does not exist.\nPlease mount and rerun the script.")
|
||||||
|
@ -1,6 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Generic wrapper for locating multibootusb file and execute pkexec accordingly
|
||||||
|
# Bin pat of this file and policy file have to match
|
||||||
|
|
||||||
if [ $(which pkexec) ]; then
|
if [ $(which pkexec) ]; then
|
||||||
pkexec --disable-internal-agent "/usr/bin/multibootusb" "$@"
|
if [ -f /usr/bin/multibootusb ]; then
|
||||||
|
pkexec --disable-internal-agent "/usr/bin/multibootusb" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /usr/local/bin/multibootusb ]; then
|
||||||
|
pkexec --disable-internal-agent "/usr/local/bin/multibootusb" "$@"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
/usr/bin/multibootusb "$@"
|
if [ -f /usr/bin/multibootusb ]; then
|
||||||
fi
|
/usr/bin/multibootusb "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /usr/local/bin/multibootusb ]; then
|
||||||
|
/usr/local/bin/multibootusb "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<allow_inactive>auth_admin</allow_inactive>
|
<allow_inactive>auth_admin</allow_inactive>
|
||||||
<allow_active>auth_admin</allow_active>
|
<allow_active>auth_admin</allow_active>
|
||||||
</defaults>
|
</defaults>
|
||||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/multibootusb</annotate>
|
<annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/multibootusb</annotate>
|
||||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
|
@ -216,12 +216,15 @@ def copy_mbusb_dir_usb(usb_disk):
|
|||||||
log('multibootusb directory already exists. Not copying.')
|
log('multibootusb directory already exists. Not copying.')
|
||||||
|
|
||||||
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', 'multibootusb_grub2.txt')):
|
||||||
|
if not os.path.exists(os.path.join(usb_mount_path, 'EFI', 'BOOT')):
|
||||||
|
log('EFI directory does not exist. Creating new.')
|
||||||
|
os.makedirs(os.path.join(usb_mount_path, 'EFI', 'BOOT'), exist_ok=True)
|
||||||
try:
|
try:
|
||||||
log('Copying EFI directory to ' + usb_mount_path)
|
log('Copying EFI directory to ' + usb_mount_path)
|
||||||
shutil.copytree(resource_path(os.path.join("data", "EFI")), os.path.join(usb_mount_path, "EFI"))
|
shutil.copytree(resource_path(os.path.join("data", "EFI")), os.path.join(usb_mount_path, "EFI"))
|
||||||
result = True
|
result = True
|
||||||
except:
|
except:
|
||||||
log('multibootusb directory could not be copied to ' + usb_mount_path)
|
log('EFI directory could not be copied to ' + usb_mount_path)
|
||||||
result = False
|
result = False
|
||||||
else:
|
else:
|
||||||
log('EFI directory already exist. Not copying.')
|
log('EFI directory already exist. Not copying.')
|
||||||
|
@ -346,24 +346,30 @@ Are you SURE you want to enable it?",
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
self.ui_disable_controls()
|
self.ui_disable_controls()
|
||||||
|
|
||||||
if platform.system() == "Linux" or platform.system() == "Windows":
|
if platform.system() == "Linux" or platform.system() == "Windows":
|
||||||
|
if self.ui.check_install_sys_all.isChecked() or self.ui.check_install_sys_only.isChecked():
|
||||||
|
if platform.system() == 'Linux' and config.usb_disk[-1].isdigit() is False:
|
||||||
|
gen.log('Selected USB is a disk. Please select a disk partition from the drop down list')
|
||||||
|
QtWidgets.QMessageBox.information(self, 'No Partition...!',
|
||||||
|
'USB disk selected doesn\'t contain a partition.\n'
|
||||||
|
'Please select the partition (ending '
|
||||||
|
'with a digit eg. /dev/sdb1)\nfrom the drop down list.')
|
||||||
|
|
||||||
if self.ui.install_sys_all.isChecked() or self.ui.install_sys_only.isChecked():
|
else:
|
||||||
log("Installing default syslinux on ", config.usb_disk)
|
log("Installing default syslinux on " + config.usb_disk)
|
||||||
ret = syslinux_default(config.usb_disk)
|
ret = syslinux_default(config.usb_disk)
|
||||||
if ret is True:
|
if ret is True:
|
||||||
if self.ui.install_sys_all.isChecked():
|
if self.ui.check_install_sys_all.isChecked():
|
||||||
log("Copying multibootusb directory to " + config.usb_mount)
|
log("Copying multibootusb directory to " + config.usb_mount)
|
||||||
for dirpath, dirnames, filenames in os.walk(resource_path(os.path.join("tools", "multibootusb"))):
|
for dirpath, dirnames, filenames in os.walk(resource_path(os.path.join("tools", "multibootusb"))):
|
||||||
for f in filenames:
|
for f in filenames:
|
||||||
log("Copying " + f)
|
log("Copying " + f)
|
||||||
shutil.copy(resource_path(os.path.join(dirpath, f)), os.path.join(self.usb.get_usb(config.usb_disk).mount, "multibootusb"))
|
shutil.copy(resource_path(os.path.join(dirpath, f)), os.path.join(self.usb.get_usb(config.usb_disk).mount, "multibootusb"))
|
||||||
QtWidgets.QMessageBox.information(self, 'Install Success...',
|
QtWidgets.QMessageBox.information(self, 'Install Success...',
|
||||||
'Syslinux installed successfully on ' + config.usb_disk)
|
'Syslinux installed successfully on ' + config.usb_disk)
|
||||||
elif ret is False:
|
elif ret is False:
|
||||||
QtWidgets.QMessageBox.information(self, 'Install error...',
|
QtWidgets.QMessageBox.information(self, 'Install error...',
|
||||||
'Sorry. Syslinux failed to install on ' + config.usb_disk)
|
'Sorry. Syslinux failed to install on ' + config.usb_disk)
|
||||||
else:
|
else:
|
||||||
QtWidgets.QMessageBox.information(self, 'No selection...',
|
QtWidgets.QMessageBox.information(self, 'No selection...',
|
||||||
'Please select one of the option from above.')
|
'Please select one of the option from above.')
|
||||||
|
@ -269,6 +269,8 @@ def update_mbusb_cfg_file(iso_link, usb_uuid, usb_mount, distro):
|
|||||||
Update main multibootusb suslinux.cfg file after distro is installed.
|
Update main multibootusb suslinux.cfg file after distro is installed.
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
if platform.system() == 'Linux':
|
||||||
|
os.system('sync')
|
||||||
log('Updating multibootusb config file...')
|
log('Updating multibootusb config file...')
|
||||||
sys_cfg_file = os.path.join(usb_mount, "multibootusb", "syslinux.cfg")
|
sys_cfg_file = os.path.join(usb_mount, "multibootusb", "syslinux.cfg")
|
||||||
install_dir = os.path.join(usb_mount, "multibootusb", iso_basename(iso_link))
|
install_dir = os.path.join(usb_mount, "multibootusb", iso_basename(iso_link))
|
||||||
|
2
setup.py
2
setup.py
@ -46,7 +46,7 @@ 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/EFI', get_data('data/EFI')),
|
('/usr/share/multibootusb/data/EFI/BOOT', get_data('data/EFI')),
|
||||||
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/chain.c32"]),
|
('/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/bg.png"]),
|
||||||
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/extlinux.cfg"]),
|
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/extlinux.cfg"]),
|
||||||
|
Loading…
Reference in New Issue
Block a user