nofollow for sshfs
This commit is contained in:
@@ -2,12 +2,13 @@
|
||||
|
||||
|
||||
_helpexit() {
|
||||
printf "Usage: %s [-u] [-nosave] host [path]
|
||||
printf "Usage: %s [-u] [-nosave] [-nofollow] host [path]
|
||||
|
||||
host can be from ssh config
|
||||
path is the remote path. Defaults to remote home.
|
||||
-u will unmount all FUSE.sshfs paths if no path given!
|
||||
-nosave will not use host key checking, nor save it anywhere. potentially dangerous.
|
||||
-nofollow disable symlinks following
|
||||
|
||||
" "$( basename $0 )"
|
||||
echo Current mounts:
|
||||
@@ -38,9 +39,11 @@ for (( i=1; i<=$#; i++ )); do
|
||||
done
|
||||
unmount=false
|
||||
nosave=false
|
||||
nofollow=false
|
||||
for (( i=1; i<=$#; i++ )); do
|
||||
[[ ${!i} = "-u" ]] && { unmount=true; continue; }
|
||||
[[ ${!i} = "-nosave" ]] && { nosave=true; continue; }
|
||||
[[ ${!i} = "-nofollow" ]] && { nofollow=true; continue; }
|
||||
if [[ -z "$host" ]]; then
|
||||
host="${!i}"
|
||||
else
|
||||
@@ -56,6 +59,9 @@ path=:"${localpath}"
|
||||
if [[ "$nosave" = true ]]; then
|
||||
NOSAVE="-o ssh_command='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'"
|
||||
fi
|
||||
if [[ "$nofollow" = false ]]; then
|
||||
FOLLOW="-o follow_symlinks"
|
||||
fi
|
||||
|
||||
if [[ "$unmount" = true ]]; then
|
||||
cd ~/mnt
|
||||
@@ -98,7 +104,8 @@ if [[ $device1 = $device2 ]]; then
|
||||
-o gid=`id -g` \
|
||||
-o ServerAliveInterval=45,ServerAliveCountMax=2 \
|
||||
$NOSAVE \
|
||||
-o follow_symlinks "$valid_name$path" "$valid_name"
|
||||
$FOLLOW \
|
||||
"$valid_name$path" "$valid_name"
|
||||
if [[ $? -gt 0 ]]; then
|
||||
rmdir "$valid_name"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user