fix failure to start masked gitlab.service after reinstall.

Essentially problem is due to L:maintainer-script-should-not-use-service [1]:
 postinst invoke `rake-tasks.sh` which tries to start gitlab using "service gitlab start"
 before debhelper-generated scripts that unmask "gitlab.service".

 This commit modifies postinst to run "rake gitlab:check" after #DEBHELPER#
 scripts that take care of starting GitLab (which is no longer started by
 `rake-tasks.sh`).

 [1]: https://lintian.debian.org/tags/maintainer-script-should-not-use-service.html
This commit is contained in:
Dmitry Smirnov 2016-09-26 13:43:37 +10:00
parent 46c87e29b2
commit be299832ee
2 changed files with 19 additions and 9 deletions

7
debian/postinst vendored
View file

@ -237,4 +237,9 @@ esac
#DEBHELPER#
exit 0
case "$1" in
configure)
echo "Running rake checks..."
. /usr/lib/gitlab/scripts/rake-tasks.sh check
;;
esac

21
debian/rake-tasks.sh vendored
View file

@ -3,6 +3,18 @@
# Only exported variables will be passed on to gitlab app
export $(cat /etc/gitlab/gitlab-debian.conf)
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
if ! [ -f "${gitlab_app_root}/config/secrets.yml" ]; then
echo "Creating secrets.yml..."
cd ${gitlab_app_root}
@ -26,11 +38,4 @@ 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'
# Start gitlab
printf "Starting GitLab...\n"
service gitlab start
# 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'
glcheck