wok-6.x annotate sshfs-fuse/stuff/rsshfs @ rev 16759

sshfs-fuse/rsshfs: lazy umount support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jun 16 23:51:49 2014 +0200 (2014-06-16)
parents c176489f467b
children fc1b98958191
rev   line source
pascal@16756 1 #!/bin/sh
pascal@16759 2 # from https://github.com/rom1v/rsshfs
pascal@16756 3
pascal@16758 4 rhost="${2%%:*}"
pascal@16756 5 rpath="${2#*:}"
pascal@16756 6 lpath="$1"
pascal@16759 7 shift 2
pascal@16756 8
pascal@16759 9 case "$lpath" in
pascal@16759 10 -u) ssh "$rhost" fusermount -u $@ "$rpath"
pascal@16756 11 ;;
pascal@16756 12
pascal@16756 13 ''|-*) cat <<EOT
pascal@16756 14 usage:
pascal@16756 15 $0 localpath remotehost:remotepath [-o ro -o allow_other]
pascal@16759 16 $0 -u remotehost:remotepath [-z]
pascal@16756 17 EOT
pascal@16756 18 ;;
pascal@16756 19
pascal@16759 20 *) fifo=/tmp/rsshfs-$$
pascal@16756 21 mkfifo $fifo
pascal@16759 22 sftp-server < $fifo | \
pascal@16756 23 ssh "$rhost" sshfs -o slave ":$lpath" "$rpath" "$@" > $fifo
pascal@16756 24 rm -f $fifo
pascal@16756 25 esac