|
|
@ -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.")
|
|
|
|