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 46
|
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
TRYTON_CONFDIR="/etc/tryton"
TRYTON_CONFFILE="${TRYTON_CONFDIR}/trytond.conf"
TRYTON_CONFNEW=
# POSIX-compliant shell function to check for the existence of a command
# s. developers-reference 6.4
pathfind() {
OLDIFS="$IFS"
IFS=:
for p in $PATH; do
if [ -x "$p/$*" ]; then
IFS="$OLDIFS"
return 0
fi
done
IFS="$OLDIFS"
return 1
}
case "$1" in
remove)
# restore original connection settings, i.e. disable any active postgresql uris
TRYTON_CONFNEW=$(mktemp)
cp -a "$TRYTON_CONFFILE" "$TRYTON_CONFNEW"
sed -i -e '/^\[database\]$/,/^\[.*\]$/s|^\(uri = postgresql://\)\(.*\)|#\1tryton:tryton@localhost:5432/|' "$TRYTON_CONFNEW"
# register new config file
if pathfind ucf; then
ucf --debconf-ok --src-dir "$TRYTON_SHAREDIR/default/" "$TRYTON_CONFNEW" "$TRYTON_CONFFILE"
fi
;;
purge)
;;
esac
#DEBHELPER#
exit 0
|