updates
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
configs/colors.fish
|
configs/colors.fish
|
||||||
fish_variables
|
fish_variables
|
||||||
|
fish_variables*
|
||||||
themes
|
themes
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
# In ~/.config/fish/configs/alias_useful.fish
|
# In ~/.config/fish/configs/alias_useful.fish
|
||||||
#
|
#
|
||||||
|
|
||||||
|
alias mount_all'sudo $HOME/.config/fish/scripts/mount.sh'
|
||||||
|
|
||||||
################ COMMON ALIASES ################################################
|
################ COMMON ALIASES ################################################
|
||||||
|
|
||||||
alias remount='sudo mount -a'
|
alias remount='sudo mount -a'
|
||||||
|
|||||||
+41
-45
@@ -1,50 +1,46 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Source the functions file
|
# Function to mount CIFS share with error handling
|
||||||
source "$HOME/.config/function_helper.sh"
|
mount_cifs() {
|
||||||
|
local source="$1"
|
||||||
# Configuration
|
local mount_point="$2"
|
||||||
SERVER_IP="192.168.1.22"
|
local options="$3"
|
||||||
CRENDENTIALS="$HOME/.cred/.smbcred"
|
|
||||||
MOUNT_POINT_RAID="$HOME/Raid/"
|
# Create mount point if missing
|
||||||
MOUNT_POINT_SSD="$HOME/Server-SSD/"
|
if [ ! -d "$mount_point" ]; then
|
||||||
PASSWORD_FILE="$HOME/.cred/credentials.txt"
|
echo "Creating mount point: $mount_point"
|
||||||
|
sudo mkdir -p "$mount_point || { echo 'Mount point creation failed'; exit 1; }"
|
||||||
# Read the password from the file
|
|
||||||
PASSWORD=$(<"$PASSWORD_FILE")
|
|
||||||
|
|
||||||
# Function to mount all shares
|
|
||||||
function mount_all() {
|
|
||||||
if ping -c 1 -W 2 $SERVER_IP > /dev/null 2>&1; then
|
|
||||||
send_notification "low" "Ping Successful" "$SERVER_IP is Up and Running. Continuing to mount." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/connect_established.svg"
|
|
||||||
# Mount RAID
|
|
||||||
if ! is_mounted "$MOUNT_POINT_RAID"; then
|
|
||||||
if echo "$PASSWORD" | sudo -S mount -t cifs -o credentials="$CRENDENTIALS",uid=1000,gid=1000 //$SERVER_IP/RAID "$MOUNT_POINT_RAID"; then
|
|
||||||
send_notification "low" "Mount Successful" "Mounted RAID at $MOUNT_POINT_RAID successfully." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-encrypted-symbolic.svg"
|
|
||||||
else
|
|
||||||
send_notification "high" "Mount Failed" "Failed to mount RAID at $MOUNT_POINT_RAID." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-symbolic.svg"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
send_notification "low" "Already Mounted" "RAID is already mounted at $MOUNT_POINT_RAID." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk.svg"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Mount SSD
|
|
||||||
if ! is_mounted "$MOUNT_POINT_SSD"; then
|
|
||||||
if echo "$PASSWORD" | sudo -S mount -t cifs -o credentials="$CRENDENTIALS",uid=1000,gid=1000 //$SERVER_IP/Server-SSD "$MOUNT_POINT_SSD"; then
|
|
||||||
send_notification "low" "Mount Successful" "Mounted SSD at $MOUNT_POINT_SSD successfully." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-encrypted-symbolic.svg"
|
|
||||||
else
|
|
||||||
send_notification "high" "Mount Failed" "Failed to mount SSD at $MOUNT_POINT_SSD." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-symbolic.svg"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
send_notification "low" "Already Mounted" "SSD is already mounted at $MOUNT_POINT_SSD." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk.svg"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
send_notification "normal" "Connection Failed" "Could not connect to IP: $SERVER_IP." "$HOME/.icons/BeautyLine-Garuda/actions/scalable/network-disconnect.svg"
|
|
||||||
exit 1
|
|
||||||
fi
|
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"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Call the mount_all function
|
# Mount FRITZ.NAS (from fstab line 1)
|
||||||
mount_all
|
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"
|
||||||
|
|||||||
Reference in New Issue
Block a user