From c81b7f986867db292d62a1757123723b5ef66518 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Wed, 12 Dec 2001 19:52:40 +0000 Subject: Initial revision --- volinit-xchange | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 volinit-xchange (limited to 'volinit-xchange') diff --git a/volinit-xchange b/volinit-xchange new file mode 100755 index 0000000..ea9128c --- /dev/null +++ b/volinit-xchange @@ -0,0 +1,63 @@ +#!/bin/bash + +[ -f /etc/local/volumes ] || exit 1 +. /etc/local/volumes +[ "x$XDIR" = "x" ] && exit 1 + +if [ $# -eq 0 ]; then +# echo "$0: directory name(s) required" + echo "Usage: $0 [create]" + exit 1 + fi + +if [ "x$1" = "x" ]; then + echo "$0: base directory missing" + exit 1 + fi +VOL=$XDIR/$1 + +if [ "x$2" = "x" ]; then + echo "$0: read group missing" + exit 1 + fi +ALL=$2 + +if [ "x$3" = "x" ]; then + echo "$0: write group missing" + exit 1 + fi +GRP=$3 + +#GRPUSER="nobody" +GRPUSER="admin" +#if [ "x$4" != "x" ]; then +# GRPUSER=$4 +#else + id $GRP >/dev/null && GRPUSER=$GRP +#fi + +if [ "x$4" != "x" ]; then + if [ "x$4" == "xcreate" ]; then + mkdir -p $VOL/$ALL/$GRP || exit + else + echo "Usage: $0 [create]" + exit 1 + fi +fi + +test -d $VOL/$ALL/$GRP || exit +test -d $VOL/$ALL/$GRP/.AppleDouble || mkdir $VOL/$ALL/$GRP/.AppleDouble +test -d $VOL/$ALL/$GRP/.AppleDesktop || mkdir $VOL/$ALL/$GRP/.AppleDesktop +#chown $ALLUSER.$ALL $VOL/$ALL +chown root.$ALL $VOL/$ALL +chown $GRPUSER.$ALL $VOL/$ALL/$GRP +chmod u=rwX,g=rXs,o= $VOL/$ALL +chmod u=rwX,g=rXs,o= $VOL/$ALL/$GRP +echo "People in group $GRP has read/write access through AppleShare" +test $GRP = $ALL || echo "People in group $ALL has read access through AppleShare" +echo "Others have no access" +echo -n "Checking permissions..." +chown -R $GRPUSER.$GRP $VOL/$ALL/$GRP \ + && chmod -R u=rwX,g=rwXs,o=rX $VOL/$ALL/$GRP \ + && chmod u=rwX,g=rXs,o=rX $VOL/$ALL/$GRP +echo "." -- cgit v1.2.3