You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
773 B

  1. #!/bin/sh
  2. set -e
  3. die() {
  4. echo "$*" >&2
  5. exit 1
  6. }
  7. N="$(basename "$0")"
  8. case "$N" in
  9. sshfs_*)
  10. M=sshfs
  11. N="${N#sshfs_}"
  12. case "$N" in
  13. inmep)
  14. R=amery@inmep.geeks.cl:projects/
  15. ;;
  16. builder)
  17. R=amery@geeks.cl:projects/
  18. ;;
  19. *)
  20. R=$N:
  21. ;;
  22. esac
  23. ;;
  24. flickr)
  25. M="${N}fs"
  26. ;;
  27. *)
  28. die "$0: invalid name"
  29. ;;
  30. esac
  31. D="/media/$USER/$N"
  32. if [ ! -d "$D/" ]; then
  33. sudo mkdir -p "$D"
  34. sudo chown $USER:$USER "$D"
  35. fi
  36. case "$M" in
  37. sshfs)
  38. sshfs_opt="-o reconnect -C"
  39. if grep -q '^user_allow_other$' /etc/fuse.conf 2> /dev/null; then
  40. sshfs_opt="$sshfs_opt -o allow_root"
  41. else
  42. echo "please enable user_allow_other in /etc/fuse.conf and make it readable" >&2
  43. fi
  44. exec "$M" $sshfs_opt "$@" \
  45. "$R" "$D"
  46. ;;
  47. flickrfs)
  48. exec "$M" "$D"
  49. ;;
  50. *)
  51. die "$M: invalid mode"
  52. ;;
  53. esac