2
0
mirror of https://github.com/mbusb/multibootusb synced 2024-11-18 15:25:46 +00:00

Merge branch 'master' into devel

This commit is contained in:
mbusb 2017-04-30 15:45:50 +05:30
commit b3f83e08f0
10 changed files with 137 additions and 53 deletions

5
.gitignore vendored
View File

@ -105,4 +105,7 @@ multibootusb*.exe
# Test file which I work on to test logic before committing to main file.
mbusb_te*py
text.txt
text.py
text.py
# Temp files
*~

View File

@ -1,36 +1,59 @@
#### 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?
---------------------
MultiBootUSB is a cross platform* software/utility to create multi boot live Linux on a removable media i.e USB disk.
It is similar to unetbootin but many distros can be installed, provided you have enough space on the disk.
MultiBootUSB also provides an option to uninstall distro(s) at any time, if you wish.
* Only works on windows and linux
How to install?
---------------
## What does multibootusb do?
The install.py script provided with multibootusb should take care of all dependency and install multibootusb.
Assume that you have downloaded the package named "multibootusb.tar.gz" in to your home directory.
Issue the following commands to install multibootusb:-
MultiBootUSB allows you to do the following:-
```
tar -xf ./multibootusb.tar.gz
cd multibootusb
chmod +x ./install.py
sudo ./install.py
```
1. Install multiple live Linux and other Operating Systems in to a USB disk and make it bootable without erasing existing data.
2. Ability to uninstall installed OS later.
3. Write ISO image directly to a USB disk (you can think of GUI for Linux `dd` command).
4. Boot ISO images directly without rebooting your system using QEMU option.
5. Boot bootable USBs without rebooting your system using QEMU option.
6. Boot USB on UEFI/EFI system through GRUB2 bootloader support (limited support).
That is it. You can find multibootusb under system menu or simply launch from terminal by typing "multibootusb".
If "install.py" script fails to install multibootusb successfully then manually install following packages and rerun the install.py script:-
* mtools util-linux parted python3-qt5 python-dbus pkexec
## Installation:
* On Windows:-
* The windows version of multbootusb is not a standalone program. You need to install it on windows after download. Download the latest
precompiled setup binary (.exe) file from
[here](http://multibootusb.org/page_download/)
* The installation is farley simple. Double click on the executable and follow the onscreen instruction.
* On Linux:-
**Using binary method:-**
* Download the installation and source files for various distros from
[here](http://multibootusb.org/page_download/)
* Use your favourite package manager to install multibootusb.
**Using source code method `Linux`:-**
* The install.py script provided with multibootusb should take care of all dependencies and install multibootusb.
Assume that you have downloaded the package named **multibootusb.tar.gz** in to your home directory.
Issue the following commands to install multibootusb:-
```sh
tar -xf ./multibootusb.tar.gz
cd multibootusb
chmod +x ./install.py
sudo ./install.py
```
---
NOTE: install.py currently supports only distros based on apt-get, yum, zypper, pacman.
You can add more if you use other package manager system and email to me for adding into upstream.
The above how to is only for linux. Windows users may download pre compiled standalone binaries/ .exe from
https://sourceforge.net/projects/multibootusb/files/
How to uninstall?
-----------------
@ -42,22 +65,30 @@ chmod +x ./uninstall.py
sudo ./uninstall.py
```
For the rest of operations you can refer [Guide](http://multibootusb.org/page_guide/) section of [http://multibootusb.org](http://multibootusb.org)
Website:
--------
www.multibootusb.org
http://multibootusb.org
Development:
-----------
https://github.com/mbusb/multibootusb
Help:
-----
Mail me at feedback.multibootusb@gmail.com for query, help, bug report or feature request.
Use Github issue service at [https://github.com/mbusb/multibootusb/issues](https://github.com/mbusb/multibootusb/issues)
for help and issues.
Contributor(s)
--------------
LiQiong Lee
Ian Bruce
Ian Bruce
LiQiong Lee
Alin Trăistaru (alindt)
and many others who have given their valuable bug report/ feedback.
Author(s)

View File

@ -20,6 +20,7 @@ import shutil
import subprocess
import sys
import platform
import re
####################################################################################################
@ -34,6 +35,9 @@ else:
# pyinstaller_path = "/home/sundar/Documents/pyInstaller/pyinstaller.py"
pyinstaller_path = "/media/sundar/Data/multibootusb/pyinstaller/pyinstaller.py"
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/"
####################################################################################################
@ -47,6 +51,27 @@ class bcolors:
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():
def __init__(self, name):
self.pkg_name = name
@ -64,6 +89,8 @@ class pkg():
if not os.path.exists(os.path.join(self.release_upload_dir, "Source")):
os.mkdir(os.path.join(self.release_upload_dir, "Source"))
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!")
stdcfg = """[DEFAULT]
Package: multibootusb
@ -89,6 +116,8 @@ class pkg():
print((os.path.join("deb_dist", "python3-multibootusb_" + self.version + "-1_all.deb\n\n\n")))
result = True
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':
require = "python3-qt5, parted, util-linux, mtools, python3-dbus, python3-pyudev, p7zip, python3-six"
else:
@ -282,6 +311,7 @@ if __name__ == '__main__':
if platform.system() == 'Linux':
print('Converting line ending to Linux for proper functioning.')
os.system('dos2unix multibootusb')
argv = sys.argv
if not os.path.exists(release_dir):
print("Release directory does not exist.\nPlease mount and rerun the script.")

View File

@ -1,6 +1,22 @@
#!/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
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
/usr/bin/multibootusb "$@"
fi
if [ -f /usr/bin/multibootusb ]; then
/usr/bin/multibootusb "$@"
fi
if [ -f /usr/local/bin/multibootusb ]; then
/usr/local/bin/multibootusb "$@"
fi
fi

View File

@ -12,7 +12,7 @@
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin</allow_active>
</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>
</action>

View File

@ -216,12 +216,15 @@ def copy_mbusb_dir_usb(usb_disk):
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')):
log('EFI directory does not exist. Creating new.')
os.makedirs(os.path.join(usb_mount_path, 'EFI', 'BOOT'), exist_ok=True)
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"))
result = True
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
else:
log('EFI directory already exist. Not copying.')

View File

@ -346,24 +346,30 @@ Are you SURE you want to enable it?",
"""
self.ui_disable_controls()
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():
log("Installing default syslinux on ", config.usb_disk)
ret = syslinux_default(config.usb_disk)
if ret is True:
if self.ui.install_sys_all.isChecked():
log("Copying multibootusb directory to " + config.usb_mount)
for dirpath, dirnames, filenames in os.walk(resource_path(os.path.join("tools", "multibootusb"))):
for f in filenames:
log("Copying " + f)
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...',
'Syslinux installed successfully on ' + config.usb_disk)
elif ret is False:
QtWidgets.QMessageBox.information(self, 'Install error...',
'Sorry. Syslinux failed to install on ' + config.usb_disk)
else:
log("Installing default syslinux on " + config.usb_disk)
ret = syslinux_default(config.usb_disk)
if ret is True:
if self.ui.check_install_sys_all.isChecked():
log("Copying multibootusb directory to " + config.usb_mount)
for dirpath, dirnames, filenames in os.walk(resource_path(os.path.join("tools", "multibootusb"))):
for f in filenames:
log("Copying " + f)
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...',
'Syslinux installed successfully on ' + config.usb_disk)
elif ret is False:
QtWidgets.QMessageBox.information(self, 'Install error...',
'Sorry. Syslinux failed to install on ' + config.usb_disk)
else:
QtWidgets.QMessageBox.information(self, 'No selection...',
'Please select one of the option from above.')

View File

@ -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.
:return:
"""
if platform.system() == 'Linux':
os.system('sync')
log('Updating multibootusb config file...')
sys_cfg_file = os.path.join(usb_mount, "multibootusb", "syslinux.cfg")
install_dir = os.path.join(usb_mount, "multibootusb", iso_basename(iso_link))

View File

@ -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/diskio.dll"]),
('/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/bg.png"]),
('/usr/share/multibootusb/data/multibootusb', ["data/multibootusb/extlinux.cfg"]),

View File

@ -1,7 +0,0 @@
[DEFAULT]
Package: multibootusb
Depends3: python3-pyqt5, parted, util-linux, mtools, python3-dbus, p7zip-full, python3-six
Build-Depends: python3-all
Section: system
XS-Python-Version: = 3.5
Debian-Version: 1