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 | 1 | Name: gitlab |
2 | 2 | Version: 7.6.2 |
3 | -Release: 11%{?dist} | |
3 | +Release: 12%{?dist} | |
4 | 4 | Summary: Software Development Platform |
5 | 5 | Group: Development/Tools |
6 | 6 | License: Expat |
... | ... | @@ -101,11 +101,13 @@ ln -s /var/lib/gitlab-assets %{buildroot}/usr/lib/gitlab/public/assets |
101 | 101 | ln -s /var/lib/gitlab/uploads %{buildroot}/usr/lib/gitlab/public/uploads |
102 | 102 | |
103 | 103 | %post |
104 | + | |
104 | 105 | if [ -x /usr/bin/postgres ]; then |
105 | 106 | service postgresql initdb || true |
106 | 107 | service postgresql start |
107 | 108 | sudo -u postgres createuser --createdb git || true |
108 | 109 | fi |
110 | + | |
109 | 111 | mkdir -p /var/log/gitlab |
110 | 112 | chown -R git:git /var/log/gitlab |
111 | 113 | mkdir -p /var/lib/gitlab/backups |
... | ... | @@ -129,7 +131,11 @@ mkdir -p /var/lib/gitlab-assets |
129 | 131 | |
130 | 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 | 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 | 147 | sed -i 's/\/home\/\git/\/usr\/lib/' /etc/logrotate.d/gitlab |
142 | 148 | |
143 | 149 | %preun |
144 | -service gitlab stop | |
150 | +systemctl stop gitlab | |
151 | +systemctl disable gitlab | |
145 | 152 | |
146 | 153 | %files |
147 | 154 | /usr/lib/gitlab | ... | ... |