[DRE-commits] [gitlab] 09/09: use -- sh -c for runuser
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Fri Apr 21 09:45:19 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 54f0d8896a9387b0f6e7f43b96a4b25deda2f893
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Fri Apr 21 15:03:54 2017 +0530
use -- sh -c for runuser
---
debian/gitlab-check.sh | 2 +-
debian/postinst | 15 ++++++++-------
debian/postrm | 2 +-
debian/rake-tasks.sh | 12 ++++++------
4 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/debian/gitlab-check.sh b/debian/gitlab-check.sh
index 986bc17..c9468d5 100755
--- a/debian/gitlab-check.sh
+++ b/debian/gitlab-check.sh
@@ -10,4 +10,4 @@ cd /usr/share/gitlab
# Check gitlab is configured correctly
printf "Check if Gitlab is configured correctly...\n"
-runuser -u ${gitlab_user} -s /bin/sh -c 'bundle exec rake gitlab:check'
+runuser -u ${gitlab_user} -- sh -c 'bundle exec rake gitlab:check'
diff --git a/debian/postinst b/debian/postinst
index 4a3f0cf..43a49ab 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -73,9 +73,10 @@ gitlab_user=$RET >/dev/null
#######################################################################
# update Gemfile.lock, always
#######################################################################
-runuser -u ${gitlab_user} -s /bin/sh -c "truncate -s 0 ${gitlab_data_dir}/Gemfile.lock"
+runuser -u ${gitlab_user} -- sh -c "touch ${gitlab_data_dir}/Gemfile.lock && \
+truncate -s 0 ${gitlab_data_dir}/Gemfile.lock"
cd ${gitlab_app_root}
-if ! runuser -u ${gitlab_user} -s /bin/sh -c 'bundle --local --quiet'; then
+if ! runuser -u ${gitlab_user} -- sh -c 'bundle --local --quiet'; then
if [ "$1" = "triggered" ]; then
# probably triggered in the middle of an system upgrade; ignore failure
# but abort here
@@ -128,8 +129,8 @@ case "$1" in
chown -R ${gitlab_user}: $i
done
- runuser -u ${gitlab_user} -s /bin/sh -c "chmod 700 ${gitlab_uploads_path}"
- runuser -u ${gitlab_user} -s /bin/sh -c 'git config --global core.autocrlf "input"'
+ runuser -u ${gitlab_user} -- sh -c "chmod 700 ${gitlab_uploads_path}"
+ runuser -u ${gitlab_user} -- sh -c 'git config --global core.autocrlf "input"'
# Commands below needs to be run from gitlab_app_root
cd ${gitlab_app_root}
@@ -311,16 +312,16 @@ case "$1" in
db_stop
# enable the pg_trgm extension
- runuser -u postgres -c "psql -d gitlab_production -c \"CREATE EXTENSION IF NOT EXISTS pg_trgm;\""
+ runuser -u postgres -- sh -c "psql -d gitlab_production -c \"CREATE EXTENSION IF NOT EXISTS pg_trgm;\""
# Remove Gemfile.lock if present
rm -f ${gitlab_data_dir}/Gemfile.lock
# Create Gemfile.lock and .secret in /var/lib/gitlab
- runuser -u ${gitlab_user} -s /bin/sh -c "touch ${gitlab_data_dir}/Gemfile.lock"
+ runuser -u ${gitlab_user} -- sh -c "touch ${gitlab_data_dir}/Gemfile.lock"
echo "Verifying we have all required libraries..."
- runuser -u ${gitlab_user} -s /bin/sh -c 'bundle install --without development test --local'
+ runuser -u ${gitlab_user} -- sh -c 'bundle install --without development test --local'
echo "Running final rake tasks and tweaks..."
. /usr/lib/gitlab/scripts/rake-tasks.sh
diff --git a/debian/postrm b/debian/postrm
index d9b448a..a90decd 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -71,7 +71,7 @@ ${gitlab_data_dir}; do
# Do only if gitlab_user is set
if command -v dropdb >/dev/null; then
echo "Removing Database: gitlab_production"
- if runuser -u ${gitlab_user} -c 'psql gitlab_production -c ""' ; then su postgres -c "dropdb gitlab_production"; fi
+ if runuser -u ${gitlab_user} -- sh -c 'psql gitlab_production -c ""' ; then su postgres -c "dropdb gitlab_production"; fi
else
echo "dropdb command not found. Hence not removing database."
fi
diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh
index 3416acf..1f8a355 100755
--- a/debian/rake-tasks.sh
+++ b/debian/rake-tasks.sh
@@ -9,21 +9,21 @@ export DB RAILS_ENV
cd /usr/share/gitlab
# Check if the db is already present
-if [ "$(LANG=C runuser -u postgres -c "psql gitlab_production -c \"\d\"")" = \
+if [ "$(LANG=C runuser -u postgres -- sh -c "psql gitlab_production -c \"\d\"")" = \
"No relations found." ]; then
echo "Initializing database..."
test -f ${gitlab_home}/db/schema.rb || \
- runuser -u ${gitlab_user} -s /bin/sh -c\
+ runuser -u ${gitlab_user} -- sh -c \
"cp ${gitlab_data_dir}/db/schema.rb.template ${gitlab_data_dir}/db/schema.rb"
- runuser -u ${gitlab_user} -s /bin/sh -c 'bundle exec rake db:schema:load'
- runuser -u ${gitlab_user} -s /bin/sh -c 'bundle exec rake db:seed_fu'
+ runuser -u ${gitlab_user} -- sh -c 'bundle exec rake db:schema:load'
+ runuser -u ${gitlab_user} -- sh -c 'bundle exec rake db:seed_fu'
else
echo "gitlab_production database is not empty, skipping gitlab setup"
- runuser -u ${gitlab_user} -s /bin/sh -c 'bundle exec rake db:migrate'
+ runuser -u ${gitlab_user} -- sh -c 'bundle exec rake db:migrate'
fi
# Restrict permissions for secret files
chmod 0700 ${gitlab_data_dir}/.gitlab_shell_secret
echo "Precompiling assets..."
-runuser -u ${gitlab_user} -s /bin/sh -c 'bundle exec rake tmp:cache:clear assets:precompile'
+runuser -u ${gitlab_user} -- sh -c 'bundle exec rake tmp:cache:clear assets:precompile'
--
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