mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
updates and reset-perm scripts
This commit is contained in:
1 parent
be6b08ceab
commit
3f4030fd96
22 files changed
+19
-1091
No files matched your search
+19
-30
@@ -1,38 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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"
|
||||
mounts=(
|
||||
"/mnt/backup-10t"
|
||||
"/mnt/backup-8t"
|
||||
"/mnt/hermes"
|
||||
"/mnt/primary-10t"
|
||||
"/mnt/primary-8t"
|
||||
)
|
||||
|
||||
# Ensure mount folders exist
|
||||
for dir in "${!mounts[@]}"; do
|
||||
echo "Creating $dir if needed..."
|
||||
mkdir -p "$dir"
|
||||
for dir in "${mounts[@]}"; do
|
||||
if ! mountpoint -q "$dir"; then
|
||||
echo "Error: $dir is not mounted. Mount it before running this script." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Mount each device to its folder
|
||||
for dir in "${!mounts[@]}"; do
|
||||
device="${mounts[$dir]}"
|
||||
echo "Mounting $device to $dir..."
|
||||
mount "$device" "$dir"
|
||||
echo "Setting chmod 777 on all mount contents..."
|
||||
for dir in "${mounts[@]}"; do
|
||||
echo "Processing $dir..."
|
||||
if ! chmod -R 777 "$dir"; then
|
||||
echo "Error: failed to set permissions on $dir." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Bind mount for timeshift folders
|
||||
echo "Creating timeshift bind mounts..."
|
||||
mkdir -p /mnt/timeshift /mnt/timeshift1
|
||||
mount --bind /mnt/public2 /mnt/timeshift
|
||||
mount --bind /mnt/public2-bk /mnt/timeshift1
|
||||
|
||||
# Apply root ownership and full permissions
|
||||
echo "Setting root:root ownership and chmod 777..."
|
||||
for path in /mnt/public /mnt/public-bk /mnt/public2 /mnt/public2-bk /mnt/timeshift /mnt/timeshift1; do
|
||||
echo "Processing $path..."
|
||||
chown -R root:root "$path"
|
||||
chmod -R 777 "$path"
|
||||
done
|
||||
|
||||
echo "All mounts and permissions applied successfully."
|
||||
echo "All permissions applied successfully."
|
||||
Reference in new issue
Block a user