-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmount.command
executable file
·54 lines (40 loc) · 1.58 KB
/
mount.command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Config ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
USERNAME=theusername # for example : root
PASSWORD=thepass # for example: somethingmorecomplexplease
HOST=thehost # your host, eg: ansolas.de
REMOTEDIR=/ # remote dir, /srv/users/daslicht/apps/homepage/public
VOLUMENAME=thevolumename # this sets the name the mounted folder
# –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
MOUNTROOT=~/volumes/
MOUNT=$MOUNTROOT/$VOLUMENAME
# Check if Mount Folder exists, if not create it
# when done call Mount()
CheckIfMountFolderExists() {
if [ -d "$MOUNT" ]; then
echo "exists, call mount"
Mount
else
echo "not exists"
mkdir $MOUNT
fi
}
# Check if Mount Root Folder exists, if not create and hide it
CheckIfMountROOTFolderExists() {
if [ -d "$MOUNTROOT" ]; then
echo "exists, call CheckIfMountFolderExists"
CheckIfMountFolderExists
else
echo "not exists"
mkdir $MOUNTROOT
chflags hidden $MOUNTROOT # Hide folder
CheckIfMountFolderExists
fi
}
CheckIfMountROOTFolderExists
# Execute the SSHFS Mount command
Mount() {
echo $PASSWORD | sshfs -o password_stdin -o volname=$VOLUMENAME -o local $USERNAME@$HOST:$REMOTEDIR $MOUNT
}
# guess what :)
echo "done"