home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / sbin / mount.fuse < prev    next >
Encoding:
Text File  |  2007-03-12  |  1.1 KB  |  53 lines

  1. #!/bin/sh
  2. #
  3. # FUSE mount helper
  4. # Petr Klima <qaxi@seznam.cz>
  5. # Thanks to Miklos Szeredi <miklos@szeredi.hu>
  6. # to kick me to the right way
  7. #
  8.  
  9. VERSION="0.0.1"
  10. PRGNAME=`basename $0`
  11.  
  12. if [ -z "$HOME" ]; then
  13.     HOME=/root
  14. fi
  15. export HOME
  16.  
  17. USAGE="${PRGNAME} version ${VERSION}
  18. usage: ${PRGNAME} fusefs_type#[mountpath] mountpoint [FUSE options]
  19.  
  20.     example: ${PRGNAME} sshfs#root@tux:/ /mnt/tuxssh -o rw
  21. "
  22.  
  23. die() {
  24.     echo -e "$PRGNAME# $1" >&2
  25.     [ -z "$2" ] && exit 128
  26.     exit "$2"
  27. }
  28.  
  29. [ "$#" -ge 2 ] || die "${USAGE}"
  30.  
  31. # for now i have to be same as FUSE mount binary
  32. # should be configurable
  33. eval `echo "$1" | sed -n 's,\(^[^#][^#]*\)\(#\(.*\)\)*,FSTYPE="\1" MOUNTPATH="\3",p'`
  34.  
  35. export PATH
  36. FSBIN=`which ${FSTYPE} 2>/dev/null` \
  37.     || die "Can not find FUSE mount binary for FS ${FSTYPE}" 1
  38.  
  39. # was there an # in $1
  40. [ "$1" = "$MOUNTPATH" ] && MOUNTPATH=""
  41.  
  42. MOUNTPOINT="$2"
  43. [ -d "${MOUNTPOINT}" ] || die "Directory ${MOUNTPOINT} does not exist"
  44.  
  45. shift
  46. shift
  47.  
  48. ignore_opts='\(user\|nouser\|users\|auto\|noauto\|_netdev\)'
  49.  
  50. OPTIONS=`echo $@ | sed "s/,${ignore_opts}\|${ignore_opts},//g"`
  51.  
  52. ${FSTYPE} ${MOUNTPATH} ${MOUNTPOINT} ${OPTIONS}
  53.