mirror of
https://github.com/mbusb/multibootusb
synced 2024-11-18 15:25:46 +00:00
use os.sync()
This commit is contained in:
parent
d62735350e
commit
7695cc43c2
@ -63,7 +63,7 @@ def dd_linux():
|
|||||||
|
|
||||||
if dd_process.poll() is not None:
|
if dd_process.poll() is not None:
|
||||||
log("\nExecuting ==> sync")
|
log("\nExecuting ==> sync")
|
||||||
os.system("sync")
|
os.sync()
|
||||||
log("ISO has been written to USB disk...")
|
log("ISO has been written to USB disk...")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ def install_distro():
|
|||||||
|
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
log('ISO extracted successfully. Sync is in progress...')
|
log('ISO extracted successfully. Sync is in progress...')
|
||||||
os.system('sync')
|
os.sync()
|
||||||
|
|
||||||
if config.persistence != 0:
|
if config.persistence != 0:
|
||||||
log('Creating persistence...')
|
log('Creating persistence...')
|
||||||
@ -159,7 +159,7 @@ def install_patch():
|
|||||||
"""
|
"""
|
||||||
if config.distro == 'debian':
|
if config.distro == 'debian':
|
||||||
if platform.system() == 'Linux': # Need to syn under Linux. Otherwise, USB disk becomes random read only.
|
if platform.system() == 'Linux': # Need to syn under Linux. Otherwise, USB disk becomes random read only.
|
||||||
os.system('sync')
|
os.sync()
|
||||||
iso_cfg_ext_dir = os.path.join(multibootusb_host_dir(), "iso_cfg_ext_dir")
|
iso_cfg_ext_dir = os.path.join(multibootusb_host_dir(), "iso_cfg_ext_dir")
|
||||||
isolinux_path = os.path.join(iso_cfg_ext_dir, isolinux_bin_path(config.image_path))
|
isolinux_path = os.path.join(iso_cfg_ext_dir, isolinux_bin_path(config.image_path))
|
||||||
iso_linux_bin_dir = isolinux_bin_dir(config.image_path)
|
iso_linux_bin_dir = isolinux_bin_dir(config.image_path)
|
||||||
|
@ -331,7 +331,7 @@ Are you SURE you want to enable it?",
|
|||||||
self.update_list_box(config.usb_disk)
|
self.update_list_box(config.usb_disk)
|
||||||
if sys.platform.startswith("linux"):
|
if sys.platform.startswith("linux"):
|
||||||
self.ui.statusbar.showMessage("Status: Sync is in progress...")
|
self.ui.statusbar.showMessage("Status: Sync is in progress...")
|
||||||
os.system('sync')
|
os.sync()
|
||||||
self.ui.statusbar.showMessage("Status: Idle")
|
self.ui.statusbar.showMessage("Status: Idle")
|
||||||
self.ui_disable_persistence()
|
self.ui_disable_persistence()
|
||||||
log(iso_name(config.image_path) + ' has been successfully installed.')
|
log(iso_name(config.image_path) + ' has been successfully installed.')
|
||||||
@ -453,7 +453,7 @@ Are you SURE you want to enable it?",
|
|||||||
self.update_list_box(config.usb_mount)
|
self.update_list_box(config.usb_mount)
|
||||||
if sys.platform.startswith("linux"):
|
if sys.platform.startswith("linux"):
|
||||||
self.ui.statusbar.showMessage("Status: Sync in progress...")
|
self.ui.statusbar.showMessage("Status: Sync in progress...")
|
||||||
os.system('sync')
|
os.sync()
|
||||||
self.ui.statusbar.showMessage("Status: Idle")
|
self.ui.statusbar.showMessage("Status: Idle")
|
||||||
QtWidgets.QMessageBox.information(self, 'Uninstall Complete...',
|
QtWidgets.QMessageBox.information(self, 'Uninstall Complete...',
|
||||||
config.uninstall_distro_dir_name + ' has been successfully removed.')
|
config.uninstall_distro_dir_name + ' has been successfully removed.')
|
||||||
|
@ -90,7 +90,7 @@ def delete_frm_file_list():
|
|||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
gen.log('Removed files from ' + config.uninstall_distro_dir_name)
|
gen.log('Removed files from ' + config.uninstall_distro_dir_name)
|
||||||
gen.log('Syncing....')
|
gen.log('Syncing....')
|
||||||
os.system('sync')
|
os.sync()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ def uninstall_distro():
|
|||||||
usb_mount = usb_details['mount_point']
|
usb_mount = usb_details['mount_point']
|
||||||
|
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
os.system('sync')
|
os.sync()
|
||||||
# remove 'immutable' from files on ext2/3/4 fs
|
# remove 'immutable' from files on ext2/3/4 fs
|
||||||
if usb_mount:
|
if usb_mount:
|
||||||
subprocess.call("chattr -i -R %s/* 2>/dev/null" % usb_mount, shell=True)
|
subprocess.call("chattr -i -R %s/* 2>/dev/null" % usb_mount, shell=True)
|
||||||
@ -133,7 +133,7 @@ def uninstall_distro():
|
|||||||
|
|
||||||
if os.path.exists(os.path.join(usb_mount, "multibootusb", config.uninstall_distro_dir_name)):
|
if os.path.exists(os.path.join(usb_mount, "multibootusb", config.uninstall_distro_dir_name)):
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
os.system('sync')
|
os.sync()
|
||||||
shutil.rmtree(os.path.join(usb_mount, "multibootusb", config.uninstall_distro_dir_name))
|
shutil.rmtree(os.path.join(usb_mount, "multibootusb", config.uninstall_distro_dir_name))
|
||||||
|
|
||||||
delete_frm_file_list()
|
delete_frm_file_list()
|
||||||
@ -161,7 +161,7 @@ def update_sys_cfg_file():
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
os.system('sync')
|
os.sync()
|
||||||
|
|
||||||
sys_cfg_file = os.path.join(config.usb_mount, "multibootusb", "syslinux.cfg")
|
sys_cfg_file = os.path.join(config.usb_mount, "multibootusb", "syslinux.cfg")
|
||||||
if not os.path.exists(sys_cfg_file):
|
if not os.path.exists(sys_cfg_file):
|
||||||
@ -181,7 +181,7 @@ def update_grub_cfg_file():
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
os.system('sync')
|
os.sync()
|
||||||
|
|
||||||
grub_cfg_file = os.path.join(config.usb_mount, "multibootusb", "grub", "grub.cfg")
|
grub_cfg_file = os.path.join(config.usb_mount, "multibootusb", "grub", "grub.cfg")
|
||||||
if not os.path.exists(grub_cfg_file):
|
if not os.path.exists(grub_cfg_file):
|
||||||
@ -204,7 +204,7 @@ def uninstall_progress():
|
|||||||
usb_details = details(config.usb_disk)
|
usb_details = details(config.usb_disk)
|
||||||
usb_mount = usb_details['mount_point']
|
usb_mount = usb_details['mount_point']
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
os.system('sync')
|
os.sync()
|
||||||
|
|
||||||
if os.path.exists(os.path.join(usb_mount, "multibootusb", config.uninstall_distro_dir_name, "multibootusb.cfg")):
|
if os.path.exists(os.path.join(usb_mount, "multibootusb", config.uninstall_distro_dir_name, "multibootusb.cfg")):
|
||||||
with open(os.path.join(usb_mount, "multibootusb", config.uninstall_distro_dir_name, "multibootusb.cfg"),
|
with open(os.path.join(usb_mount, "multibootusb", config.uninstall_distro_dir_name, "multibootusb.cfg"),
|
||||||
|
@ -270,7 +270,7 @@ def update_mbusb_cfg_file(iso_link, usb_uuid, usb_mount, distro):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
os.system('sync')
|
os.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))
|
||||||
|
Loading…
Reference in New Issue
Block a user