From ef145c1ca91ce60d781022720d742d9ffc400baa Mon Sep 17 00:00:00 2001 From: Praveen Arimbrathodiyil Date: Sat, 1 Oct 2016 15:08:03 +0530 Subject: [PATCH] create db/schema.rb only in postinst --- debian/changelog | 3 ++- debian/gitlab.links | 2 -- debian/rake-tasks.sh | 10 +++------- debian/rules | 1 + 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4a2512991c..bad8a41f10 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,11 @@ gitlab (8.12.1+dfsg1-1) UNRELEASED; urgency=medium - * New upstream release + * New upstream release (Closes: #838256) * Use spec.rake and spec.pattern to select tests * Use INCLUDE_TEST_DEPENDS variable in Gemfile to select test dependencies (--without does not work with --local in bundle install) * Move /usr/share/gitlab/.bundle to /var/lib/gitlab + * Create db/schema.rb only in postinst (Closes: #838668) [ Dmitry Smirnov ] * Fix failure to start masked gitlab.service after reinstall diff --git a/debian/gitlab.links b/debian/gitlab.links index 94f178b230..318d510855 100644 --- a/debian/gitlab.links +++ b/debian/gitlab.links @@ -15,7 +15,5 @@ usr/share/javascript/clipboard/clipboard.js usr/share/gitlab/vendor/assets/javas usr/share/javascript/chartjs/Chart.js usr/share/gitlab/vendor/assets/javascripts/chart-lib.min.js usr/share/javascript/graphael/g.raphael-min.js usr/share/gitlab/vendor/assets/javascripts/g.raphael-min.js usr/share/javascript/graphael/g.bar-min.js usr/share/gitlab/vendor/assets/javascripts/g.bar-min.js - -/var/lib/gitlab/.secret /usr/share/gitlab/.secret /var/lib/gitlab/.gitlab_workhorse_secret /usr/share/gitlab/.gitlab_workhorse_secret /var/lib/gitlab/Gemfile.lock /usr/share/gitlab/Gemfile.lock diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh index a51898d2dd..357cd9a452 100755 --- a/debian/rake-tasks.sh +++ b/debian/rake-tasks.sh @@ -18,17 +18,13 @@ if [ "$1" = "check" ]; then exit fi - -if ! [ -f "${gitlab_app_root}/config/secrets.yml" ]; then - echo "Creating secrets.yml..." - cd ${gitlab_app_root} - su gitlab -c 'bundle exec rake config/initializers/secret_token.rb' -fi - # Check if the db is already present if [ "$(LANG=C su postgres -c "psql gitlab_production -c \"\d\"")" = \ "No relations found." ]; then echo "Initializing database..." + test -f ${gitlab_home}/db/schema.rb || \ + su ${gitlab_user} -s /bin/sh -c\ + "cp ${gitlab_home}/db/schema.rb.template ${gitlab_home}/db/schema.rb" su ${gitlab_user} -s /bin/sh -c 'bundle exec rake db:schema:load' su ${gitlab_user} -s /bin/sh -c 'bundle exec rake db:seed_fu' else diff --git a/debian/rules b/debian/rules index 9fd0b753a6..6a20f557e8 100755 --- a/debian/rules +++ b/debian/rules @@ -10,6 +10,7 @@ override_dh_install: # Make sure we are installing all required files in debian/install sh debian/upstream-file-count-check.sh rm -rf debian/gitlab/usr/share/gitlab/tmp/* + mv debian/gitlab/var/lib/gitlab/db/schema.rb debian/gitlab/var/lib/gitlab/db/schema.rb.template override_dh_installinit: dh_installinit --no-start -p gitlab --name=gitlab-sidekiq