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

Violette Roche-Montane
30.49.2013 ae5dd4eea2a546a85db2f4c440c05c165ca10524
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
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.
# 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 @prefix@/config/buildinfo ]
  then
    echo *Starting upgrade...
    @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 @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