sshfs experiment

This commit is contained in:
2018-10-28 01:40:50 +04:00
parent 528a0df7bb
commit f3c8c75edd

View File

@@ -42,11 +42,9 @@ function mount_sshfs {
FUNCTION_PRELUDE
: "${1:?destination name?}"
: "${2:?remote mount path?}"
local DESTINATION="$1"
local LOCAL_MOUNT_PATH="/Users/$USER/mount/$1"
local REMOTE_MOUNT_PATH="$2"
mkdir -p "$LOCAL_MOUNT_PATH"
@@ -67,16 +65,25 @@ function mount_sshfs {
-o workaround=rename \
"$DESTINATION:$REMOTE_MOUNT_PATH" "$LOCAL_MOUNT_PATH"
local LOCAL_COMMAND_PIPE_PATH="$LOCAL_MOUNT_PATH/projects/subl_remote/fifo"
local REMOTE_COMMAND_PIPE_PATH="$REMOTE_MOUNT_PATH/projects/subl_remote/fifo"
if [[ ! -e "$LOCAL_COMMAND_PIPE_PATH" ]]; then
echo "Can't find the command pipe"
return
fi
# if [[ ! -e "$LOCAL_COMMAND_PIPE_PATH" ]]; then
# echo "Can't find the command pipe"
# return
# fi
echo "Starting remote command pipe..."
ssh $1 -- tail -f "$REMOTE_COMMAND_PIPE_PATH" | zsh -x
ssh $DESTINATION \
<< EOF
set -euxo pipefail
if [[ -e /tmp/sshfs_command_pipe ]]; then
rm /tmp/sshfs_command_pipe
fi
mkfifo /tmp/sshfs_command_pipe
tail -f /tmp/sshfs_command_pipe | zsh -lx
EOF
}
function sublr {
@@ -85,7 +92,7 @@ function sublr {
local HOSTNAME=$(hostname)
local FULL_PATH=$(realpath $1)
echo "subl /Users/abra/mount/$HOSTNAME/$FULL_PATH" > /projects/subl_remote/fifo
echo "subl /Users/abra/mount/$HOSTNAME/$FULL_PATH" > /tmp/sshfs_command_pipe
}
function cdtmp {