Commit deefb083c17a876e568a6e0915db4b410e61639c
1 parent
36832eb0
Exists in
gitlab-pkg
Handle gitlab data when reinstall
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com> Signed-off-by: Lucas Moura <lucas.moura128@gmail.com> Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
Showing
1 changed file
with
10 additions
and
3 deletions
Show diff stats
specs/gitlab/gitlab.spec
| 1 | Name: gitlab | 1 | Name: gitlab |
| 2 | Version: 7.6.2 | 2 | Version: 7.6.2 |
| 3 | -Release: 11%{?dist} | 3 | +Release: 12%{?dist} |
| 4 | Summary: Software Development Platform | 4 | Summary: Software Development Platform |
| 5 | Group: Development/Tools | 5 | Group: Development/Tools |
| 6 | License: Expat | 6 | License: Expat |
| @@ -101,11 +101,13 @@ ln -s /var/lib/gitlab-assets %{buildroot}/usr/lib/gitlab/public/assets | @@ -101,11 +101,13 @@ ln -s /var/lib/gitlab-assets %{buildroot}/usr/lib/gitlab/public/assets | ||
| 101 | ln -s /var/lib/gitlab/uploads %{buildroot}/usr/lib/gitlab/public/uploads | 101 | ln -s /var/lib/gitlab/uploads %{buildroot}/usr/lib/gitlab/public/uploads |
| 102 | 102 | ||
| 103 | %post | 103 | %post |
| 104 | + | ||
| 104 | if [ -x /usr/bin/postgres ]; then | 105 | if [ -x /usr/bin/postgres ]; then |
| 105 | service postgresql initdb || true | 106 | service postgresql initdb || true |
| 106 | service postgresql start | 107 | service postgresql start |
| 107 | sudo -u postgres createuser --createdb git || true | 108 | sudo -u postgres createuser --createdb git || true |
| 108 | fi | 109 | fi |
| 110 | + | ||
| 109 | mkdir -p /var/log/gitlab | 111 | mkdir -p /var/log/gitlab |
| 110 | chown -R git:git /var/log/gitlab | 112 | chown -R git:git /var/log/gitlab |
| 111 | mkdir -p /var/lib/gitlab/backups | 113 | mkdir -p /var/lib/gitlab/backups |
| @@ -129,7 +131,11 @@ mkdir -p /var/lib/gitlab-assets | @@ -129,7 +131,11 @@ mkdir -p /var/lib/gitlab-assets | ||
| 129 | 131 | ||
| 130 | cd /usr/lib/gitlab/ | 132 | cd /usr/lib/gitlab/ |
| 131 | 133 | ||
| 132 | -yes yes | sudo -u git bundle exec rake gitlab:setup RAILS_ENV=production | 134 | +rc=`sudo -u git bundle exec rake db:migrate:status RAILS_ENV=production | wc -l` |
| 135 | + | ||
| 136 | +if [ $rc -le 1 ];then | ||
| 137 | + yes yes | sudo -u git bundle exec rake gitlab:setup RAILS_ENV=production | ||
| 138 | +fi | ||
| 133 | 139 | ||
| 134 | bundle exec rake assets:precompile RAILS_ENV=production | 140 | bundle exec rake assets:precompile RAILS_ENV=production |
| 135 | 141 | ||
| @@ -141,7 +147,8 @@ sed -i 's/app_root="\/home\/\$app_user\/gitlab"/app_root="\/usr\/lib\/gitlab"/' | @@ -141,7 +147,8 @@ sed -i 's/app_root="\/home\/\$app_user\/gitlab"/app_root="\/usr\/lib\/gitlab"/' | ||
| 141 | sed -i 's/\/home\/\git/\/usr\/lib/' /etc/logrotate.d/gitlab | 147 | sed -i 's/\/home\/\git/\/usr\/lib/' /etc/logrotate.d/gitlab |
| 142 | 148 | ||
| 143 | %preun | 149 | %preun |
| 144 | -service gitlab stop | 150 | +systemctl stop gitlab |
| 151 | +systemctl disable gitlab | ||
| 145 | 152 | ||
| 146 | %files | 153 | %files |
| 147 | /usr/lib/gitlab | 154 | /usr/lib/gitlab |