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

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