mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Gaetan Boismal
11.30.2015 ab1f8ae8e6113819e9c7ddd83eea69d9a9133dd8
opendj-server-legacy/resource/debian/control/postinst
@@ -28,48 +28,43 @@
set -e
# Post install script
# Install is launched with an empty second arg.
# If the package is already installed,
#  the second arg. is not empty.
# If the package is already installed, the second arg. is not empty.
# Registers the service
update-rc.d opendj defaults
# Symlinks to process ID
test -h "/var/run/opendj.pid" || ln -s ${deb.prefix}/logs/server.pid /var/run/opendj.pid
# In this case, we are in upgrade mode.
if [ "$1" = "configure" ] && [ ! -z "$2" ]
then
# For being secure, we check the buildinfo file too.
  if [ -f ${deb.prefix}/config/buildinfo ]
  then
    echo *Starting upgrade...
    ${deb.prefix}/./upgrade -n --acceptLicense
    echo
# Upgrade fails - Requires mandatory user interaction.
# Nevertheless, exits successfully of the pkg process.
    if [ "$?" -eq 2 ]
    then
      exit 0
    fi
# Restarts the service if needed.
# If server is stopped by upgrade process,
#  the server will restart after upgrade.
# If server is stopped before the upgrade process
#  (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 ${deb.prefix}/logs/status ]
      then
if [ "$1" = "configure" ] && [ ! -z "$2" ] ; then
    # For being secure, we check the buildinfo file too.
    if [ -f ${deb.prefix}/config/buildinfo ] ; then
        echo *Starting upgrade...
        ${deb.prefix}/./upgrade -n --acceptLicense
        echo
        echo "*Restarting server..."
        ${deb.prefix}/./bin/start-ds
        rm -f ${deb.prefix}/logs/status
      fi
        if [ "$?" -eq 2 ] ; then
            # Upgrade fails - Requires mandatory user interaction.
            # Nevertheless, exits successfully of the pkg process.
            exit 0
        fi
        if [ "$?" -eq 0 ] ; then
            # Restarts the service if needed.
            # If server is stopped by upgrade process, the server will restart after upgrade.
            # If server is stopped before the upgrade process (eg. upgrade the new package), the server will not restart.
            # Uses the flag for determining server status at this point.
            if [ -f ${deb.prefix}/logs/status ] ; then
                echo
                echo "*Restarting server..."
                ${deb.prefix}/./bin/start-ds
                rm -f ${deb.prefix}/logs/status
            fi
        fi
    else
        echo "Invalid installation, could not find the build info file."
        exit -1
    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