[sysadmin-bin] Use git config to figure out whether a key value pair is there, additionally make sure an acl is lan



commit 0c0f30704fe9152fd7c7767683b55d50eca8225b
Author: Andrea Veri <averi redhat com>
Date:   Mon Oct 23 14:54:19 2017 +0200

    Use git config to figure out whether a key value pair is there, additionally make sure an acl is landed 
against the git group, that to allow gitlab functionalities to not break due to wrong permissions

 git/gnome-pre-receive |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/git/gnome-pre-receive b/git/gnome-pre-receive
index 2fc80b9..a4e55b1 100755
--- a/git/gnome-pre-receive
+++ b/git/gnome-pre-receive
@@ -66,20 +66,31 @@ fi
 if [[ $(hostname) =~ gitlab(\-test|)\.gnome\.org$ ]]; then 
   if [ $basedir = '/var/opt/gitlab/git-data/repositories/GNOME' ]; then
     cd $GIT_DIR
-    cat $GIT_CONFIG | grep -q 'hooks.emailprefix'
+    git config hooks.emailprefix
     if [ "$?" -eq 1 ]; then
       git config hooks.emailprefix ""
     fi
-    cat $GIT_CONFIG | grep -q 'hooks.mailinglist'
+    git config hooks.mailinglist
     if [ "$?" -eq 1 ]; then
       git config hooks.mailinglist commits-list gnome org
     fi
+    git config gnome.gitlabrepo
+    if [ "$?" -eq 1 ]; then
+      git config gnome.gitlabrepo true 
+    fi
 
     sudo setfacl -d -R -m g:gnomecvs:rwx $GIT_DIR/objects/
     sudo setfacl -R -m g:gnomecvs:rwx $GIT_DIR/objects/
     setfacl -d -R -m g:gnomecvs:rwx $GIT_DIR/
     setfacl -R -m g:gnomecvs:rwx $GIT_DIR/
   fi
+else
+  cd $GIT_DIR  
+  if `git config gnome.gitlabrepo`; then
+    user=`id -u`
+    find ./objects -uid $user -type d | xargs setfacl -d -m g:git:rwx
+    find ./objects -uid $user -type f | xargs setfacl -m g:git:rwx
+  fi
 fi
 
 my_uid=`id -u`


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