From d6bd3b07bec21417e6aa9df319f000fc82d09773 Mon Sep 17 00:00:00 2001 From: Praveen Arimbrathodiyil Date: Sat, 1 Oct 2016 16:02:34 +0530 Subject: [PATCH] move gitlab check to its own script --- debian/gitlab-check.sh | 13 +++++++++++++ debian/install | 1 + debian/postinst | 2 +- debian/rake-tasks.sh | 13 ------------- 4 files changed, 15 insertions(+), 14 deletions(-) create mode 100755 debian/gitlab-check.sh diff --git a/debian/gitlab-check.sh b/debian/gitlab-check.sh new file mode 100755 index 0000000000..b8b85af374 --- /dev/null +++ b/debian/gitlab-check.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +set -e + +# Read and export debian specific configuration +# Only exported variables will be passed on to gitlab app +export $(cat /etc/gitlab/gitlab-debian.conf) +cd /usr/share/gitlab + +# Check gitlab is configured correctly +printf "Check if Gitlab is configured correctly...\n" +su ${gitlab_user} -s /bin/sh -c 'bundle exec rake gitlab:check RAILS_ENV=production' + diff --git a/debian/install b/debian/install index d2d2123fea..4179b5eaa6 100644 --- a/debian/install +++ b/debian/install @@ -10,6 +10,7 @@ debian/conf/tmpfiles.d/gitlab.conf usr/lib/tmpfiles.d debian/adduser.sh usr/lib/gitlab/scripts debian/grantpriv.sh usr/lib/gitlab/scripts debian/rake-tasks.sh usr/lib/gitlab/scripts +debian/gitlab-check.sh usr/lib/gitlab/scripts app usr/share/gitlab bin usr/share/gitlab CHANGELOG usr/share/gitlab diff --git a/debian/postinst b/debian/postinst index 800a18ea2e..5d94f719b1 100755 --- a/debian/postinst +++ b/debian/postinst @@ -240,6 +240,6 @@ esac case "$1" in configure) echo "Running rake checks..." - . /usr/lib/gitlab/scripts/rake-tasks.sh check + . /usr/lib/gitlab/scripts/gitlab-check.sh ;; esac diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh index 357cd9a452..96982bf718 100755 --- a/debian/rake-tasks.sh +++ b/debian/rake-tasks.sh @@ -7,17 +7,6 @@ set -e export $(cat /etc/gitlab/gitlab-debian.conf) cd /usr/share/gitlab -glcheck() { - # Check gitlab is configured correctly - printf "Check if Gitlab is configured correctly...\n" - su ${gitlab_user} -s /bin/sh -c 'bundle exec rake gitlab:check RAILS_ENV=production' -} - -if [ "$1" = "check" ]; then - glcheck - exit -fi - # Check if the db is already present if [ "$(LANG=C su postgres -c "psql gitlab_production -c \"\d\"")" = \ "No relations found." ]; then @@ -37,5 +26,3 @@ chmod 0700 ${gitlab_data_dir}/.gitlab_shell_secret echo "Precompiling assets..." su ${gitlab_user} -s /bin/sh -c 'bundle exec rake tmp:cache:clear assets:precompile RAILS_ENV=production' - -glcheck