postinst revision 054848749d97535e9e1d5da4504079ac684f141b
1cd2872b696c4bdfb7694da53883d02de3360e12violette#!/bin/bash
a5b9f8fb834b1b2208e59a2fa76714bd91a5f147violetteset -e
a5b9f8fb834b1b2208e59a2fa76714bd91a5f147violette# Post install script
1cd2872b696c4bdfb7694da53883d02de3360e12violette# Install is launched with an empty second arg.
1cd2872b696c4bdfb7694da53883d02de3360e12violette# If the package is already installed,
1cd2872b696c4bdfb7694da53883d02de3360e12violette# the second arg. is not empty.
1cd2872b696c4bdfb7694da53883d02de3360e12violette# In this case, we are in upgrade mode.
1cd2872b696c4bdfb7694da53883d02de3360e12violetteif [ "$1" = "configure" ] && [ ! -z "$2" ]
1cd2872b696c4bdfb7694da53883d02de3360e12violettethen
1cd2872b696c4bdfb7694da53883d02de3360e12violette# For being secure, we check the buildinfo file too.
1cd2872b696c4bdfb7694da53883d02de3360e12violette if [ -f @prefix@/config/buildinfo ]
1cd2872b696c4bdfb7694da53883d02de3360e12violette then
1cd2872b696c4bdfb7694da53883d02de3360e12violette echo *Starting upgrade...
1cd2872b696c4bdfb7694da53883d02de3360e12violette @prefix@/./upgrade -n
1cd2872b696c4bdfb7694da53883d02de3360e12violette echo
1cd2872b696c4bdfb7694da53883d02de3360e12violette# Upgrade fails - Requires mandatory user interaction.
054848749d97535e9e1d5da4504079ac684f141bviolette# Nevertheless, exits successfully of the pkg process.
1cd2872b696c4bdfb7694da53883d02de3360e12violette if [ "$?" -eq 2 ]
1cd2872b696c4bdfb7694da53883d02de3360e12violette then
1cd2872b696c4bdfb7694da53883d02de3360e12violette exit 0
1cd2872b696c4bdfb7694da53883d02de3360e12violette fi
054848749d97535e9e1d5da4504079ac684f141bviolette# Restarts the service if needed.
054848749d97535e9e1d5da4504079ac684f141bviolette# If server is stopped by upgrade process,
054848749d97535e9e1d5da4504079ac684f141bviolette# the server will restart after upgrade.
1cd2872b696c4bdfb7694da53883d02de3360e12violette# If server is stopped before the upgrade process
1cd2872b696c4bdfb7694da53883d02de3360e12violette# (eg. upgrade the new package), the server will not restart.
1cd2872b696c4bdfb7694da53883d02de3360e12violette# Uses the flag for determining server status at this point.
1cd2872b696c4bdfb7694da53883d02de3360e12violette if [ "$?" -eq 0 ]
1cd2872b696c4bdfb7694da53883d02de3360e12violette then
1cd2872b696c4bdfb7694da53883d02de3360e12violette if [ -f @prefix@/logs/status ]
1cd2872b696c4bdfb7694da53883d02de3360e12violette then
1cd2872b696c4bdfb7694da53883d02de3360e12violette echo
1cd2872b696c4bdfb7694da53883d02de3360e12violette echo "*Restarting server..."
1cd2872b696c4bdfb7694da53883d02de3360e12violette @prefix@/./bin/start-ds
1cd2872b696c4bdfb7694da53883d02de3360e12violette rm -f @prefix@/logs/status
1cd2872b696c4bdfb7694da53883d02de3360e12violette fi
1cd2872b696c4bdfb7694da53883d02de3360e12violette fi
1cd2872b696c4bdfb7694da53883d02de3360e12violette else
1cd2872b696c4bdfb7694da53883d02de3360e12violette# Invalid installation, could not find the buildinfo file.
1cd2872b696c4bdfb7694da53883d02de3360e12violette exit 0
1cd2872b696c4bdfb7694da53883d02de3360e12violette fi
1cd2872b696c4bdfb7694da53883d02de3360e12violettefi
a5b9f8fb834b1b2208e59a2fa76714bd91a5f147violette# End post install script
a5b9f8fb834b1b2208e59a2fa76714bd91a5f147violetteecho