Skip to content

Commit

Permalink
Add port option
Browse files Browse the repository at this point in the history
  • Loading branch information
nrsyed committed Dec 18, 2020
1 parent b9d1551 commit 429731c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tools/mount_remote.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

usage() {
printf ""
}

is_available() {
REMOTE="$1"
ping -c 1 -t 100 -q $REMOTE > /dev/null 2>&1
Expand Down Expand Up @@ -35,7 +39,12 @@ mount_remote() {
fi
echo "$msg"

sshfs -o follow_symlinks,idmap=user $REMOTE:"$REMOTE_DIR" "$MOUNT_POINT"
opts="follow_symlinks,idmap=user"
if [ -n "$PORT" ]; then
opts="$opts,port=$PORT"
fi

sshfs -o "$opts" $REMOTE:"$REMOTE_DIR" "$MOUNT_POINT"
else
echo "$REMOTE cannot be reached"
fi
Expand Down Expand Up @@ -72,6 +81,10 @@ while (( "$#" )); do
MOUNT_DIR="$2"
shift 2
;;
-p|--port)
PORT="$2"
shift 2
;;
-r|--remote-dir)
REMOTE_DIR="$2"
shift 2
Expand Down

0 comments on commit 429731c

Please sign in to comment.