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: %{l_prefix}/lib/ruby/gems/1.9.1/bin/rake -T (or -D) |
25 # FIXME: Reduce %post by removing RAILS_ENV=production |
26 # FIXME: Reduce %post by removing RAILS_ENV=production |
26 # FIXME: Consider using imagemagick for Gantt? |
27 # FIXME: Consider using imagemagick for Gantt? |
27 # FIXME: bundle exec rails s |
28 # FIXME: bundle exec rails s |
28 # FIXME: w3m http://localhost:3000/ |
29 # FIXME: w3m http://localhost:3000/ |
29 # FIXME: log in with Login: admin and Password: admin |
30 # FIXME: log in with Login: admin and Password: admin |
335 RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` |
339 RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` |
336 ( cd $RPM_INSTALL_PREFIX/lib/chiliproj |
340 ( cd $RPM_INSTALL_PREFIX/lib/chiliproj |
337 # install session |
341 # install session |
338 echo 'Creating ChiliProject session key...' |
342 echo 'Creating ChiliProject session key...' |
339 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
343 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
340 exec rake generate_session_store |
344 exec rake -s generate_session_store |
341 # create initial database |
345 # create initial database |
342 echo 'Creating ChiliProject initial database...' |
346 echo 'Creating ChiliProject data schemas...' |
343 RAILS_ENV=production \ |
347 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
344 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
348 exec rake db:migrate \ |
345 exec rake db:migrate >/dev/null |
349 RAILS_ENV=production VERBOSE=false |
|
350 #echo 'Creating ChiliProject initial database...' |
|
351 #$RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
|
352 # exec rake db:setup >/dev/null 2>&1 \ |
|
353 # exec rake -s db:create \ |
|
354 # RAILS_ENV=production |
346 # insert default configuration into database |
355 # insert default configuration into database |
347 echo 'Populating ChiliProject initial database...' |
356 echo 'Populating ChiliProject initial database...' |
348 echo 'en' | \ |
357 echo 'en' | \ |
349 RAILS_ENV=production \ |
358 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
350 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
359 exec rake redmine:load_default_data >/dev/null \ |
351 exec rake redmine:load_default_data >/dev/null |
360 RAILS_ENV=production |
352 # correct permissions of generated files |
361 # correct permissions of generated files |
353 chown %{l_nusr}:%{l_mgrp} \ |
362 chown %{l_nusr}:%{l_mgrp} \ |
354 $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ |
363 $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ |
355 $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ |
364 $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ |
|
365 $RPM_INSTALL_PREFIX/lib/chiliproj/db \ |
356 $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ |
366 $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ |
357 $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* |
367 $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* |
358 chown opsw-n db db/* db/migrate/* |
|
359 chmod 0664 \ |
368 chmod 0664 \ |
360 $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ |
369 $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ |
361 $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ |
370 $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ |
362 $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ |
371 $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ |
363 $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* |
372 $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* |
|
373 chmod 0775 \ |
|
374 $RPM_INSTALL_PREFIX/lib/chiliproj/db \ |
|
375 $RPM_INSTALL_PREFIX/lib/chiliproj/db/migrate |
364 ) || exit $? |
376 ) || exit $? |
365 echo 'ChiliProject installation done.' |
377 echo 'ChiliProject postinstallation finished.' |
366 fi |
378 fi |
367 # after upgrade, restart service |
379 # after upgrade, restart service |
368 [ $1 -eq 2 ] || exit 0 |
380 [ $1 -eq 2 ] || exit 0 |
|
381 RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` |
|
382 ( cd $RPM_INSTALL_PREFIX/lib/chiliproj |
|
383 ## migrate existing database |
|
384 #echo 'Migrating ChiliProject existing database...' |
|
385 #VERBOSE=false RAILS_ENV=production \ |
|
386 # $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ |
|
387 # exec rake db:migrate |
|
388 ) || exit $? |
369 eval `%{l_rc} chiliproj status 2>/dev/null` |
389 eval `%{l_rc} chiliproj status 2>/dev/null` |
370 [ ".$chiliproj_active" = .yes ] && %{l_rc} chiliproj restart |
390 [ ".$chiliproj_active" = .yes ] && %{l_rc} chiliproj restart |
371 exit 0 |
391 exit 0 |
372 |
392 |
373 %preun |
393 %preun |