2025-05-11 16:10:27 -05:00
|
|
|
#!/bin/bash
|
2024-05-10 18:29:48 -05:00
|
|
|
|
2025-05-11 16:10:27 -05:00
|
|
|
# Define mount points and devices
|
|
|
|
|
declare -A mounts=(
|
|
|
|
|
["/mnt/public"]="/dev/sdc1"
|
|
|
|
|
["/mnt/public-bk"]="/dev/sde1"
|
|
|
|
|
["/mnt/public2"]="/dev/sdd1"
|
|
|
|
|
["/mnt/public2-bk"]="/dev/sdb1"
|
|
|
|
|
)
|
2024-05-10 18:29:48 -05:00
|
|
|
|
2025-05-11 16:13:38 -05:00
|
|
|
# Ensure mount folders exist
|
2025-05-11 16:10:27 -05:00
|
|
|
for dir in "${!mounts[@]}"; do
|
2025-05-11 16:13:38 -05:00
|
|
|
echo "Creating $dir if needed..."
|
|
|
|
|
mkdir -p "$dir"
|
2025-05-11 16:10:27 -05:00
|
|
|
done
|
2024-05-10 18:29:48 -05:00
|
|
|
|
2025-05-11 16:13:38 -05:00
|
|
|
# Mount each device to its folder
|
2025-05-11 16:10:27 -05:00
|
|
|
for dir in "${!mounts[@]}"; do
|
|
|
|
|
device="${mounts[$dir]}"
|
|
|
|
|
echo "Mounting $device to $dir..."
|
2025-05-11 16:13:38 -05:00
|
|
|
mount "$device" "$dir"
|
2025-05-11 16:10:27 -05:00
|
|
|
done
|
2024-05-10 18:29:48 -05:00
|
|
|
|
2025-05-11 16:13:38 -05:00
|
|
|
# Bind mount for timeshift folders
|
2025-05-11 16:10:27 -05:00
|
|
|
echo "Creating timeshift bind mounts..."
|
2025-05-11 16:13:38 -05:00
|
|
|
mkdir -p /mnt/timeshift /mnt/timeshift1
|
|
|
|
|
mount --bind /mnt/public2 /mnt/timeshift
|
|
|
|
|
mount --bind /mnt/public2-bk /mnt/timeshift1
|
2024-05-10 18:29:48 -05:00
|
|
|
|
2025-05-11 16:13:38 -05:00
|
|
|
# Apply root ownership and full permissions
|
|
|
|
|
echo "Setting root:root ownership and chmod 777..."
|
2025-05-11 16:10:27 -05:00
|
|
|
for path in /mnt/public /mnt/public-bk /mnt/public2 /mnt/public2-bk /mnt/timeshift /mnt/timeshift1; do
|
2025-05-11 16:13:38 -05:00
|
|
|
echo "Processing $path..."
|
|
|
|
|
chown -R root:root "$path"
|
|
|
|
|
chmod -R 777 "$path"
|
2025-05-11 16:10:27 -05:00
|
|
|
done
|
2024-05-15 17:56:46 -05:00
|
|
|
|
2025-05-11 16:13:38 -05:00
|
|
|
echo "All mounts and permissions applied successfully."
|