summaryrefslogtreecommitdiff
path: root/volinit-xchange
blob: ea9128ca2ddaa7a22b1bafb83773901759b49006 (plain)
  1. #!/bin/bash
  2. [ -f /etc/local/volumes ] || exit 1
  3. . /etc/local/volumes
  4. [ "x$XDIR" = "x" ] && exit 1
  5. if [ $# -eq 0 ]; then
  6. # echo "$0: directory name(s) required"
  7. echo "Usage: $0 <base directory> <read user/group> <write user/group> [create]"
  8. exit 1
  9. fi
  10. if [ "x$1" = "x" ]; then
  11. echo "$0: base directory missing"
  12. exit 1
  13. fi
  14. VOL=$XDIR/$1
  15. if [ "x$2" = "x" ]; then
  16. echo "$0: read group missing"
  17. exit 1
  18. fi
  19. ALL=$2
  20. if [ "x$3" = "x" ]; then
  21. echo "$0: write group missing"
  22. exit 1
  23. fi
  24. GRP=$3
  25. #GRPUSER="nobody"
  26. GRPUSER="admin"
  27. #if [ "x$4" != "x" ]; then
  28. # GRPUSER=$4
  29. #else
  30. id $GRP >/dev/null && GRPUSER=$GRP
  31. #fi
  32. if [ "x$4" != "x" ]; then
  33. if [ "x$4" == "xcreate" ]; then
  34. mkdir -p $VOL/$ALL/$GRP || exit
  35. else
  36. echo "Usage: $0 <base directory> <read user/group> <write user/group> [create]"
  37. exit 1
  38. fi
  39. fi
  40. test -d $VOL/$ALL/$GRP || exit
  41. test -d $VOL/$ALL/$GRP/.AppleDouble || mkdir $VOL/$ALL/$GRP/.AppleDouble
  42. test -d $VOL/$ALL/$GRP/.AppleDesktop || mkdir $VOL/$ALL/$GRP/.AppleDesktop
  43. #chown $ALLUSER.$ALL $VOL/$ALL
  44. chown root.$ALL $VOL/$ALL
  45. chown $GRPUSER.$ALL $VOL/$ALL/$GRP
  46. chmod u=rwX,g=rXs,o= $VOL/$ALL
  47. chmod u=rwX,g=rXs,o= $VOL/$ALL/$GRP
  48. echo "People in group $GRP has read/write access through AppleShare"
  49. test $GRP = $ALL || echo "People in group $ALL has read access through AppleShare"
  50. echo "Others have no access"
  51. echo -n "Checking permissions..."
  52. chown -R $GRPUSER.$GRP $VOL/$ALL/$GRP \
  53. && chmod -R u=rwX,g=rwXs,o=rX $VOL/$ALL/$GRP \
  54. && chmod u=rwX,g=rXs,o=rX $VOL/$ALL/$GRP
  55. echo "."