update mount_sshfs

This commit is contained in:
2018-10-28 01:24:50 +04:00
parent 3c2bc4131a
commit ed8b59ca6f

View File

@@ -41,17 +41,17 @@ function is_local {
function mount_sshfs {
FUNCTION_PRELUDE
if [[ ( -z $1 ) || ( -z $2 ) ]]; then
echo ':('
return 1
fi
: "${1:?destination name?}"
: "${2:?remote mount path?}"
local MOUNT_PATH="/Users/$USER/mount/$1"
local DESTINATION="$1"
local LOCAL_MOUNT_PATH="/Users/$USER/mount/$1"
local REMOTE_MOUNT_PATH="$2"
mkdir -p "$MOUNT_PATH"
mkdir -p "$LOCAL_MOUNT_PATH"
if mount | grep "$MOUNT_PATH"; then
umount "$MOUNT_PATH";
if mount | grep "$LOCAL_MOUNT_PATH"; then
umount "$LOCAL_MOUNT_PATH";
fi
sshfs \
@@ -65,10 +65,10 @@ function mount_sshfs {
-o Compression=yes \
-o reconnect \
-o workaround=rename \
"$1:$2" "$MOUNT_PATH"
"$DESTINATION:$REMOTE_MOUNT_PATH" "$LOCAL_MOUNT_PATH"
local REMOTE_COMMAND_PIPE_PATH="/projects/subl_remote/fifo"
local LOCAL_COMMAND_PIPE_PATH="/Users/$USER/mount/$1/$REMOTE_COMMAND_PIPE_PATH"
local REMOTE_COMMAND_PIPE_PATH="$REMOTE_MOUNT_PATH/projects/subl_remote/fifo"
local LOCAL_COMMAND_PIPE_PATH="$LOCAL_MOUNT_PATH/$REMOTE_COMMAND_PIPE_PATH"
if [[ ! -e "$LOCAL_COMMAND_PIPE_PATH" ]]; then
echo "Can't find the command pipe"