-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmountSsh.sh
More file actions
executable file
·55 lines (43 loc) · 1.48 KB
/
Copy pathmountSsh.sh
File metadata and controls
executable file
·55 lines (43 loc) · 1.48 KB
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
55
#!/bin/bash
defaultPath="";
defaultMount="";
defaultPort="";
if [ -z "${1}" ]; then
defaultPath="tfeiler@wsgtest.its.carleton.edu:/var/www/tfeiler/reason-core/"
else
defaultPath="${1}"
fi
if [ -z "${2}" ]; then
# defaultMount="/Users/tfeiler/remotes/wsgTfeilerReasonHtml"
defaultMount="wsgTfeilerReasonCore"
else
defaultMount="${2}"
fi
if [ -z "${3}" ]; then
defaultPort="22"
else
defaultPort="${3}"
fi
read -p "Enter scp path to mount (${defaultPath}): " remotePath
read -p "Enter local mount point/volume name (${defaultMount}): " localMountPoint
read -p "Enter port (${defaultPort}): " remotePort
if [ -z "${remotePath}" ]; then
remotePath="${defaultPath}"
fi
if [ -z "${localMountPoint}" ]; then
localMountPoint="${defaultMount}"
fi
volName="${localMountPoint}"
localMountPoint=/Users/tfeiler/remotes/"${localMountPoint}"
if [ -z "${remotePort}" ]; then
remotePort="${defaultPort}"
fi
if [ ! -d "$localMountPoint" ]; then
echo "Creating $localMountPoint..."
mkdir "$localMountPoint"
fi
# thoughts - be sure to use transform_symlinks so that you can follow those.
# should I be seeing if there's a samba mount or something instead of doing all this?
# echo "got remote path [${remotePath}], port [${remotePort}], local dir [${localMountPoint}], volname [${volName}]"
sshfs -p ${remotePort} "${remotePath}" "${localMountPoint}" -oauto_cache,transform_symlinks,reconnect,defer_permissions,negative_vncache,volname="{$volName}"
echo "to unmount later, run 'umount ${localMountPoint}'"