[DRE-commits] [gitlab] 01/16: Patch by Benjamin Drung

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Thu Feb 16 12:09:31 UTC 2017


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository gitlab.

commit e7430db19d225c004c1086de435bcd733e453110
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Wed Feb 15 11:06:52 2017 +0530

    Patch by Benjamin Drung
    
    If the sysadmin changes the gitlab user in
    /etc/gitlab/gitlab-debian.conf, the package installation or upgrade will
    fail, because grantpriv.sh will always grant privileges to the gitlab
    user. Thus adapt grantpriv.sh to honor the gitlab_user setting.
---
 debian/grantpriv.sh | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/debian/grantpriv.sh b/debian/grantpriv.sh
index f64d957..848fe3c 100755
--- a/debian/grantpriv.sh
+++ b/debian/grantpriv.sh
@@ -1,26 +1,28 @@
 #!/bin/sh
 
-user=gitlab
 dbname=gitlab_production
 
+# Take gitlab_user from envornment variable or use gitlab
+test -n "${gitlab_user:-}" || gitlab_user="gitlab"
+
 # If gitlab user cannot access gitlab_production,
 # then it means the gitlab role does not exist
-if ! su gitlab -c 'psql gitlab_production -c ""'
+if ! su ${gitlab_user} -c 'psql gitlab_production -c ""'
 then
-	echo "Create $user user with create database privillege..."
-	su postgres -c "psql -c \"CREATE USER $user CREATEDB;\"" || {
+	echo "Create ${gitlab_user} user with create database privillege..."
+	su postgres -c "psql -c \"CREATE USER ${gitlab_user} CREATEDB;\"" || {
 	  exit 1 
 	  }
 fi
 
 # By default the gitlab_prodcution is not owned by gitlab user
-echo "Make $user user owner of $dbname database..."
-su postgres -c "psql -c \"ALTER DATABASE $dbname OWNER to $user;\"" || {
+echo "Make ${gitlab_user} user owner of $dbname database..."
+su postgres -c "psql -c \"ALTER DATABASE $dbname OWNER to ${gitlab_user};\"" || {
   exit 1 
   }
 
-echo "Grant all privileges to $user user..."
-su postgres -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE template1 to $user;\"" || {
+echo "Grant all privileges to ${gitlab_user} user..."
+su postgres -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE template1 to ${gitlab_user};\"" || {
   exit 1
   }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gitlab.git



More information about the Pkg-ruby-extras-commits mailing list