[sysadmin-bin: 58/168] Make create-repository and update-cgit self-sudo'ing.



commit 927813a8b3ff609172d296cc50e6d83d74bc6d78
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Mar 19 18:59:38 2009 -0400

    Make create-repository and update-cgit self-sudo'ing.
    
    If create-repository or update-cgit are run not as gitadmin, sudo
    to gitadmin and re-run the script. This makes
    'ssh git.gnome.org create-repository' work for sysadmin users not
    in gitadmin.

 create-repository |    4 ++++
 update-cgit       |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/create-repository b/create-repository
index 1720e88..26a6a89 100755
--- a/create-repository
+++ b/create-repository
@@ -8,6 +8,10 @@
 
 BINDIR=/home/admin/gitadmin-bin
 
+if [ `whoami` != gitadmin ] ; then
+    exec sudo -u gitadmin $BINDIR/create-repository "$@"
+fi
+
 . $BINDIR/functions
 
 validate_repository_name "$1"
diff --git a/update-cgit b/update-cgit
index 465aa20..6f51d94 100755
--- a/update-cgit
+++ b/update-cgit
@@ -8,6 +8,10 @@
 
 BINDIR=/home/admin/gitadmin-bin
 
+if [ `whoami` != gitadmin ] ; then
+    exec sudo -u gitadmin $BINDIR/update-cgit "$@"
+fi
+
 echo -n "Updating the cgit repository list... "
 $BINDIR/find-cgit-repos.sh > /git/cgit.repositories
 echo "done"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]