summaryrefslogtreecommitdiff
path: root/volinit-xchange
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2001-12-12 19:52:40 +0000
committerJonas Smedegaard <dr@jones.dk>2001-12-12 19:52:40 +0000
commitc81b7f986867db292d62a1757123723b5ef66518 (patch)
treea217cf2f481ab7b3099ef76b519a4cc8e1786096 /volinit-xchange
Initial revision
Diffstat (limited to 'volinit-xchange')
-rwxr-xr-xvolinit-xchange63
1 files changed, 63 insertions, 0 deletions
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 <base directory> <read user/group> <write user/group> [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 <base directory> <read user/group> <write user/group> [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 "."