3
. /usr/share/debconf/confmodule
7
echo $(basename $0 .postinst)
10
# element() is a helper function for file-rc:
12
local element list IFS
16
[ "$2" = "in" ] && shift
18
[ "$list" = "-" ] && return 1
19
[ "$list" = "*" ] && return 0
24
"$1"|"$2"|"$3"|"$4"|"$5"|"$6"|"$7"|"$8"|"$9")
30
# filerc (runlevel, service) returns /etc/init.d/service, if service is
31
# running in $runlevel:
33
local runlevel basename
43
SORT_NO="$1"; STOP="$2"; START="$3"; CMD="$4"
44
[ "$CMD" = "/etc/init.d/$basename" ] || continue
46
if element "$runlevel" in "$START" || element "S" in "$START"
48
echo "/etc/init.d/$basename"
51
done < /etc/runlevel.conf
55
if [ "$1" = "configure" ]
58
if dpkg --compare-versions $2 lt 0.9.7d-1; then
59
echo -n "Checking for services that may need to be restarted..."
62
check="$check apache2-common ssh-nonfree exim4"
63
check="$check apache-ssl libapache-mod-ssl openvpn spamassassin"
64
check="$check courier-imap-ssl courier-mta-ssl courier-pop-ssl"
65
check="$check postfix-tls cyrus21-imapd cyrus21-pop3d"
66
check="$check postgresql racoon"
67
# Only get the ones that are installed, and configured
68
check=$(dpkg -s $check 2> /dev/null | sed '/^$/{N;/^\n$/D;}' | awk 'BEGIN{RS="\n\n";FS="\n"}{if ( $2 ~ /Status: .* installed$/ ) { print $1 } }' | cut -f 2 -d ' ')
69
# apache2 ships its init script in apache2-common, but the
71
check=$(echo $check | sed 's/apache2-common/apache2/g')
72
# For mod-ssl apache has to be restarted
73
check=$(echo $check | sed 's/libapache-mod-ssl/apache/g')
74
rl=$(runlevel | awk '{print $2}')
75
for service in $check; do
76
if [ -f /usr/share/file-rc/rc -o -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
77
idl=$(filerc $rl $service)
79
idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -n 1)
81
if [ -n "$idl" ] && [ -x $idl ]; then
82
services="$service $services"
86
if [ -n "$services" ]; then
89
db_reset libssl0.9.7/restart-services
90
db_set libssl0.9.7/restart-services "$services"
91
db_input critical libssl0.9.7/restart-services || true
93
db_get libssl0.9.7/restart-services
94
# Arghhh, close all the stupid debconf pipes
105
if [ "$answer" = yes ] && [ "$services" != "" ]; then
106
echo "Restarting services possibly affected by the upgrade:"
108
for service in $services; do
109
idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -n 1)
110
echo -n " $service: stopping..."
111
$idl stop > /dev/null 2>&1 || true
113
echo -n "starting..."
114
if $idl start > /dev/null 2>&1; then
118
failed="$service $failed"
122
if [ -n "$failed" ]; then
124
echo "The following services failed to start: $failed"
126
echo "You will need to start these manually by running \`/etc/init.d/<service> start'"
127
echo "If the service still fails to start, you may need to file a bug on"
128
echo "$(package_name) or the service involved."
130
echo "Services restarted successfully."
135
fi # end upgrading and $2 lt 0.9.7c-1