postinst revision 6294
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster#!/bin/bash
0a99555401a033704f1f171baab6db11fb5528f2Allan Fosterset -e
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# Post install script
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# Install is launched with an empty second arg.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# If the package is already installed,
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# the second arg. is not empty.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# In this case, we are in upgrade mode.
0a99555401a033704f1f171baab6db11fb5528f2Allan Fosterif [ "$1" = "configure" ] && [ ! -z "$2" ]
0a99555401a033704f1f171baab6db11fb5528f2Allan Fosterthen
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# For being secure, we check the buildinfo file too.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster if [ -f @prefix@/config/buildinfo ]
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster then
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster echo *Starting upgrade...
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster @prefix@/./upgrade -n --acceptLicense
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster echo
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# Upgrade fails - Requires mandatory user interaction.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# Nevertheless, exits successfully of the pkg process.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster if [ "$?" -eq 2 ]
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster then
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster exit 0
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster fi
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# Restarts the service if needed.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# If server is stopped by upgrade process,
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# the server will restart after upgrade.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# If server is stopped before the upgrade process
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# (eg. upgrade the new package), the server will not restart.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# Uses the flag for determining server status at this point.
138bee0c3c0ebe21d90df485b72cd2b500bbdaf4Andrew Forrest if [ "$?" -eq 0 ]
f0471ca3f61b8f21f40d834a1737064f4a06b6edMark de Reeper then
f781d802a8636144751a19912978388cb49b5360Rich Riley if [ -f @prefix@/logs/status ]
f781d802a8636144751a19912978388cb49b5360Rich Riley then
79943d71bcf8d4933e74f29a1b0e87f8898508cbPeter Major echo
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster echo "*Restarting server..."
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster @prefix@/./bin/start-ds
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster rm -f @prefix@/logs/status
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster fi
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster fi
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster else
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# Invalid installation, could not find the buildinfo file.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster echo "Invalid installation, could not find the build info file."
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster exit -1
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster fi
0a99555401a033704f1f171baab6db11fb5528f2Allan Fosterfi
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster# End post install script
0a99555401a033704f1f171baab6db11fb5528f2Allan Fosterecho