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