1344N/A#!/bin/bash
1344N/Aset -e
1344N/A# Post install script
1344N/A# Install is launched with an empty second arg.
1344N/A# If the package is already installed,
1344N/A# the second arg. is not empty.
1344N/A# Registers the service
1344N/Aupdate-rc.d opendj defaults
1344N/A# Symlinks to process ID
1344N/Atest -h "/var/run/opendj.pid" || ln -s /opt/opendj/logs/server.pid /var/run/opendj.pid
1344N/A# In this case, we are in upgrade mode.
1344N/Aif [ "$1" = "configure" ] && [ ! -z "$2" ]
1344N/Athen
1344N/A# For being secure, we check the buildinfo file too.
1344N/A if [ -f @prefix@/config/buildinfo ]
1344N/A then
1344N/A echo *Starting upgrade...
1344N/A @prefix@/./upgrade -n --acceptLicense
1344N/A echo
1344N/A# Upgrade fails - Requires mandatory user interaction.
1344N/A# Nevertheless, exits successfully of the pkg process.
1344N/A if [ "$?" -eq 2 ]
1344N/A then
1344N/A exit 0
3231N/A fi
6238N/A# Restarts the service if needed.
1344N/A# If server is stopped by upgrade process,
1344N/A# the server will restart after upgrade.
1344N/A# If server is stopped before the upgrade process
1344N/A# (eg. upgrade the new package), the server will not restart.
1344N/A# Uses the flag for determining server status at this point.
1344N/A if [ "$?" -eq 0 ]
1344N/A then
1344N/A if [ -f @prefix@/logs/status ]
6238N/A then
1344N/A echo
6238N/A echo "*Restarting server..."
1344N/A @prefix@/./bin/start-ds
1344N/A rm -f @prefix@/logs/status
6238N/A fi
1344N/A fi
1344N/A else
1344N/A# Invalid installation, could not find the buildinfo file.
1344N/A echo "Invalid installation, could not find the build info file."
1344N/A exit -1
1344N/A fi
1344N/Afi
1344N/A# End post install script
6238N/Aecho