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

sshfs-fuse/rsshfs: do not trust remote read-only option
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jun 17 10:26:10 2014 +0200 (2014-06-17)
parents b55261bbc2a9
children f378d6411e2c
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@16762 22 case " $@ " in
pascal@16762 23 *\ -o\ ro\ *) sftp-server -R ;;
pascal@16762 24 *) sftp-server ;;
pascal@16762 25 esac <$fifo | ssh "$rhost" sshfs -o slave ":$lpath" "$rpath" "$@" >$fifo
pascal@16756 26 rm -f $fifo
pascal@16756 27 esac