Mon, 01 Apr 2013 19:50:38 +0200
Complete packaging along with specification and runcommand improvements.
michael@764 | 1 | ## |
michael@764 | 2 | ## chiliproj.spec -- OpenPKG RPM Package Specification |
michael@764 | 3 | ## Copyright (c) 2013 Michael Schloh von Bennewitz <michael@schloh.com> |
michael@764 | 4 | ## |
michael@764 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@764 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@764 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@764 | 8 | ## copies. |
michael@764 | 9 | ## |
michael@764 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@764 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@764 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@764 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@764 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@764 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@764 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@764 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@764 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@764 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@764 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@764 | 21 | ## SUCH DAMAGE. |
michael@764 | 22 | ## |
michael@764 | 23 | |
michael@764 | 24 | # FIXME: GEM_HOME=$HOME/.gem RAILS_ENV=production PATH=$PATH:%{l_prefix}/lib/ruby/gems/1.9.1/bin bundle install --without test development mysql postgres rmagick |
michael@765 | 25 | # FIXME: Reduce %post by removing RAILS_ENV=production |
michael@765 | 26 | # FIXME: Consider using imagemagick for Gantt? |
michael@764 | 27 | # FIXME: bundle exec rails s |
michael@764 | 28 | # FIXME: w3m http://localhost:3000/ |
michael@764 | 29 | # FIXME: log in with Login: admin and Password: admin |
michael@764 | 30 | |
michael@764 | 31 | # package version |
michael@764 | 32 | %define V_pref 427 |
michael@764 | 33 | %define V_rake 10.0.4 |
michael@764 | 34 | %define V_activesupport 2.3.18 |
michael@764 | 35 | %define V_rack 1.1.6 |
michael@764 | 36 | %define V_actionpack 2.3.18 |
michael@764 | 37 | %define V_actionmailer 2.3.18 |
michael@764 | 38 | %define V_activerecord 2.3.18 |
michael@764 | 39 | %define V_activeresource 2.3.18 |
michael@764 | 40 | %define V_rails 2.3.18 |
michael@764 | 41 | %define V_actsastaggable 2.1.0 |
michael@764 | 42 | %define V_coderay 1.0.9 |
michael@764 | 43 | %define V_daemons 1.1.9 |
michael@764 | 44 | %define V_eventmachine 1.0.3 |
michael@764 | 45 | %define V_gravatarify 3.0.0 |
michael@764 | 46 | %define V_i18n 0.4.2 |
michael@764 | 47 | %define V_json 1.7.7 |
michael@764 | 48 | %define V_liquid 2.3.0 |
michael@764 | 49 | %define V_mysql2 0.2.18 |
michael@764 | 50 | %define V_netldap 0.3.1 |
michael@764 | 51 | %define V_rdoc 4.0.1 |
michael@764 | 52 | %define V_rubyopenid 2.1.8 |
michael@764 | 53 | %define V_rubytree 0.5.3 |
michael@764 | 54 | %define V_sqlite3 1.3.7 |
michael@764 | 55 | %define V_thin 1.5.1 |
michael@764 | 56 | %define V_tzinfo 0.3.37 |
michael@764 | 57 | %define V_bundler 1.3.4 |
michael@764 | 58 | |
michael@764 | 59 | # package information |
michael@764 | 60 | Name: chiliproj |
michael@764 | 61 | Summary: Comprehensive Rails-based Project Manager |
michael@764 | 62 | URL: http://www.chiliproject.org/ |
michael@764 | 63 | Vendor: Felix Schaefer et al. |
michael@764 | 64 | Packager: Michael Schloh von Bennewitz |
michael@764 | 65 | Distribution: Europalab Networks Production |
michael@764 | 66 | Class: EVAL |
michael@764 | 67 | Group: Calendar |
michael@764 | 68 | License: GPL |
michael@765 | 69 | Version: 20130401 |
michael@764 | 70 | Release: 20120800 |
michael@764 | 71 | |
michael@764 | 72 | # list of sources |
michael@764 | 73 | Source0: http://www.chiliproject.org/attachments/download/%{V_pref}/chiliproject-%{version}.tar.bz2 |
michael@764 | 74 | Source1: rc.chiliproj |
michael@764 | 75 | Source2: Gemfile.lock |
michael@764 | 76 | Source3: http://rubygems.org/downloads/rake-%{V_rake}.gem |
michael@764 | 77 | Source4: http://rubygems.org/downloads/activesupport-%{V_activesupport}.gem |
michael@764 | 78 | Source5: http://rubygems.org/downloads/rack-%{V_rack}.gem |
michael@764 | 79 | Source6: http://rubygems.org/downloads/actionpack-%{V_actionpack}.gem |
michael@764 | 80 | Source7: http://rubygems.org/downloads/actionmailer-%{V_actionmailer}.gem |
michael@764 | 81 | Source8: http://rubygems.org/downloads/activerecord-%{V_activerecord}.gem |
michael@764 | 82 | Source9: http://rubygems.org/downloads/activeresource-%{V_activeresource}.gem |
michael@764 | 83 | Source10: http://rubygems.org/downloads/rails-%{V_rails}.gem |
michael@764 | 84 | Source11: http://rubygems.org/downloads/acts-as-taggable-on-%{V_actsastaggable}.gem |
michael@764 | 85 | Source12: http://rubygems.org/downloads/coderay-%{V_coderay}.gem |
michael@764 | 86 | Source13: http://rubygems.org/downloads/daemons-%{V_daemons}.gem |
michael@764 | 87 | Source14: http://rubygems.org/downloads/eventmachine-%{V_eventmachine}.gem |
michael@764 | 88 | Source15: http://rubygems.org/downloads/gravatarify-%{V_gravatarify}.gem |
michael@764 | 89 | Source16: http://rubygems.org/downloads/i18n-%{V_i18n}.gem |
michael@764 | 90 | Source17: http://rubygems.org/downloads/json-%{V_json}.gem |
michael@764 | 91 | Source18: http://rubygems.org/downloads/liquid-%{V_liquid}.gem |
michael@764 | 92 | Source19: http://rubygems.org/downloads/mysql2-%{V_mysql2}.gem |
michael@764 | 93 | Source20: http://rubygems.org/downloads/net-ldap-%{V_netldap}.gem |
michael@764 | 94 | Source21: http://rubygems.org/downloads/rdoc-%{V_rdoc}.gem |
michael@764 | 95 | Source22: http://rubygems.org/downloads/ruby-openid-%{V_rubyopenid}.gem |
michael@764 | 96 | Source23: http://rubygems.org/downloads/rubytree-%{V_rubytree}.gem |
michael@764 | 97 | Source24: http://rubygems.org/downloads/sqlite3-%{V_sqlite3}.gem |
michael@764 | 98 | Source25: http://rubygems.org/downloads/thin-%{V_thin}.gem |
michael@764 | 99 | Source26: http://rubygems.org/downloads/tzinfo-%{V_tzinfo}.gem |
michael@764 | 100 | Source27: http://rubygems.org/downloads/bundler-%{V_bundler}.gem |
michael@764 | 101 | |
michael@764 | 102 | # build information |
michael@764 | 103 | BuildPreReq: OpenPKG, openpkg >= 20100101, ruby < 2.0.0, ruby-rails, ruby-thin |
michael@764 | 104 | PreReq: OpenPKG, openpkg >= 20100101, ruby < 2.0.0, ruby-rails, ruby-thin |
michael@764 | 105 | |
michael@764 | 106 | %description |
michael@764 | 107 | ChiliProject is a web based project management system. It supports |
michael@764 | 108 | your team throughout the complete project life cycle, from setting |
michael@764 | 109 | up and discussing a project plan, over tracking issues and reporting |
michael@764 | 110 | work progress to collaboratively sharing knowledge. |
michael@764 | 111 | |
michael@764 | 112 | %track |
michael@764 | 113 | prog chiliproj:chiliproj = { |
michael@764 | 114 | version = %{version} |
michael@764 | 115 | url = http://www.chiliproject.org/attachments/download/ |
michael@764 | 116 | regex = (\d+) |
michael@764 | 117 | url = http://www.chiliproject.org/attachments/download/__NEWVER__/ |
michael@764 | 118 | regex = chiliproject-(__VER__)\.tar.bz2 |
michael@764 | 119 | } |
michael@764 | 120 | prog chiliproj:rake = { |
michael@764 | 121 | version = %{V_rake} |
michael@764 | 122 | url = http://rubygems.org/gems/rake |
michael@764 | 123 | regex = rake-(__VER__)\.gem |
michael@764 | 124 | } |
michael@764 | 125 | prog chiliproj:activesupport = { |
michael@764 | 126 | version = %{V_activesupport} |
michael@764 | 127 | url = http://rubygems.org/gems/activesupport |
michael@764 | 128 | regex = activesupport-(__VER__)\.gem |
michael@764 | 129 | } |
michael@764 | 130 | prog chiliproj:rack = { |
michael@764 | 131 | version = %{V_rack} |
michael@764 | 132 | url = http://rubygems.org/gems/rack |
michael@764 | 133 | regex = rack-(__VER__)\.gem |
michael@764 | 134 | } |
michael@764 | 135 | prog chiliproj:actionpack = { |
michael@764 | 136 | version = %{V_actionpack} |
michael@764 | 137 | url = http://rubygems.org/gems/actionpack |
michael@764 | 138 | regex = actionpack-(__VER__)\.gem |
michael@764 | 139 | } |
michael@764 | 140 | prog chiliproj:actionmailer = { |
michael@764 | 141 | version = %{V_actionmailer} |
michael@764 | 142 | url = http://rubygems.org/gems/actionmailer |
michael@764 | 143 | regex = actionmailer-(__VER__)\.gem |
michael@764 | 144 | } |
michael@764 | 145 | prog chiliproj:activerecord = { |
michael@764 | 146 | version = %{V_activerecord} |
michael@764 | 147 | url = http://rubygems.org/gems/activerecord |
michael@764 | 148 | regex = activerecord-(__VER__)\.gem |
michael@764 | 149 | } |
michael@764 | 150 | prog chiliproj:activeresource = { |
michael@764 | 151 | version = %{V_activeresource} |
michael@764 | 152 | url = http://rubygems.org/gems/activeresource |
michael@764 | 153 | regex = activeresource-(__VER__)\.gem |
michael@764 | 154 | } |
michael@764 | 155 | prog chiliproj:rails = { |
michael@764 | 156 | version = %{V_rails} |
michael@764 | 157 | url = http://rubygems.org/gems/rails |
michael@764 | 158 | regex = rails-(__VER__)\.gem |
michael@764 | 159 | } |
michael@764 | 160 | prog chiliproj:actsastaggable = { |
michael@764 | 161 | version = %{V_actsastaggable} |
michael@764 | 162 | url = http://rubygems.org/gems/acts-as-taggable-on |
michael@764 | 163 | regex = acts-as-taggable-on-(__VER__)\.gem |
michael@764 | 164 | } |
michael@764 | 165 | prog chiliproj:coderay = { |
michael@764 | 166 | version = %{V_coderay} |
michael@764 | 167 | url = http://rubygems.org/gems/coderay |
michael@764 | 168 | regex = coderay-(__VER__)\.gem |
michael@764 | 169 | } |
michael@764 | 170 | prog chiliproj:daemons = { |
michael@764 | 171 | version = %{V_daemons} |
michael@764 | 172 | url = http://rubygems.org/gems/daemons |
michael@764 | 173 | regex = daemons-(__VER__)\.gem |
michael@764 | 174 | } |
michael@764 | 175 | prog chiliproj:eventmachine = { |
michael@764 | 176 | version = %{V_eventmachine} |
michael@764 | 177 | url = http://rubygems.org/gems/eventmachine |
michael@764 | 178 | regex = eventmachine-(__VER__)\.gem |
michael@764 | 179 | } |
michael@764 | 180 | prog chiliproj:gravatarify = { |
michael@764 | 181 | version = %{V_gravatarify} |
michael@764 | 182 | url = http://rubygems.org/gems/gravatarify |
michael@764 | 183 | regex = gravatarify-(__VER__)\.gem |
michael@764 | 184 | } |
michael@764 | 185 | prog chiliproj:i18n = { |
michael@764 | 186 | version = %{V_i18n} |
michael@764 | 187 | url = http://rubygems.org/gems/i18n |
michael@764 | 188 | regex = i18n-(__VER__)\.gem |
michael@764 | 189 | } |
michael@764 | 190 | prog chiliproj:json = { |
michael@764 | 191 | version = %{V_json} |
michael@764 | 192 | url = http://rubygems.org/gems/json |
michael@764 | 193 | regex = json-(__VER__)\.gem |
michael@764 | 194 | } |
michael@764 | 195 | prog chiliproj:liquid = { |
michael@764 | 196 | version = %{V_liquid} |
michael@764 | 197 | url = http://rubygems.org/gems/liquid |
michael@764 | 198 | regex = liquid-(__VER__)\.gem |
michael@764 | 199 | } |
michael@764 | 200 | prog chiliproj:mysql2 = { |
michael@764 | 201 | version = %{V_mysql2} |
michael@764 | 202 | url = http://rubygems.org/gems/mysql2 |
michael@764 | 203 | regex = mysql2-(__VER__)\.gem |
michael@764 | 204 | } |
michael@764 | 205 | prog chiliproj:netldap = { |
michael@764 | 206 | version = %{V_netldap} |
michael@764 | 207 | url = http://rubygems.org/gems/net-ldap |
michael@764 | 208 | regex = net-ldap-(__VER__)\.gem |
michael@764 | 209 | } |
michael@764 | 210 | prog chiliproj:rdoc = { |
michael@764 | 211 | version = %{V_rdoc} |
michael@764 | 212 | url = http://rubygems.org/gems/rdoc |
michael@764 | 213 | regex = rdoc-(__VER__)\.gem |
michael@764 | 214 | } |
michael@764 | 215 | prog chiliproj:rubyopenid = { |
michael@764 | 216 | version = %{V_rubyopenid} |
michael@764 | 217 | url = http://rubygems.org/gems/ruby-openid |
michael@764 | 218 | regex = ruby-openid-(__VER__)\.gem |
michael@764 | 219 | } |
michael@764 | 220 | prog chiliproj:rubytree = { |
michael@764 | 221 | version = %{V_rubytree} |
michael@764 | 222 | url = http://rubygems.org/gems/rubytree |
michael@764 | 223 | regex = rubytree-(__VER__)\.gem |
michael@764 | 224 | } |
michael@764 | 225 | prog chiliproj:sqlite3 = { |
michael@764 | 226 | version = %{V_sqlite3} |
michael@764 | 227 | url = http://rubygems.org/gems/sqlite3 |
michael@764 | 228 | regex = sqlite3-(__VER__)\.gem |
michael@764 | 229 | } |
michael@764 | 230 | prog chiliproj:thin = { |
michael@764 | 231 | version = %{V_thin} |
michael@764 | 232 | url = http://rubygems.org/gems/thin |
michael@764 | 233 | regex = thin-(__VER__)\.gem |
michael@764 | 234 | } |
michael@764 | 235 | prog chiliproj:tzinfo = { |
michael@764 | 236 | version = %{V_tzinfo} |
michael@764 | 237 | url = http://rubygems.org/gems/tzinfo |
michael@764 | 238 | regex = tzinfo-(__VER__)\.gem |
michael@764 | 239 | } |
michael@764 | 240 | prog chiliproj:bundler = { |
michael@764 | 241 | version = %{V_bundler} |
michael@764 | 242 | url = http://rubygems.org/gems/bundler |
michael@764 | 243 | regex = bundler-(__VER__)\.gem |
michael@764 | 244 | } |
michael@764 | 245 | |
michael@764 | 246 | %prep |
michael@764 | 247 | %setup -q -n chiliproject-%{version} |
michael@764 | 248 | %{l_shtool} subst \ |
michael@764 | 249 | -e 's;# \(ENV\[.RAILS_ENV.\] ||= .production.\);\1;' \ |
michael@764 | 250 | config/environment.rb |
michael@764 | 251 | |
michael@764 | 252 | %build |
michael@764 | 253 | |
michael@764 | 254 | %install |
michael@764 | 255 | RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` |
michael@764 | 256 | export GEM_HOME=$RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION |
michael@764 | 257 | %{l_shtool} mkdir -f -p -m 755 $GEM_HOME |
michael@765 | 258 | %{l_shtool} mkdir -f -p $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/public/plugin_assets |
michael@765 | 259 | %{l_shtool} mkdir -f -p $RPM_BUILD_ROOT%{l_prefix}/var/chiliproj |
michael@764 | 260 | %{l_tar} cf - . | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj |
michael@764 | 261 | %{l_prefix}/bin/gem install --local %{SOURCE3} |
michael@764 | 262 | %{l_prefix}/bin/gem install --local %{SOURCE4} |
michael@764 | 263 | %{l_prefix}/bin/gem install --local %{SOURCE5} |
michael@764 | 264 | %{l_prefix}/bin/gem install --local %{SOURCE6} |
michael@764 | 265 | %{l_prefix}/bin/gem install --local %{SOURCE7} |
michael@764 | 266 | %{l_prefix}/bin/gem install --local %{SOURCE8} |
michael@764 | 267 | %{l_prefix}/bin/gem install --local %{SOURCE9} |
michael@764 | 268 | %{l_prefix}/bin/gem install --local %{SOURCE10} |
michael@764 | 269 | %{l_prefix}/bin/gem install --local %{SOURCE11} |
michael@764 | 270 | %{l_prefix}/bin/gem install --local %{SOURCE12} |
michael@764 | 271 | %{l_prefix}/bin/gem install --local %{SOURCE13} |
michael@764 | 272 | %{l_prefix}/bin/gem install --local %{SOURCE14} |
michael@764 | 273 | %{l_prefix}/bin/gem install --local %{SOURCE15} |
michael@764 | 274 | %{l_prefix}/bin/gem install --local %{SOURCE16} |
michael@764 | 275 | %{l_prefix}/bin/gem install --local %{SOURCE17} |
michael@764 | 276 | %{l_prefix}/bin/gem install --local %{SOURCE18} |
michael@764 | 277 | %{l_prefix}/bin/gem install --local %{SOURCE19} |
michael@764 | 278 | %{l_prefix}/bin/gem install --local %{SOURCE20} |
michael@764 | 279 | %{l_prefix}/bin/gem install --local %{SOURCE21} |
michael@764 | 280 | %{l_prefix}/bin/gem install --local %{SOURCE22} |
michael@764 | 281 | %{l_prefix}/bin/gem install --local %{SOURCE23} |
michael@764 | 282 | %{l_prefix}/bin/gem install --local %{SOURCE24} |
michael@764 | 283 | %{l_prefix}/bin/gem install --local %{SOURCE25} |
michael@764 | 284 | %{l_prefix}/bin/gem install --local %{SOURCE27} |
michael@764 | 285 | |
michael@764 | 286 | # install configuration |
michael@764 | 287 | ( cd $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj |
michael@764 | 288 | cp %{SOURCE Gemfile.lock} . |
michael@764 | 289 | echo 'gem "thin"' >>Gemfile |
michael@764 | 290 | cp config/configuration.yml.example config/configuration.yml |
michael@764 | 291 | cp config/additional_environment.rb.example config/additional_environment.rb |
michael@764 | 292 | echo "ENV['GEM_PATH'] = '%{l_prefix}/lib/ruby/gems/$RUBY_VERSION:%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION'" >>config/additional_environment.rb |
michael@765 | 293 | %{l_shtool} mkdir -f -p -m 755 .bundle # prime bundler with configuration |
michael@765 | 294 | echo 'BUNDLE_WITHOUT: test:de:development:postgres:mysql:rmagick' >.bundle/config |
michael@764 | 295 | cat >config/database.yml <<EOF |
michael@764 | 296 | production: |
michael@764 | 297 | adapter: sqlite3 |
michael@764 | 298 | database: db/prod.sqlite |
michael@764 | 299 | EOF |
michael@764 | 300 | ) || exit $? |
michael@764 | 301 | |
michael@764 | 302 | # install run command script |
michael@764 | 303 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@764 | 304 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@764 | 305 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@765 | 306 | -e "s;@l_chilipath@;%{l_prefix}/lib/chiliproj;" \ |
michael@765 | 307 | -e "s;@l_gempath@;%{l_prefix}/lib/ruby/gems/$RUBY_VERSION;" \ |
michael@764 | 308 | %{SOURCE rc.chiliproj} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@764 | 309 | |
michael@764 | 310 | # clean up white spaces |
michael@764 | 311 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION/gems/rdoc-*/test |
michael@764 | 312 | |
michael@764 | 313 | # problem with typical name 'files', existing in this case |
michael@764 | 314 | %{l_rpmtool} files -v -oaltfiles -r$RPM_BUILD_ROOT \ |
michael@764 | 315 | %{l_files_std} \ |
michael@765 | 316 | '%config %{l_prefix}/lib/chiliproj/config/*' \ |
michael@765 | 317 | '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/files' \ |
michael@765 | 318 | '%attr(664,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/files/*' \ |
michael@765 | 319 | '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/log' \ |
michael@765 | 320 | '%attr(664,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/log/*' \ |
michael@765 | 321 | '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/tmp' \ |
michael@765 | 322 | '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/tmp/*' \ |
michael@765 | 323 | '%attr(664,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/tmp/test/*' \ |
michael@765 | 324 | '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/public/plugin_assets' \ |
michael@765 | 325 | '%attr(664,%{l_nusr},%{l_ngrp}) %{l_prefix}/lib/chiliproj/public/plugin_assets/*' \ |
michael@765 | 326 | '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/chiliproj' |
michael@764 | 327 | |
michael@764 | 328 | %files -f altfiles |
michael@765 | 329 | # problem with typical name 'files' which preexists |
michael@764 | 330 | |
michael@764 | 331 | %clean |
michael@764 | 332 | |
michael@764 | 333 | %post |
michael@764 | 334 | if [ $1 -eq 1 ]; then |
michael@764 | 335 | RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` |
michael@764 | 336 | ( cd $RPM_INSTALL_PREFIX/lib/chiliproj |
michael@764 | 337 | # install session |
michael@765 | 338 | echo 'Creating ChiliProject session key...' |
michael@764 | 339 | $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
michael@764 | 340 | exec rake generate_session_store |
michael@764 | 341 | # create initial database |
michael@765 | 342 | echo 'Creating ChiliProject initial database...' |
michael@764 | 343 | RAILS_ENV=production \ |
michael@764 | 344 | $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
michael@765 | 345 | exec rake db:migrate >/dev/null |
michael@764 | 346 | # insert default configuration into database |
michael@765 | 347 | echo 'Populating ChiliProject initial database...' |
michael@764 | 348 | echo 'en' | \ |
michael@764 | 349 | RAILS_ENV=production \ |
michael@764 | 350 | $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
michael@765 | 351 | exec rake redmine:load_default_data >/dev/null |
michael@765 | 352 | # correct permissions of generated files |
michael@765 | 353 | chown %{l_nusr}:%{l_mgrp} \ |
michael@765 | 354 | $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ |
michael@765 | 355 | $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ |
michael@765 | 356 | $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ |
michael@765 | 357 | $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* |
michael@765 | 358 | chown opsw-n db db/* db/migrate/* |
michael@765 | 359 | chmod 0664 \ |
michael@765 | 360 | $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ |
michael@765 | 361 | $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ |
michael@765 | 362 | $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ |
michael@765 | 363 | $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* |
michael@764 | 364 | ) || exit $? |
michael@764 | 365 | fi |
michael@765 | 366 | # after upgrade, restart service |
michael@765 | 367 | [ $1 -eq 2 ] || exit 0 |
michael@765 | 368 | eval `%{l_rc} chiliproj status 2>/dev/null` |
michael@765 | 369 | [ ".$chiliproj_active" = .yes ] && %{l_rc} chiliproj restart |
michael@765 | 370 | exit 0 |
michael@764 | 371 | |
michael@765 | 372 | %preun |
michael@765 | 373 | # before erase, stop service and remove log files |
michael@765 | 374 | [ $1 -eq 0 ] || exit 0 |
michael@765 | 375 | %{l_rc} chiliproj stop 2>/dev/null |
michael@765 | 376 | rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/db 2>/dev/null || true |
michael@765 | 377 | rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/public 2>/dev/null || true |
michael@765 | 378 | rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers 2>/dev/null || true |
michael@765 | 379 | rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/log 2>/dev/null || true |
michael@765 | 380 | rm -f $RPM_INSTALL_PREFIX/var/chiliproj/*.log 2>/dev/null || true |
michael@765 | 381 | rm -f $RPM_INSTALL_PREFIX/var/chiliproj/*.pid 2>/dev/null || true |
michael@765 | 382 | exit 0 |
michael@765 | 383 |