Commit 38e1816c9fbc079f847242d8b5c59f233604c698

Authored by Antonio Terceiro
1 parent e0131ecf

Support Lenny → Squeeze upgrades

Showing 2 changed files with 34 additions and 5 deletions   Show diff stats
debian/changelog
@@ -7,8 +7,13 @@ noosfero (0.35.2~1) unstable; urgency=low @@ -7,8 +7,13 @@ noosfero (0.35.2~1) unstable; urgency=low
7 mail-transport-agent. 7 mail-transport-agent.
8 * /usr/share/dbconfig-common/scripts/noosfero/install/pgsql: run db:migrate 8 * /usr/share/dbconfig-common/scripts/noosfero/install/pgsql: run db:migrate
9 just after db:schema:load. 9 just after db:schema:load.
  10 + * etc/init.d/noosfero: forward fix for the Lenny → Squeeze upgrade. In
  11 + Squeeze, `rails` is an empty package that depends on rails-ruby1.8, but
  12 + rails-ruby1.8 is only unpacked *after* noosfero prerm runs. This way, the
  13 + initscript must be able to stop the services without any of the Rails
  14 + libraries available.
10 15
11 - -- Antonio Terceiro <terceiro@colivre.coop.br> Wed, 29 Feb 2012 15:22:48 -0300 16 + -- Antonio Terceiro <terceiro@colivre.coop.br> Thu, 01 Mar 2012 14:37:15 -0300
12 17
13 noosfero (0.35.1) unstable; urgency=low 18 noosfero (0.35.1) unstable; urgency=low
14 19
script/production
@@ -37,10 +37,34 @@ do_start() { @@ -37,10 +37,34 @@ do_start() {
37 } 37 }
38 38
39 do_stop() { 39 do_stop() {
40 - mongrel_rails cluster::stop  
41 - ./script/delayed_job stop  
42 - ./script/feed-updater stop  
43 - ./script/ferret_server -e $RAILS_ENV stop 40 +
  41 + # During Debian upgrades, it is possible that rails is not available (e.g.
  42 + # Lenny -> Squeeze), so the programs below might fail. If they do, we fall
  43 + # back to stopping the daemons by manually reading their PID files, killing
  44 + # them and wiping the PID files.
  45 +
  46 + mongrel_rails cluster::stop ||
  47 + stop_via_pid_file tmp/pids/mongrel.*.pid
  48 +
  49 + ./script/delayed_job stop ||
  50 + stop_via_pid_file tmp/pids/delayed_job.pid
  51 +
  52 + ./script/feed-updater stop ||
  53 + stop_via_pid_file tmp/pids/feed-updater.default.pid
  54 +
  55 + ./script/ferret_server -e $RAILS_ENV stop ||
  56 + stop_via_pid_file tmp/pids/ferret.production.pid
  57 +}
  58 +
  59 +stop_via_pid_file() {
  60 + for pidfile in $@; do
  61 + if [ -e "$pidfile" ]; then
  62 + pid=$(cat $pidfile)
  63 + echo "Sentign TERM signal to stop $pid ..."
  64 + kill -TERM "$pid"
  65 + rm -f $pidfile
  66 + fi
  67 + done
44 } 68 }
45 69
46 environments_loop() { 70 environments_loop() {