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 f5ba774..31aad75 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 d5f14db..ef8349e 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\"                                       \