47 lines
2.0 KiB
Bash
Executable File
47 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Function to mount CIFS share with error handling
|
|
mount_cifs() {
|
|
local source="$1"
|
|
local mount_point="$2"
|
|
local options="$3"
|
|
|
|
# Create mount point if missing
|
|
if [ ! -d "$mount_point" ]; then
|
|
echo "Creating mount point: $mount_point"
|
|
sudo mkdir -p "$mount_point || { echo 'Mount point creation failed'; exit 1; }"
|
|
fi
|
|
|
|
echo "Mounting $source to $mount_point with options: $options"
|
|
sudo mount -t cifs -o "$options" "$source" "$mount_point" || {
|
|
echo "Mount failed for $source. Check credentials and network."
|
|
exit 1
|
|
}
|
|
echo "Successfully mounted: $mount_point"
|
|
}
|
|
|
|
# Mount FRITZ.NAS (from fstab line 1)
|
|
mount_cifs "//192.168.1.1/FRITZ.NAS" \
|
|
"/home/honney/mount/fritzNAS" \
|
|
"credentials=/home/honney/.cred/samba_credentials,uid=1000,gid=1000,vers=3.0,cache=none,nounix,noserverino,file_mode=0755,dir_mode=0755"
|
|
|
|
# Mount Data (from fstab line 2)
|
|
mount_cifs "//100.64.0.3/Data" \
|
|
"/home/honney/mount/Data" \
|
|
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
|
|
|
# Mount Media (from fstab line 3)
|
|
mount_cifs "//100.64.0.3/Media" \
|
|
"/home/honney/mount/Media" \
|
|
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
|
|
|
# Mount Ripping (from fstab line 4)
|
|
mount_cifs "//100.64.0.3/Ripping" \
|
|
"/home/honney/mount/Ripping" \
|
|
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
|
|
|
# Mount Apps (from fstab line 5)
|
|
mount_cifs "//100.64.0.3/Apps" \
|
|
"/home/honney/mount/Apps" \
|
|
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|