[X2Go-Commits] [maintenancescripts] 01/03: git/misc: add original setup-repository and update-repository-posixacls scripts
git-admin at x2go.org
git-admin at x2go.org
Mon Mar 9 00:16:27 CET 2015
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository maintenancescripts.
commit f66cc657466df2a311b2257b3d5d2c9d19215acc
Author: Mihai Moldovan <ionic at ionic.de>
Date: Sun Mar 8 23:52:19 2015 +0100
git/misc: add original setup-repository and update-repository-posixacls scripts
---
git/misc/setup-repository | 95 ++++++++++++++++++++++++++++++++++
git/misc/update-repository-posixacls | 58 +++++++++++++++++++++
2 files changed, 153 insertions(+)
diff --git a/git/misc/setup-repository b/git/misc/setup-repository
new file mode 100755
index 0000000..a1cc74c
--- /dev/null
+++ b/git/misc/setup-repository
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+# This script is used to setup a git repository.
+
+set -e
+
+USAGE="\n\
+This script is used to perform the operations needed to create a git\n\
+repository for X2go upstream.\n\
+\n\
+Usage: setup-repository <package> '<description>'\n\
+\n\
+Options:
+ <package> is the package name a git repository is being created for.\n\
+ <description> is a description for the git repository.\n\
+ It should be something like 'Packaging for <package>'.\n"
+
+if [ "$#" -ne "2" ]; then
+ echo -e "${USAGE}"
+ exit 1
+fi
+
+PACKAGE="$1"
+DESCRIPTION="$2"
+
+# Create the repository
+mkdir $PACKAGE.git
+cd $PACKAGE.git
+/usr/bin/git --bare init --shared
+git config --add core.logallrefupdates true
+
+# Add the repository description
+echo "$DESCRIPTION" >description
+
+# Enable the hook scripts
+[ -f hooks/post-receive ] || {
+ cp -L /srv/git/_hooks_/post-receive._code.x2go.org_ hooks/post-receive.tmp
+ chmod 0660 hooks/post-receive.tmp
+}
+
+[ -f hooks/update ] || {
+ cp -L /srv/git/_hooks_/update._code.x2go.org_ hooks/update.tmp
+ chmod 0660 hooks/update.tmp
+}
+
+# set up ACLs
+[ -f info/allowed-users ] || cat > info/allowed-users.tmp <<-EOF;
+# master branch
++refs/heads/master x2go
++refs/heads/master x2go-admin
++refs/heads/master hmg
++refs/heads/master ncryer
++refs/heads/master mike
+
+# release branch
++refs/heads/release x2go-admin
++refs/heads/release mike
++refs/heads/release hmg
++refs/heads/release ncryer
+
+# pristine-tar branch
++refs/heads/pristine-tar x2go-admin
++refs/heads/pristine-tar mike
++refs/heads/pristine-tar hmg
++refs/heads/pristine-tar ncryer
+EOF
+
+chmod 0660 info/allowed-users.tmp
+
+[ -f info/allowed-groups ] || cat > info/allowed-groups.tmp <<-EOF
+# no group ACLs defined
+EOF
+chmod 0660 info/allowed-groups.tmp
+
+# tweak the Git configuration
+git config --add hooks.mailinglist "x2go-commits at lists.x2go.org"
+git config --add hooks.replyto "x2go-dev at lists.x2go.org"
+git config --add hooks.announcelist "x2go-tags at lists.x2go.org"
+git config --add hooks.envelopesender "git-admin at x2go.org"
+git config --add hooks.emailprefix ""
+git config --add hooks.showdiff "true"
+
+git config --add hooks.denycreatebranch false
+
+
+mv config config.tmp
+chmod 0660 config.tmp
+mv description description.tmp
+chmod 0660 description.tmp
+mv info/exclude info/exclude.tmp
+chmod 0660 info/exclude.tmp
+
+# Go back to the parent directory
+cd ..
+
diff --git a/git/misc/update-repository-posixacls b/git/misc/update-repository-posixacls
new file mode 100755
index 0000000..ae3c663
--- /dev/null
+++ b/git/misc/update-repository-posixacls
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# This script is used to move ownership of certain repos files after setup
+# from x2go user to x2go-admin user
+
+set -e
+
+PACKAGE="$1"
+
+cd "$PACKAGE.git"
+
+# hooks
+[ -f hooks/post-receive.tmp ] && {
+ cp hooks/post-receive.tmp hooks/post-receive
+ chmod 0755 hooks/post-receive
+ rm hooks/post-receive.tmp
+}
+
+[ -f hooks/update.tmp ] && {
+ cp hooks/update.tmp hooks/update
+ chmod 0755 hooks/update
+ rm hooks/update.tmp
+}
+
+# ACLs
+[ -f info/allowed-users.tmp ] && {
+ cp info/allowed-users.tmp info/allowed-users
+ chmod 0640 info/allowed-users
+ rm info/allowed-users.tmp
+}
+
+[ -f info/allowed-groups.tmp ] && {
+ cp info/allowed-groups.tmp info/allowed-groups
+ chmod 0640 info/allowed-groups
+ rm info/allowed-groups.tmp
+}
+
+# configuration
+[ -f config.tmp ] && {
+ cp config.tmp config
+ chmod 0644 config
+ rm config.tmp
+}
+
+[ -f description.tmp ] && {
+ cp description.tmp description
+ chmod 0644 description
+ rm description.tmp
+}
+
+[ -f info/exclude.tmp ] && {
+ cp info/exclude.tmp info/exclude
+ chmod 0644 info/exclude
+ rm info/exclude.tmp
+}
+# Go back to the parent directory
+cd ..
+
--
Alioth's /srv/git/code.x2go.org/maintenancescripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
More information about the x2go-commits
mailing list