sshfs experiment
This commit is contained in:
@@ -42,11 +42,9 @@ function mount_sshfs {
|
|||||||
FUNCTION_PRELUDE
|
FUNCTION_PRELUDE
|
||||||
|
|
||||||
: "${1:?destination name?}"
|
: "${1:?destination name?}"
|
||||||
: "${2:?remote mount path?}"
|
|
||||||
|
|
||||||
local DESTINATION="$1"
|
local DESTINATION="$1"
|
||||||
local LOCAL_MOUNT_PATH="/Users/$USER/mount/$1"
|
local LOCAL_MOUNT_PATH="/Users/$USER/mount/$1"
|
||||||
local REMOTE_MOUNT_PATH="$2"
|
|
||||||
|
|
||||||
mkdir -p "$LOCAL_MOUNT_PATH"
|
mkdir -p "$LOCAL_MOUNT_PATH"
|
||||||
|
|
||||||
@@ -67,16 +65,25 @@ function mount_sshfs {
|
|||||||
-o workaround=rename \
|
-o workaround=rename \
|
||||||
"$DESTINATION:$REMOTE_MOUNT_PATH" "$LOCAL_MOUNT_PATH"
|
"$DESTINATION:$REMOTE_MOUNT_PATH" "$LOCAL_MOUNT_PATH"
|
||||||
|
|
||||||
local LOCAL_COMMAND_PIPE_PATH="$LOCAL_MOUNT_PATH/projects/subl_remote/fifo"
|
# if [[ ! -e "$LOCAL_COMMAND_PIPE_PATH" ]]; then
|
||||||
local REMOTE_COMMAND_PIPE_PATH="$REMOTE_MOUNT_PATH/projects/subl_remote/fifo"
|
# echo "Can't find the command pipe"
|
||||||
|
# return
|
||||||
if [[ ! -e "$LOCAL_COMMAND_PIPE_PATH" ]]; then
|
# fi
|
||||||
echo "Can't find the command pipe"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Starting remote command pipe..."
|
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 {
|
function sublr {
|
||||||
@@ -85,7 +92,7 @@ function sublr {
|
|||||||
local HOSTNAME=$(hostname)
|
local HOSTNAME=$(hostname)
|
||||||
local FULL_PATH=$(realpath $1)
|
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 {
|
function cdtmp {
|
||||||
|
Reference in New Issue
Block a user