mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-07-19 05:19:40 +02:00
add log on pumount
This commit is contained in:
parent
d17b8ee8a4
commit
e8f4256913
1 changed files with 19 additions and 2 deletions
|
@ -495,7 +495,7 @@ def mount_device():
|
||||||
try:
|
try:
|
||||||
os.statvfs(mount_point)
|
os.statvfs(mount_point)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log(f"Unexpected error: {ex}", flush=True)
|
log(f"Mount - Unexpected error: {ex}", flush=True)
|
||||||
loop += 1
|
loop += 1
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
|
@ -507,7 +507,24 @@ def umount_device():
|
||||||
log("Sync partitions", flush=True)
|
log("Sync partitions", flush=True)
|
||||||
os.system("sync")
|
os.system("sync")
|
||||||
else:
|
else:
|
||||||
os.system("pumount /media/box 2>/dev/null >/dev/null")
|
# os.system("pumount /media/box 2>/dev/null >/dev/null")
|
||||||
|
try:
|
||||||
|
result = subprocess.run(
|
||||||
|
["pumount", "/media/box"],
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
check=True
|
||||||
|
)
|
||||||
|
logging.info("Umount successful")
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
logging.error(f"pumount failed: return code {e.returncode}")
|
||||||
|
return None
|
||||||
|
except FileNotFoundError:
|
||||||
|
logging.error("Command 'pumount' not found")
|
||||||
|
return None
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Umount - Unexpected error: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def log_device_info(dev):
|
def log_device_info(dev):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue