mirror of
https://github.com/mbusb/multibootusb
synced 2024-10-30 21:20:16 +00:00
Can run as non-root on Linux
This commit is contained in:
parent
fa89b28f27
commit
6b999f48b7
@ -128,11 +128,6 @@ Example for installing syslinux to target USB disk:
|
||||
def start_gui():
|
||||
from scripts import mbusb_gui
|
||||
gen.log('Starting multibootusb GUI...')
|
||||
if platform.system() == 'Linux':
|
||||
if os.getuid() != 0:
|
||||
gen.log('\n\nAdmin privilege is required to run multibootusb.\n If you are running from source try '
|
||||
'\'sudo python3 ./multibootusb\'\n or you can try \'multibootusb-pkexec\' (post install)\n\n',
|
||||
info=False, debug=True)
|
||||
mbusb_gui.main_gui()
|
||||
|
||||
|
||||
|
@ -1048,13 +1048,8 @@ def main_gui():
|
||||
# ui_about = Ui_About()
|
||||
# ui = Ui_MainWindow()
|
||||
|
||||
if platform.system() == 'Linux' and os.getuid() != 0:
|
||||
show_admin_info()
|
||||
sys.exit(2)
|
||||
|
||||
else:
|
||||
window = AppGui()
|
||||
window.show()
|
||||
window.setWindowTitle("MultiBootUSB - " + mbusb_version())
|
||||
window.setWindowIcon(QtGui.QIcon(resource_path(os.path.join("data", "tools", "multibootusb.png"))))
|
||||
window = AppGui()
|
||||
window.show()
|
||||
window.setWindowTitle("MultiBootUSB - " + mbusb_version())
|
||||
window.setWindowIcon(QtGui.QIcon(resource_path(os.path.join("data", "tools", "multibootusb.png"))))
|
||||
sys.exit(app.exec_())
|
||||
|
@ -410,7 +410,7 @@ class Linux(Base):
|
||||
lang = os.getenv('LANG')
|
||||
encoding = lang.rsplit('.')[-1] if lang else 'utf-8'
|
||||
raise RuntimeError(str(_err_out, encoding))
|
||||
subprocess.check_call(['partprobe', disk_dev])
|
||||
udisks.rescan(disk_dev)
|
||||
if b'msdos' in _cmd_out:
|
||||
return False
|
||||
if b'gpt' in _cmd_out:
|
||||
|
@ -136,6 +136,16 @@ class UDisks2(object):
|
||||
|
||||
raise ValueError('%r not known to UDisks2'%device_node_path)
|
||||
|
||||
def rescan(self, node_path):
|
||||
# Rescan partition table
|
||||
import dbus
|
||||
mgr = self.bus.get_object('org.freedesktop.UDisks2',
|
||||
'/org/freedesktop/UDisks2/Manager')
|
||||
dev_paths = mgr.ResolveDevice({'path': node_path}, {}, dbus_interface='org.freedesktop.UDisks2.Manager')
|
||||
for dev in dev_paths:
|
||||
bd = self.bus.get_object('org.freedesktop.UDisks2', dev)
|
||||
bd.Rescan('', dbus_interface='org.freedesktop.UDisks2.Block')
|
||||
|
||||
def mount(self, device_node_path, remounted=None):
|
||||
mp = node_mountpoint(str(device_node_path))
|
||||
if mp:
|
||||
@ -207,6 +217,10 @@ def umount(node_path):
|
||||
u.unmount(node_path)
|
||||
|
||||
|
||||
def rescan(node_path):
|
||||
u = get_udisks()
|
||||
u.rescan(node_path)
|
||||
|
||||
def test_udisks(ver=None):
|
||||
import sys
|
||||
dev = sys.argv[1]
|
||||
|
Loading…
Reference in New Issue
Block a user