remove sudo

This commit is contained in:
Praveen Arimbrathodiyil 2016-01-29 21:37:47 +05:30
parent 2a885bfef0
commit 801c0bccf6
3 changed files with 11 additions and 7 deletions

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
gitlab (8.4.0+dfsg~rc2-5) UNRELEASED; urgency=medium
* Use su instead of sudo everywhere (Closes: #812951)
-- Pirate Praveen <praveen@debian.org> Fri, 29 Jan 2016 21:36:55 +0530
gitlab (8.4.0+dfsg~rc2-4) unstable; urgency=medium
* Reupload to unstable

10
debian/grantpriv.sh vendored
View file

@ -5,23 +5,21 @@ dbname=gitlab_production
# If gitlab user cannot access gitlab_production,
# then it means the gitlab role does not exist
if ! su gitlab -s /bin/sh -c 'psql gitlab_production -c ""'
if ! su gitlab -c 'psql gitlab_production -c ""'
then
echo "Create $user user with create database privillege..."
sudo -u postgres psql -c "CREATE USER $user CREATEDB;" || {
su postgres -c 'psql -c "CREATE USER $user CREATEDB;"' || {
exit 1
}
fi
# By default the gitlab_prodcution is not owned by gitlab user
echo "Make $user user owner of $dbname database..."
sudo -u postgres psql -c "ALTER DATABASE $dbname OWNER to $user;" || {
su postgres -c 'psql -c "ALTER DATABASE $dbname OWNER to $user;"' || {
exit 1
}
echo "Grant all privileges to $user user..."
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE template1 to $user;"|| {
su postgres -c 'psql -c "GRANT ALL PRIVILEGES ON DATABASE template1 to $user;"' || {
exit 1
}

2
debian/postinst vendored
View file

@ -38,7 +38,7 @@ case "$1" in
mkdir -p ${gitlab_repo_path}
chmod -R ug+rwX,o-rwx ${gitlab_repo_path}/
chmod -R ug-s ${gitlab_repo_path}/
find ${gitlab_repo_path}/ -type d -print0 | sudo xargs -0 chmod g+s
find ${gitlab_repo_path}/ -type d -print0 | xargs -0 chmod g+s
chown -R ${gitlab_user}: ${gitlab_home}
chown -R ${gitlab_user}: ${gitlab_data_dir}