diff -r b3f4be54aeb4 -r 5be956b2db74 chiliproj/chiliproj.spec --- a/chiliproj/chiliproj.spec Sun Mar 31 17:55:10 2013 +0200 +++ b/chiliproj/chiliproj.spec Mon Apr 01 19:50:38 2013 +0200 @@ -22,6 +22,8 @@ ## # 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 +# FIXME: Reduce %post by removing RAILS_ENV=production +# FIXME: Consider using imagemagick for Gantt? # FIXME: bundle exec rails s # FIXME: w3m http://localhost:3000/ # FIXME: log in with Login: admin and Password: admin @@ -64,7 +66,7 @@ Class: EVAL Group: Calendar License: GPL -Version: 20130328 +Version: 20130401 Release: 20120800 # list of sources @@ -253,7 +255,8 @@ RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` export GEM_HOME=$RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION %{l_shtool} mkdir -f -p -m 755 $GEM_HOME - %{l_shtool} mkdir -f -p public/plugin_assets + %{l_shtool} mkdir -f -p $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/public/plugin_assets + %{l_shtool} mkdir -f -p $RPM_BUILD_ROOT%{l_prefix}/var/chiliproj %{l_tar} cf - . | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj %{l_prefix}/bin/gem install --local %{SOURCE3} %{l_prefix}/bin/gem install --local %{SOURCE4} @@ -282,30 +285,26 @@ # install configuration ( cd $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj - %{l_shtool} mkdir -f -p -m 755 .bundle cp %{SOURCE Gemfile.lock} . echo 'gem "thin"' >>Gemfile cp config/configuration.yml.example config/configuration.yml cp config/additional_environment.rb.example config/additional_environment.rb echo "ENV['GEM_PATH'] = '%{l_prefix}/lib/ruby/gems/$RUBY_VERSION:%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION'" >>config/additional_environment.rb - #echo 'config.action_controller.session = { :key => "_chiliproject_session", :secret => "54bbf51a99cbce2a8881af4fa0fa23895e071f8c8c4773e76b09388135bd9d3671534bf4db20c9f3" }' >>config/additional_environment.rb + %{l_shtool} mkdir -f -p -m 755 .bundle # prime bundler with configuration + echo 'BUNDLE_WITHOUT: test:de:development:postgres:mysql:rmagick' >.bundle/config cat >config/database.yml <.bundle/config </dev/null # insert default configuration into database + echo 'Populating ChiliProject initial database...' echo 'en' | \ RAILS_ENV=production \ $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ - exec rake redmine:load_default_data + exec rake redmine:load_default_data >/dev/null + # correct permissions of generated files + chown %{l_nusr}:%{l_mgrp} \ + $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ + $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ + $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ + $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* +chown opsw-n db db/* db/migrate/* + chmod 0664 \ + $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ + $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ + $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ + $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* ) || exit $? fi - if [ $1 -eq 2 ]; then - # after upgrade - echo NOOP - fi + # after upgrade, restart service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} chiliproj status 2>/dev/null` + [ ".$chiliproj_active" = .yes ] && %{l_rc} chiliproj restart + exit 0 +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} chiliproj stop 2>/dev/null + rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/db 2>/dev/null || true + rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/public 2>/dev/null || true + rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers 2>/dev/null || true + rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/log 2>/dev/null || true + rm -f $RPM_INSTALL_PREFIX/var/chiliproj/*.log 2>/dev/null || true + rm -f $RPM_INSTALL_PREFIX/var/chiliproj/*.pid 2>/dev/null || true + exit 0 +