postinst revision e75c2484bff064fbbf51e92aed4f37b08e6427b7
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews#!/bin/bash
205c10066a0acfeac52d1a135671f41d207b8557Automatic Updaterset -e
205c10066a0acfeac52d1a135671f41d207b8557Automatic Updater# Post install script
1167fc7904c5f0a472f8df207ac46dd52c7f1ec8Automatic Updater# Install is launched with an empty second arg.
0c39b3ed9409ecb277d5e32fa763a4e4d6598df8Automatic Updater# If the package is already installed,
46da3117812814a29432a8d9a9ccf8acdbfdadceAutomatic Updater# the second arg. is not empty.
2bb3422dc683c013db7042f5736240de6b86f182Automatic Updater# In this case, we are in upgrade mode.
cd0aa2d941d1438fabb5337f1f38c49478edf71dAutomatic Updaterif [ "$1" = "configure" ] && [ ! -z "$2" ]
90ff38a0d8deaf5f9c2aa5916d99b2e572d28738Automatic Updaterthen
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# For being secure, we check the buildinfo file too.
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews if [ -f @prefix@/config/buildinfo ]
6c6a121295b30772cbf3dd75a51fb9d883051a0eAutomatic Updater then
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington echo *Starting upgrade...
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater @prefix@/./upgrade -n --acceptLicense
e171a4137c6ba348957e61b7c4c3541493c0da02Automatic Updater echo
e171a4137c6ba348957e61b7c4c3541493c0da02Automatic Updater# Upgrade fails - Requires mandatory user interaction.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Nevertheless, exits successfully of the pkg process.
58be84825d7f5de30e50eb7206b37227ecd8055bAutomatic Updater if [ "$?" -eq 2 ]
3cc98b8ecedcbc8465f1cf2740b966b315662430Automatic Updater then
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews exit 0
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews fi
e171a4137c6ba348957e61b7c4c3541493c0da02Automatic Updater# Restarts the service if needed.
831f79c4310a7d38fc3475ccfff531b2b2535641Automatic Updater# If server is stopped by upgrade process,
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# the server will restart after upgrade.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# If server is stopped before the upgrade process
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# (eg. upgrade the new package), the server will not restart.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# Uses the flag for determining server status at this point.
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson if [ "$?" -eq 0 ]
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater then
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater if [ -f @prefix@/logs/status ]
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson then
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater echo
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater echo "*Restarting server..."
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater @prefix@/./bin/start-ds
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt rm -f @prefix@/logs/status
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater fi
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater fi
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt else
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# Invalid installation, could not find the buildinfo file.
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater echo "Invalid installation, could not find the build info file."
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater exit -1
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt fi
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updaterfi
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updater# End post install script
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Huntecho