chiliproj/chiliproj.spec

changeset 765
5be956b2db74
parent 764
b3f4be54aeb4
child 766
fd2bc92f4dee
equal deleted inserted replaced
0:6ecad3d0d1cd 1:6581e089a701
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE. 21 ## SUCH DAMAGE.
22 ## 22 ##
23 23
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 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
25 # FIXME: Reduce %post by removing RAILS_ENV=production
26 # FIXME: Consider using imagemagick for Gantt?
25 # FIXME: bundle exec rails s 27 # FIXME: bundle exec rails s
26 # FIXME: w3m http://localhost:3000/ 28 # FIXME: w3m http://localhost:3000/
27 # FIXME: log in with Login: admin and Password: admin 29 # FIXME: log in with Login: admin and Password: admin
28 30
29 # package version 31 # package version
62 Packager: Michael Schloh von Bennewitz 64 Packager: Michael Schloh von Bennewitz
63 Distribution: Europalab Networks Production 65 Distribution: Europalab Networks Production
64 Class: EVAL 66 Class: EVAL
65 Group: Calendar 67 Group: Calendar
66 License: GPL 68 License: GPL
67 Version: 20130328 69 Version: 20130401
68 Release: 20120800 70 Release: 20120800
69 71
70 # list of sources 72 # list of sources
71 Source0: http://www.chiliproject.org/attachments/download/%{V_pref}/chiliproject-%{version}.tar.bz2 73 Source0: http://www.chiliproject.org/attachments/download/%{V_pref}/chiliproject-%{version}.tar.bz2
72 Source1: rc.chiliproj 74 Source1: rc.chiliproj
251 253
252 %install 254 %install
253 RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` 255 RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'`
254 export GEM_HOME=$RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION 256 export GEM_HOME=$RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION
255 %{l_shtool} mkdir -f -p -m 755 $GEM_HOME 257 %{l_shtool} mkdir -f -p -m 755 $GEM_HOME
256 %{l_shtool} mkdir -f -p public/plugin_assets 258 %{l_shtool} mkdir -f -p $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/public/plugin_assets
259 %{l_shtool} mkdir -f -p $RPM_BUILD_ROOT%{l_prefix}/var/chiliproj
257 %{l_tar} cf - . | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj 260 %{l_tar} cf - . | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj
258 %{l_prefix}/bin/gem install --local %{SOURCE3} 261 %{l_prefix}/bin/gem install --local %{SOURCE3}
259 %{l_prefix}/bin/gem install --local %{SOURCE4} 262 %{l_prefix}/bin/gem install --local %{SOURCE4}
260 %{l_prefix}/bin/gem install --local %{SOURCE5} 263 %{l_prefix}/bin/gem install --local %{SOURCE5}
261 %{l_prefix}/bin/gem install --local %{SOURCE6} 264 %{l_prefix}/bin/gem install --local %{SOURCE6}
280 %{l_prefix}/bin/gem install --local %{SOURCE25} 283 %{l_prefix}/bin/gem install --local %{SOURCE25}
281 %{l_prefix}/bin/gem install --local %{SOURCE27} 284 %{l_prefix}/bin/gem install --local %{SOURCE27}
282 285
283 # install configuration 286 # install configuration
284 ( cd $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj 287 ( cd $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj
285 %{l_shtool} mkdir -f -p -m 755 .bundle
286 cp %{SOURCE Gemfile.lock} . 288 cp %{SOURCE Gemfile.lock} .
287 echo 'gem "thin"' >>Gemfile 289 echo 'gem "thin"' >>Gemfile
288 cp config/configuration.yml.example config/configuration.yml 290 cp config/configuration.yml.example config/configuration.yml
289 cp config/additional_environment.rb.example config/additional_environment.rb 291 cp config/additional_environment.rb.example config/additional_environment.rb
290 echo "ENV['GEM_PATH'] = '%{l_prefix}/lib/ruby/gems/$RUBY_VERSION:%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION'" >>config/additional_environment.rb 292 echo "ENV['GEM_PATH'] = '%{l_prefix}/lib/ruby/gems/$RUBY_VERSION:%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION'" >>config/additional_environment.rb
291 #echo 'config.action_controller.session = { :key => "_chiliproject_session", :secret => "54bbf51a99cbce2a8881af4fa0fa23895e071f8c8c4773e76b09388135bd9d3671534bf4db20c9f3" }' >>config/additional_environment.rb 293 %{l_shtool} mkdir -f -p -m 755 .bundle # prime bundler with configuration
294 echo 'BUNDLE_WITHOUT: test:de:development:postgres:mysql:rmagick' >.bundle/config
292 cat >config/database.yml <<EOF 295 cat >config/database.yml <<EOF
293 production: 296 production:
294 adapter: sqlite3 297 adapter: sqlite3
295 database: db/prod.sqlite 298 database: db/prod.sqlite
296 EOF 299 EOF
297 # try this block with ---
298 cat >.bundle/config <<EOF
299 ---
300 BUNDLE_WITHOUT: test:de:development:postgres:mysql:rmagick
301 EOF
302 ) || exit $? 300 ) || exit $?
303 301
304 # install run command script 302 # install run command script
305 %{l_shtool} mkdir -f -p -m 755 \ 303 %{l_shtool} mkdir -f -p -m 755 \
306 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 304 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
307 %{l_shtool} install -c -m 755 %{l_value -s -a} \ 305 %{l_shtool} install -c -m 755 %{l_value -s -a} \
308 -e 's;@l_gempath@;$RPM_BUILD_ROOT%{l_prefix}/lib/ruby/gems/$RUBY_VERSION;g' \ 306 -e "s;@l_chilipath@;%{l_prefix}/lib/chiliproj;" \
307 -e "s;@l_gempath@;%{l_prefix}/lib/ruby/gems/$RUBY_VERSION;" \
309 %{SOURCE rc.chiliproj} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 308 %{SOURCE rc.chiliproj} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
310 309
311 # clean up white spaces 310 # clean up white spaces
312 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION/gems/rdoc-*/test 311 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION/gems/rdoc-*/test
313 312
314 # problem with typical name 'files', existing in this case 313 # problem with typical name 'files', existing in this case
315 %{l_rpmtool} files -v -oaltfiles -r$RPM_BUILD_ROOT \ 314 %{l_rpmtool} files -v -oaltfiles -r$RPM_BUILD_ROOT \
316 %{l_files_std} \ 315 %{l_files_std} \
317 '%config %{l_prefix}/lib/chiliproj/config/*' 316 '%config %{l_prefix}/lib/chiliproj/config/*' \
318 #'%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/files' \ 317 '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/files' \
319 #'%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/files/*' \ 318 '%attr(664,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/files/*' \
320 #'%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/log' \ 319 '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/log' \
321 #'%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/log/*' \ 320 '%attr(664,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/log/*' \
322 #'%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/tmp' \ 321 '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/tmp' \
323 #'%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/tmp/*' \ 322 '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/tmp/*' \
324 #'%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/public/plugin_assets' \ 323 '%attr(664,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/tmp/test/*' \
325 #'%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/lib/chiliproj/public/plugin_assets/*' 324 '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/lib/chiliproj/public/plugin_assets' \
325 '%attr(664,%{l_nusr},%{l_ngrp}) %{l_prefix}/lib/chiliproj/public/plugin_assets/*' \
326 '%attr(775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/chiliproj'
326 327
327 %files -f altfiles 328 %files -f altfiles
328 # problem with typical name 'files', existing in this case 329 # problem with typical name 'files' which preexists
329 330
330 %clean 331 %clean
331 332
332 %post 333 %post
333 if [ $1 -eq 1 ]; then 334 if [ $1 -eq 1 ]; then
334 RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` 335 RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'`
335 ( cd $RPM_INSTALL_PREFIX/lib/chiliproj 336 ( cd $RPM_INSTALL_PREFIX/lib/chiliproj
336 # install session 337 # install session
338 echo 'Creating ChiliProject session key...'
337 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ 339 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \
338 exec rake generate_session_store 340 exec rake generate_session_store
339 # create initial database 341 # create initial database
342 echo 'Creating ChiliProject initial database...'
340 RAILS_ENV=production \ 343 RAILS_ENV=production \
341 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ 344 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \
342 exec rake db:migrate 345 exec rake db:migrate >/dev/null
343 # insert default configuration into database 346 # insert default configuration into database
347 echo 'Populating ChiliProject initial database...'
344 echo 'en' | \ 348 echo 'en' | \
345 RAILS_ENV=production \ 349 RAILS_ENV=production \
346 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ 350 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \
347 exec rake redmine:load_default_data 351 exec rake redmine:load_default_data >/dev/null
352 # correct permissions of generated files
353 chown %{l_nusr}:%{l_mgrp} \
354 $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \
355 $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \
356 $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \
357 $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/*
358 chown opsw-n db db/* db/migrate/*
359 chmod 0664 \
360 $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \
361 $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \
362 $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \
363 $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/*
348 ) || exit $? 364 ) || exit $?
349 fi 365 fi
350 if [ $1 -eq 2 ]; then 366 # after upgrade, restart service
351 # after upgrade 367 [ $1 -eq 2 ] || exit 0
352 echo NOOP 368 eval `%{l_rc} chiliproj status 2>/dev/null`
353 fi 369 [ ".$chiliproj_active" = .yes ] && %{l_rc} chiliproj restart
354 370 exit 0
371
372 %preun
373 # before erase, stop service and remove log files
374 [ $1 -eq 0 ] || exit 0
375 %{l_rc} chiliproj stop 2>/dev/null
376 rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/db 2>/dev/null || true
377 rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/public 2>/dev/null || true
378 rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers 2>/dev/null || true
379 rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/log 2>/dev/null || true
380 rm -f $RPM_INSTALL_PREFIX/var/chiliproj/*.log 2>/dev/null || true
381 rm -f $RPM_INSTALL_PREFIX/var/chiliproj/*.pid 2>/dev/null || true
382 exit 0
383

mercurial