chiark / gitweb /
claim-dir: New `mode' option for non-private pieces of filesystem.
authorMark Wooding <mwooding@good.com>
Thu, 1 Nov 2012 12:02:24 +0000 (12:02 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 3 Nov 2012 01:25:24 +0000 (01:25 +0000)
It turns out that `claim-dir' is also useful for allocating pieces of
filesystem for things like public Git repositories, but restrictive
initial permissions make this annoying.

claim-dir.tab
userv/claim-dir.in

index f5ba7741b6ecfe09232d3afff6070680387abeda..31aad757b9726d811b2236ac204d3e0eb72825ea 100644 (file)
@@ -16,6 +16,9 @@
 ###    no entry matches, access is forbidden.  Without this option, access
 ###    is open to all.
 ###
+### mode=MODE
+###    Permissions for the new directory.  The default is 700.
+###
 ### mount=SCRIPT
 ###    If DIR is not a mount point already, run SCRIPT DIR.
 
index d5f14db3e50114efe8b3ccc4ad70206d593418cb..ef8349e456026b0a78afb5ee438228648f8f24ec 100644 (file)
@@ -18,7 +18,7 @@ if ( glob service claim-dir
          1) filsys=$1 ;;                                               \
          *) echo >&2 \"usage: $quis FILSYS\"; exit 1 ;;                \
        esac;                                                           \
-       foundp=nil;                                                     \
+       foundp=nil; mode=700;                                           \
        while read fs dir opts; do                                      \
          case \"$fs\" in                                               \
            \\#* | \"\") continue ;;                                    \
@@ -63,6 +63,9 @@ if ( glob service claim-dir
                  ;;                                                    \
              esac                                                      \
              ;;                                                        \
+           mode=*)                                                     \
+             mode=$arg                                                 \
+             ;;                                                        \
            mount=*)                                                    \
              if ! mountpoint -q \"$dir\"; then $arg \"$dir\"; fi       \
              ;;                                                        \
@@ -76,7 +79,7 @@ if ( glob service claim-dir
        set _ $USERV_GROUP; group=$2;                                   \
        cd \"$dir\";                                                    \
        if [ ! -d \"$user\" ]; then                                     \
-         mkdir -m700 \"$user\";                                        \
+         mkdir -m$mode \"$user\";                                      \
          chown \"$user:$group\" \"$user\";                             \
        fi;                                                             \
        echo \"$dir/$USERV_USER\"                                       \