Added revisions to the translation app

This commit is contained in:
2026-01-12 08:52:38 -05:00
parent 64add85920
commit 8181bebaa0
44 changed files with 993 additions and 375 deletions
+69
View File
@@ -0,0 +1,69 @@
#!/bin/bash
# Configuration
MOUNT_POINT="/mnt/truenas_isolation"
SHARE="//truenas.local/isolation"
echo "--- SMB Mount Tool (V1) ---"
# Determine privilege escalation method
PRIV_CMD=""
if [ "$EUID" -eq 0 ]; then
echo "Running as root."
else
if command -v sudo &> /dev/null; then
PRIV_CMD="sudo"
elif command -v flatpak-spawn &> /dev/null; then
echo "Detected Flatpak environment. Attempting to use host permissions via sudo..."
# We need to run sudo ON THE HOST.
# flatpak-spawn --host runs as the current user on the host.
# So we run 'sudo' inside that host shell.
PRIV_CMD="flatpak-spawn --host sudo"
# Note: This requires the flatpak to have permission to talk to the host
else
echo "❌ Error: This script requires root privileges to mount drives."
echo " 'sudo' was not found."
echo " Please run this script as root: su -c ./mount_truenas.sh"
exit 1
fi
fi
# 1. Create mount point if it doesn't exist
if [ ! -d "$MOUNT_POINT" ]; then
echo "Creating directory $MOUNT_POINT..."
# We try to create it. If it fails (e.g. inside read-only flatpak mount namespace), warn user.
$PRIV_CMD mkdir -p "$MOUNT_POINT"
if [ $? -ne 0 ]; then
echo "Error creating directory. If you are in a Flatpak, you might not have access to host /mnt."
exit 1
fi
fi
# 2. Get Credentials
read -p "Enter SMB Username [guest]: " SMB_USER
SMB_USER=${SMB_USER:-guest}
# 3. Mount
echo "Mounting $SHARE to $MOUNT_POINT..."
# IMPORTANT: We force the mount to be owned by the current user (UID 1000 usually)
# This fixes "Permission Denied" errors when writing to the share.
# We also set file_mode/dir_mode to 0777 as a fallback to ensure full access.
MOUNT_OPTS="vers=3.0,uid=$(id -u),gid=$(id -g),file_mode=0777,dir_mode=0777,noperm"
if [ "$SMB_USER" == "guest" ]; then
$PRIV_CMD mount -t cifs "$SHARE" "$MOUNT_POINT" -o "guest,$MOUNT_OPTS"
else
# This will prompt for the SMB password
$PRIV_CMD mount -t cifs "$SHARE" "$MOUNT_POINT" -o "username=$SMB_USER,$MOUNT_OPTS"
fi
# 4. Check result
if [ $? -eq 0 ]; then
echo "✅ Success! Share is now available at $MOUNT_POINT"
echo "Files are now owned by $(id -un):$(id -gn) with full write access."
echo "The mapping will disappear automatically after you reboot."
else
echo "❌ Error: Failed to mount the share."
echo "Ensure 'cifs-utils' is installed and the server is reachable."
fi