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