2
0
mirror of https://github.com/mbusb/multibootusb synced 2024-11-01 15:40:16 +00:00

use os.sync()

This commit is contained in:
Alin Trăistaru 2017-05-03 12:24:30 +03:00
parent d62735350e
commit 7695cc43c2
5 changed files with 12 additions and 12 deletions

View File

@ -63,7 +63,7 @@ def dd_linux():
if dd_process.poll() is not None:
log("\nExecuting ==> sync")
os.system("sync")
os.sync()
log("ISO has been written to USB disk...")
return

View File

@ -100,7 +100,7 @@ def install_distro():
if platform.system() == 'Linux':
log('ISO extracted successfully. Sync is in progress...')
os.system('sync')
os.sync()
if config.persistence != 0:
log('Creating persistence...')
@ -159,7 +159,7 @@ def install_patch():
"""
if config.distro == 'debian':
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")
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)

View File

@ -331,7 +331,7 @@ Are you SURE you want to enable it?",
self.update_list_box(config.usb_disk)
if sys.platform.startswith("linux"):
self.ui.statusbar.showMessage("Status: Sync is in progress...")
os.system('sync')
os.sync()
self.ui.statusbar.showMessage("Status: Idle")
self.ui_disable_persistence()
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)
if sys.platform.startswith("linux"):
self.ui.statusbar.showMessage("Status: Sync in progress...")
os.system('sync')
os.sync()
self.ui.statusbar.showMessage("Status: Idle")
QtWidgets.QMessageBox.information(self, 'Uninstall Complete...',
config.uninstall_distro_dir_name + ' has been successfully removed.')

View File

@ -90,7 +90,7 @@ def delete_frm_file_list():
if platform.system() == 'Linux':
gen.log('Removed files from ' + config.uninstall_distro_dir_name)
gen.log('Syncing....')
os.system('sync')
os.sync()
@ -107,7 +107,7 @@ def uninstall_distro():
usb_mount = usb_details['mount_point']
if platform.system() == 'Linux':
os.system('sync')
os.sync()
# remove 'immutable' from files on ext2/3/4 fs
if usb_mount:
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 platform.system() == 'Linux':
os.system('sync')
os.sync()
shutil.rmtree(os.path.join(usb_mount, "multibootusb", config.uninstall_distro_dir_name))
delete_frm_file_list()
@ -161,7 +161,7 @@ def update_sys_cfg_file():
:return:
"""
if platform.system() == 'Linux':
os.system('sync')
os.sync()
sys_cfg_file = os.path.join(config.usb_mount, "multibootusb", "syslinux.cfg")
if not os.path.exists(sys_cfg_file):
@ -181,7 +181,7 @@ def update_grub_cfg_file():
:return:
"""
if platform.system() == 'Linux':
os.system('sync')
os.sync()
grub_cfg_file = os.path.join(config.usb_mount, "multibootusb", "grub", "grub.cfg")
if not os.path.exists(grub_cfg_file):
@ -204,7 +204,7 @@ def uninstall_progress():
usb_details = details(config.usb_disk)
usb_mount = usb_details['mount_point']
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")):
with open(os.path.join(usb_mount, "multibootusb", config.uninstall_distro_dir_name, "multibootusb.cfg"),

View File

@ -270,7 +270,7 @@ def update_mbusb_cfg_file(iso_link, usb_uuid, usb_mount, distro):
:return:
"""
if platform.system() == 'Linux':
os.system('sync')
os.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))