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