Skip to content

Commit

Permalink
Update to new release - 8.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mbusb committed Feb 5, 2017
1 parent ad5bd3e commit f6b6d1c
Show file tree
Hide file tree
Showing 10 changed files with 299 additions and 16 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Version - 8.5.0
---------------
* Added Solus OS
* Added Ka OS
* Added PC Unlocker
* Fixed bug - Same drives appearing multiple times under imager tab
* Fixed HBCD boot issue
* Fix crash when using ISO Imager option to write ISO files (fix by bagage)
* Small improvement in detecting USB disks under Linux (by gktrk)
* Auto mount USB drives if not mounted under Linux

Version - 8.4.0
---------------
* Bug fix in selection of persistence size
Expand Down
2 changes: 1 addition & 1 deletion data/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.4.0
8.5.0
4 changes: 2 additions & 2 deletions multibootusb.nsi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
;--------------------------------
;NSIS script for creating multibootusb setup file

Name "multibootusb 8.4.0"
OutFile "multibootusb-8.4.0-setup.exe"
Name "multibootusb 8.5.0"
OutFile "multibootusb-8.5.0-setup.exe"

SetCompressor lzma

Expand Down
11 changes: 7 additions & 4 deletions scripts/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ def distro(iso_cfg_ext_dir, iso_link):
return "redhat"
# elif re.search(r'suse', string, re.I):
# return "suse"
elif re.search(r'opensuse', string,
re.I):
elif re.search(r'opensuse', string, re.I):
return "opensuse"
elif re.search(
r'slitaz|dban |ophcrack|tinycore|rescue.cpi|xpud|untangle|4mlinux|partition wizard|android-x86.png|'
Expand Down Expand Up @@ -127,6 +126,9 @@ def distro(iso_cfg_ext_dir, iso_link):
return "ReactOS"
elif re.search(r'fsecure', string, re.I):
return "fsecure"
elif re.search(r'default rwp', string, re.I):
return "pc-unlocker"


distro = detect_iso_from_file_list(iso_link)
if distro:
Expand Down Expand Up @@ -162,12 +164,13 @@ def detect_iso_from_file_list(iso_link):
return "mentest"
elif any("menu.lst" in s.lower() for s in iso_file_list):
return "grub4dos"
elif any("bootwiz.cfg" in s.lower() for s in iso_file_list) and any("bootmenu_logo.png" in s.lower() for s in iso_file_list):
return "grub4dos_iso"
else:
log(iso_file_list)

if __name__ == '__main__':
iso_cfg_ext_dir = os.path.join(multibootusb_host_dir(), "iso_cfg_ext_dir")
#iso_link = '../../../DISTROS/2016/debian-live-8.3.0-amd64-lxde-desktop.iso'
iso_link = '/media/sundar/Data/DISTROS/ubuntu_14_04_backup/Downloads/clonezilla-live-2.4.2-32-amd64.iso'
iso_link = 'Downloads/clonezilla-live-2.4.2-32-amd64.iso'
iso_extract_file(iso_link, iso_cfg_ext_dir, 'cfg')
log(distro(iso_cfg_ext_dir))
3 changes: 1 addition & 2 deletions scripts/imager.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def dd_win():
in_file_size = float(os.path.getsize(config.imager_iso_link) / 1024 / 1024)
output = "of=\\\.\\" + config.imager_usb_disk
command = [windd, input, output, "bs=1M", "--progress"]
log("Executing ==> " + command)
log("Executing ==> " + " ".join(command))
dd_process = subprocess.Popen(command, universal_newlines=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE,
shell=False)
while dd_process.poll() is None:
Expand Down Expand Up @@ -224,4 +224,3 @@ def get_usb_size(self, usb_disk):
else:
usb_size = self.usb.disk_usage(self.usb.get_usb(usb_disk).mount).total
return usb_size

11 changes: 10 additions & 1 deletion scripts/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def install_distro():
elif platform.system() == "Linux":
log("Copying " + config.iso_link + " to " + usb_mount)
shutil.copy(config.iso_link, usb_mount)
elif config.distro == "Windows" or config.distro == "alpine":
elif config.distro == "Windows" or config.distro == "alpine" or config.distro == 'pc-unlocker':
log("Extracting iso to " + usb_mount)
iso_extract_full(config.iso_link, usb_mount)
elif config.distro == "trinity-rescue":
Expand Down Expand Up @@ -91,6 +91,8 @@ def install_distro():
iso_extract_full(config.iso_link, usb_mount)
elif config.distro == 'ReactOS':
iso_extract_full(config.iso_link, usb_mount)
elif config.distro == 'grub4dos_iso':
copy_iso(config.iso_link, install_dir)
else:
iso.iso_extract_full(config.iso_link, install_dir)

Expand All @@ -107,6 +109,13 @@ def install_distro():


def copy_iso(src, dst):
"""
A simple wrapper for copying larger files. This is necessary as
shutil copy files is much slower under Windows platform
:param src: Path to source file
:param dst: Destination directory
:return:
"""
if platform.system() == "Windows":
subprocess.call("xcopy " + src + " " + dst, shell=True)
elif platform.system() == "Linux":
Expand Down
1 change: 1 addition & 0 deletions scripts/mbusb_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def add_device(self):
:return:
"""
self.ui.comboBox.clear()
self.ui.comboBox_2.clear()
if self.ui.checkBox_all_drives.isChecked():
detected_device = usb.list(partition=1, fixed=True)
else:
Expand Down
223 changes: 223 additions & 0 deletions scripts/udisks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
#!/usr/bin/env python3
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
# Name: udisks.py
# Purpose: Module to mount unmount and eject using dbus and udisk
# Authors: Original author is Kovid Goyal <[email protected]> and python3
# supporte by Sundar for multibootusb project
# Licence: 'GPL v3' as per original Licence

__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <[email protected]>'
__docformat__ = 'restructuredtext en'

# from __future__ import print_function
import os, re


def node_mountpoint(node):

def de_mangle(raw):
return raw.replace('\\040', ' ').replace('\\011', '\t').replace('\\012',
'\n').replace('\\0134', '\\')

for line in open('/proc/mounts').readlines():
line = line.split()
if line[0] == node:
return de_mangle(line[1])
return None


class NoUDisks1(Exception):
pass


class UDisks(object):

def __init__(self):
import dbus
self.bus = dbus.SystemBus()
try:
self.main = dbus.Interface(self.bus.get_object('org.freedesktop.UDisks',
'/org/freedesktop/UDisks'), 'org.freedesktop.UDisks')
except dbus.exceptions.DBusException as e:
if getattr(e, '_dbus_error_name', None) == 'org.freedesktop.DBus.Error.ServiceUnknown':
raise NoUDisks1()
raise

def device(self, device_node_path):
import dbus
devpath = self.main.FindDeviceByDeviceFile(device_node_path)
return dbus.Interface(self.bus.get_object('org.freedesktop.UDisks',
devpath), 'org.freedesktop.UDisks.Device')

def mount(self, device_node_path):
d = self.device(device_node_path)
try:
return str(d.FilesystemMount('',
['auth_no_user_interaction', 'rw', 'noexec', 'nosuid',
'nodev', 'uid=%d'%os.geteuid(), 'gid=%d'%os.getegid()]))
except:
# May be already mounted, check
mp = node_mountpoint(str(device_node_path))
if mp is None:
raise
return mp

def unmount(self, device_node_path):
d = self.device(device_node_path)
d.FilesystemUnmount(['force'])

def eject(self, device_node_path):
parent = device_node_path
while parent[-1] in '0123456789':
parent = parent[:-1]
d = self.device(parent)
d.DriveEject([])


class NoUDisks2(Exception):
pass


class UDisks2(object):

BLOCK = 'org.freedesktop.UDisks2.Block'
FILESYSTEM = 'org.freedesktop.UDisks2.Filesystem'
DRIVE = 'org.freedesktop.UDisks2.Drive'

def __init__(self):
import dbus
self.bus = dbus.SystemBus()
try:
self.bus.get_object('org.freedesktop.UDisks2',
'/org/freedesktop/UDisks2')
except dbus.exceptions.DBusException as e:
if getattr(e, '_dbus_error_name', None) == 'org.freedesktop.DBus.Error.ServiceUnknown':
raise NoUDisks2()
raise

def device(self, device_node_path):
device_node_path = os.path.realpath(device_node_path)
devname = device_node_path.split('/')[-1]

# First we try a direct object path
bd = self.bus.get_object('org.freedesktop.UDisks2',
'/org/freedesktop/UDisks2/block_devices/%s'%devname)
try:
device = bd.Get(self.BLOCK, 'Device',
dbus_interface='org.freedesktop.DBus.Properties')
device = bytearray(device).replace(b'\x00', b'').decode('utf-8')
except:
device = None

if device == device_node_path:
return bd

# Enumerate all devices known to UDisks
devs = self.bus.get_object('org.freedesktop.UDisks2',
'/org/freedesktop/UDisks2/block_devices')
xml = devs.Introspect(dbus_interface='org.freedesktop.DBus.Introspectable')
for dev in re.finditer(r'name=[\'"](.+?)[\'"]', type('')(xml)):
bd = self.bus.get_object('org.freedesktop.UDisks2',
'/org/freedesktop/UDisks2/block_devices/%s2'%dev.group(1))
try:
device = bd.Get(self.BLOCK, 'Device',
dbus_interface='org.freedesktop.DBus.Properties')
device = bytearray(device).replace(b'\x00', b'').decode('utf-8')
except:
device = None
if device == device_node_path:
return bd

raise ValueError('%r not known to UDisks2'%device_node_path)

def mount(self, device_node_path):
d = self.device(device_node_path)
mount_options = ['rw', 'noexec', 'nosuid',
'nodev', 'uid=%d'%os.geteuid(), 'gid=%d'%os.getegid()]
try:
return str(d.Mount(
{
'auth.no_user_interaction':True,
'options':','.join(mount_options)
},
dbus_interface=self.FILESYSTEM))
except:
# May be already mounted, check
mp = node_mountpoint(str(device_node_path))
if mp is None:
raise
return mp

def unmount(self, device_node_path):
d = self.device(device_node_path)
d.Unmount({'force':True, 'auth.no_user_interaction':True},
dbus_interface=self.FILESYSTEM)

def drive_for_device(self, device):
drive = device.Get(self.BLOCK, 'Drive',
dbus_interface='org.freedesktop.DBus.Properties')
return self.bus.get_object('org.freedesktop.UDisks2', drive)

def eject(self, device_node_path):
drive = self.drive_for_device(self.device(device_node_path))
drive.Eject({'auth.no_user_interaction':True},
dbus_interface=self.DRIVE)


def get_udisks(ver=None):
if ver is None:
try:
u = UDisks2()
except NoUDisks2:
u = UDisks()
return u
return UDisks2() if ver == 2 else UDisks()


def get_udisks1():
u = None
try:
u = UDisks()
except NoUDisks1:
try:
u = UDisks2()
except NoUDisks2:
pass
if u is None:
raise EnvironmentError('UDisks not available on your system')
return u


def mount(node_path):
u = get_udisks1()
u.mount(node_path)


def eject(node_path):
u = get_udisks1()
u.eject(node_path)


def umount(node_path):
u = get_udisks1()
u.unmount(node_path)


def test_udisks(ver=None):
import sys
dev = sys.argv[1]
print('Testing with node', dev)
u = get_udisks(ver=ver)
print('Using Udisks:', u.__class__.__name__)
print('Mounted at:', u.mount(dev))
print('Unmounting')
u.unmount(dev)
print('Mounting')
u.mount(dev)
print('Ejecting:')
u.eject(dev)

if __name__ == '__main__':
print('Run test here...')
# test_udisks()
Loading

0 comments on commit f6b6d1c

Please sign in to comment.