diff --git a/install.sh b/install.sh index d605328..906af24 100755 --- a/install.sh +++ b/install.sh @@ -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" diff --git a/pandora-box.py b/pandora-box.py index 67ca412..fcb7a26 100755 --- a/pandora-box.py +++ b/pandora-box.py @@ -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}")