add mount_nas

This commit is contained in:
6543 2017-04-19 23:39:13 +02:00
commit 5c2661c7c6
4 changed files with 62 additions and 0 deletions

BIN
mount_nas/nas_mnt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

42
mount_nas/nas_mnt.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
echo "--- mount NAS Shares ---"

#values
user="mussterman"
user_uid="`id -u $user`"
user_gid="`id -g $user`"
nas_ip="10.0.6.50"
nas_domain="local"
mnt_root="/home/$user/.mnt/NAS/"

echo "USER: $user"
echo "IP: $nas_ip"
echo -n "Tpye in Sudo Passwort: "; read -s passwd_sys; echo
echo -n "Tpye in NAS Passwort: "; read -s passwd_nas; echo

echo; echo;

[ -n "`mount | grep /home/$user/.mnt/NAS/`" ] && {
#already mountetd
echo try remount
echo "$passwd_sys" | sudo -p "Unmount All: " -kS umount /home/$user/.mnt/NAS/* || {
echo ERROR
sleep 3
exit 1
}
echo OK
}
#echo -n "HOME: "
echo "$passwd_sys" | sudo -p "HOME: " -kS mount -t cifs -o username="$user",password="$passwd_nas",domain=$nas_domain,uid="$user_uid",gid="$user_gid" "//$nas_ip/$user" "$mnt_root/HOME/" && echo OK

for i in eBooks Filme Photos Programme Sound Vorlagen 'TV Aufnahmen'; do

echo "$passwd_sys" | sudo -p "$i: " -kS mount -t cifs -o username="$user",password="$passwd_nas",domain=$nas_domain,uid="$user_uid",gid="$user_gid" "//$nas_ip/$i" "$mnt_root$i/" && echo OK

done

#echo -n 'nas_mnt: '
#echo "$passwd_sys" | sshfs "$user"@"$nas_ip":/mnt/ /data/nas_mnt/ -o password_stdin,allow_other && echo OK


sleep 3

BIN
mount_nas/nas_umnt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

20
mount_nas/nas_umnt.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
echo "--- Un-Mount NAS Shares ---"

#values
user="mussterman"
mnt_root="/home/$user/.mnt/NAS/"


echo -n "Tpye in Passwort: "; read -s passwd; echo

echo; echo;

[ -z "`mount | grep /home/$user/.mnt/NAS/`" ] && {
echo Not Mounted Jet
exit 0
}

echo "$passwd" | sudo -p "Unmount All: " -kS umount /home/$user/.mnt/NAS/* && echo OK

sleep 3