3 ### userv service for claiming a directory in a special filesystem
5 if ( glob service claim-dir
6 & glob service-user root
7 & grep calling-user-shell /etc/shells
14 execute sh -c "set -e; quis=$0; \
17 *) echo >&2 \"usage: $quis FILSYS\"; exit 1 ;; \
20 while read fs dir opts; do \
22 \\#* | \"\") continue ;; \
23 \"$filsys\") foundp=t; break ;; \
25 done <@sysconfdir@/claim-dir.tab; \
28 echo >&2 \"$quis: unknown filesystem \\`$filsys'\"; \
32 for opt in $opts; do \
36 verdict=forbid acl=$arg; \
38 case \"$acl\" in ?*) ;; *) break ;; esac; \
40 *,*) word=${acl%%,*} acl=${acl#*,} ;; \
41 *) word=$acl acl=\"\" ;; \
44 -*) sense=forbid word=${word#-} ;; \
45 *) sense=allow word=$word ;; \
48 %*) pat=${word#%} list=\"$USERV_GROUP $USERV_GID\" ;; \
49 *) pat=$word list=\"$USERV_USER $USERV_UID\" ;; \
53 case \"$i\" in $pat) matchp=t; break ;; esac; \
55 case $matchp in t) verdict=$sense; break ;; esac; \
59 echo >&2 \"$quis: permission denied\"; \
65 if ! mountpoint -q \"$dir\"; then $arg \"$dir\"; fi \
68 echo >&2 \"$quis: unknown option \\`$opt'\"; \
73 set _ $USERV_USER; user=$2; \
74 set _ $USERV_GROUP; group=$2; \
76 if [ ! -d \"$user\" ]; then \
77 mkdir -m700 \"$user\"; \
78 chown \"$user:$group\" \"$user\"; \
80 echo \"$dir/$USERV_USER\" \