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
8 | glob calling-user-shell /dev/token-shells/userv
16 execute sh -c "set -e; quis=$0; \
19 *) echo >&2 \"usage: $quis FILSYS\"; exit 1 ;; \
22 while read fs dir opts; do \
24 \\#* | \"\") continue ;; \
25 \"$filsys\") foundp=t; break ;; \
27 done <@sysconfdir@/claim-dir.tab; \
30 echo >&2 \"$quis: unknown filesystem \\`$filsys'\"; \
34 for opt in $opts; do \
38 verdict=forbid acl=$arg; \
40 case \"$acl\" in ?*) ;; *) break ;; esac; \
42 *,*) word=${acl%%,*} acl=${acl#*,} ;; \
43 *) word=$acl acl=\"\" ;; \
46 -*) sense=forbid word=${word#-} ;; \
47 *) sense=allow word=$word ;; \
50 %*) pat=${word#%} list=\"$USERV_GROUP $USERV_GID\" ;; \
51 *) pat=$word list=\"$USERV_USER $USERV_UID\" ;; \
55 case \"$i\" in $pat) matchp=t; break ;; esac; \
57 case $matchp in t) verdict=$sense; break ;; esac; \
61 echo >&2 \"$quis: permission denied\"; \
67 if ! mountpoint -q \"$dir\"; then $arg \"$dir\"; fi \
70 echo >&2 \"$quis: unknown option \\`$opt'\"; \
75 set _ $USERV_USER; user=$2; \
76 set _ $USERV_GROUP; group=$2; \
78 if [ ! -d \"$user\" ]; then \
79 mkdir -m700 \"$user\"; \
80 chown \"$user:$group\" \"$user\"; \
82 echo \"$dir/$USERV_USER\" \