diff options
author | Wolfgang Müller | 2021-05-16 17:47:38 +0200 |
---|---|---|
committer | Wolfgang Müller | 2021-05-16 17:50:29 +0200 |
commit | 6f3ea5c43096dd49a3b9d69566c97e70a31745ab (patch) | |
tree | 638ece03c8e14527f757c5127c05e7edbba6a4cd /git-init-shared | |
download | git-helpers-6f3ea5c43096dd49a3b9d69566c97e70a31745ab.tar.gz |
Initial import
Diffstat (limited to 'git-init-shared')
-rwxr-xr-x | git-init-shared | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/git-init-shared b/git-init-shared new file mode 100755 index 0000000..ea18234 --- /dev/null +++ b/git-init-shared @@ -0,0 +1,25 @@ +#!/bin/sh + +set -e + +usage() { + printf "usage: git init-shared directory [user...]\n" >&2 + exit 1 +} + +add_to_acl() { + setfacl -m "d:u:$2:rwx" "$1" + setfacl -m "u:$2:rwx" "$1" +} + +test $# -ge 1 || usage +dir=$1 +shift + +mkdir "$dir" + +for user in "$(id -un)" "$@"; do + add_to_acl "$dir" "$user" +done + +exec git init --bare "$dir" |