From deefb083c17a876e568a6e0915db4b410e61639c Mon Sep 17 00:00:00 2001 From: Macartur Sousa Date: Tue, 12 May 2015 18:04:50 -0300 Subject: [PATCH] Handle gitlab data when reinstall --- specs/gitlab/gitlab.spec | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/specs/gitlab/gitlab.spec b/specs/gitlab/gitlab.spec index fc818eb..5156322 100644 --- a/specs/gitlab/gitlab.spec +++ b/specs/gitlab/gitlab.spec @@ -1,6 +1,6 @@ Name: gitlab Version: 7.6.2 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Software Development Platform Group: Development/Tools License: Expat @@ -101,11 +101,13 @@ ln -s /var/lib/gitlab-assets %{buildroot}/usr/lib/gitlab/public/assets ln -s /var/lib/gitlab/uploads %{buildroot}/usr/lib/gitlab/public/uploads %post + if [ -x /usr/bin/postgres ]; then service postgresql initdb || true service postgresql start sudo -u postgres createuser --createdb git || true fi + mkdir -p /var/log/gitlab chown -R git:git /var/log/gitlab mkdir -p /var/lib/gitlab/backups @@ -129,7 +131,11 @@ mkdir -p /var/lib/gitlab-assets cd /usr/lib/gitlab/ -yes yes | sudo -u git bundle exec rake gitlab:setup RAILS_ENV=production +rc=`sudo -u git bundle exec rake db:migrate:status RAILS_ENV=production | wc -l` + +if [ $rc -le 1 ];then + yes yes | sudo -u git bundle exec rake gitlab:setup RAILS_ENV=production +fi bundle exec rake assets:precompile RAILS_ENV=production @@ -141,7 +147,8 @@ sed -i 's/app_root="\/home\/\$app_user\/gitlab"/app_root="\/usr\/lib\/gitlab"/' sed -i 's/\/home\/\git/\/usr\/lib/' /etc/logrotate.d/gitlab %preun -service gitlab stop +systemctl stop gitlab +systemctl disable gitlab %files /usr/lib/gitlab -- libgit2 0.21.2