From 1d1f94503443fd961aa36703b7a91ed70c47d4cd Mon Sep 17 00:00:00 2001 Message-Id: <1d1f94503443fd961aa36703b7a91ed70c47d4cd.1715545868.git.mdw@distorted.org.uk> From: Mark Wooding Date: Thu, 1 Nov 2012 12:02:24 +0000 Subject: [PATCH] claim-dir: New `mode' option for non-private pieces of filesystem. Organization: Straylight/Edgeware From: Mark Wooding 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 | 3 +++ userv/claim-dir.in | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/claim-dir.tab b/claim-dir.tab index f5ba774..31aad75 100644 --- a/claim-dir.tab +++ b/claim-dir.tab @@ -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. diff --git a/userv/claim-dir.in b/userv/claim-dir.in index d5f14db..ef8349e 100644 --- a/userv/claim-dir.in +++ b/userv/claim-dir.in @@ -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\" \ -- [mdw]