1
0
Fork 0
mirror of https://github.com/dbarzin/pandora-box.git synced 2025-07-19 05:19:40 +02:00

work on exfat

This commit is contained in:
didier 2025-04-18 09:13:37 +02:00
parent 06085a6368
commit db271085e0
2 changed files with 12 additions and 9 deletions

View file

@ -180,12 +180,15 @@ echo '0 20 * * * /sbin/poweroff' >> /etc/crontab
#---------------------
cd /home/$SUDO_USER/pandora-box
# FIM, pmount, psmisc (for killall) and vim
# FIM, psmisc (for killall) and vim
apt --fix-broken install -y
apt install -y fim pmount psmisc vim
apt install -y fim psmisc vim
# Add user in plugdev group to allow pmount
usermod -aG plugdev $SUDO_USER
# Add exfat filesystem
apt install exfat-fuse exfatprogs
# Allow sudo_user users to mount and umount devices
echo "$SUDO_USER ALL=(ALL) NOPASSWD: /bin/mount, /bin/umount" > /etc/sudoers.d/usbmount
# Python libraries
su - $SUDO_USER -c "./.local/bin/pip install pypandora psutil pyudev"

View file

@ -510,7 +510,7 @@ def mount_device():
# Mount device
try:
subprocess.run(
["pmount", device.device_node, "/media/box"],
["sudo", "mount", device.device_node, "/media/box"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
check=True,
@ -520,7 +520,7 @@ def mount_device():
logging.error(f"Mount failed: return code {e.returncode}")
return None
except FileNotFoundError:
logging.error("Command 'pmount' not found")
logging.error("Command 'mount' not found")
return None
except Exception as e:
logging.error(f"Unexpected error: {e}")
@ -546,17 +546,17 @@ def umount_device():
else:
try:
subprocess.run(
["pumount", "/media/box"],
["sudo", "umount", "/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}")
logging.error(f"umount failed: return code {e.returncode}")
return None
except FileNotFoundError:
logging.error("Command 'pumount' not found")
logging.error("Command 'umount' not found")
return None
except Exception as e:
logging.error(f"Umount - Unexpected error: {e}")