55
installed_services() {
58
# Only get the ones that are installed, and configured
59
check=$(dpkg -s $check 2> /dev/null | egrep '^Package:|^Status:' | awk '{if ($1 ~ /^Package:/) { package=$2 } else if ($0 ~ /^Status: .* installed$/) { print package }}')
61
# some init scripts don't match the package names
62
check=$(echo $check | \
63
sed -e's/\bapache2-common\b/apache2/g' \
65
-e's/\bdovecot-common\b/dovecot/g' \
66
-e's/\bdante-server\b/danted/g' \
67
-e's/\bexim4-base\b/exim4/g' \
68
-e's/\bheartbeat-2\b/heartbeat/g' \
69
-e's/\bhylafax-server\b/hylafax/g' \
70
-e's/\bpartimage-server\b/partimaged/g' \
71
-e's/\bsasl2-bin\b/saslauthd/g' \
74
for service in $check; do
75
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
76
idl=$(ls /etc/init.d/${service} 2> /dev/null | head -n 1)
77
if [ -n "$idl" ] && [ -x $idl ]; then
78
services="$service $services"
80
echo "WARNING: init script for $service not found." >&2
83
if [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
84
idl=$(filerc $rl $service)
86
idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -n 1)
88
if [ -n "$idl" ] && [ -x $idl ]; then
89
services="$service $services"
55
96
if [ "$1" = "configure" ]
57
98
if [ ! -z "$2" ]; then
58
99
if dpkg --compare-versions "$2" lt 0.99.7.1-3; then
59
102
echo -n "Checking for services that may need to be restarted..."
61
104
check="apache2-common at bayonne cherokee courier-authdaemon"
63
106
check="$check dante-server diald dovecot-common exim exim4-base"
64
107
check="$check fcron fireflier-server freeradius gdm heartbeat"
65
108
check="$check heartbeat-2 hylafax-server iiimf-server inn2"
66
check="$check kannel kdm linesrv linesrv-mysql lsh-server"
109
check="$check kannel linesrv linesrv-mysql lsh-server"
67
110
check="$check muddleftpd netatalk nuauth partimage-server"
68
111
check="$check perdition pgpool popa3d postgresql-7.4"
69
112
check="$check postgresql-8.1 postgresql-8.2 proftpd pure-ftpd"
70
113
check="$check pure-ftpd-ldap pure-ftpd-mysql"
71
114
check="$check pure-ftpd-postgresql racoon samba sasl2-bin"
72
115
check="$check sfs-server solid-pop3d squid squid3 tac-plus"
73
check="$check vsftpd wdm wu-ftpd wzdftpd xdm xrdp yardradius"
75
# Only get the ones that are installed, and configured
76
check=$(dpkg -s $check 2> /dev/null | egrep '^Package:|^Status:' | awk '{if ($1 ~ /^Package:/) { package=$2 } else if ($0 ~ /^Status: .* installed$/) { print package }}')
77
# some init scripts don't match the package names
78
check=$(echo $check | \
79
sed -e's/\bapache2-common\b/apache2/g' \
81
-e's/\bdovecot-common\b/dovecot/g' \
82
-e's/\bdante-server\b/danted/g' \
83
-e's/\bexim4-base\b/exim4/g' \
84
-e's/\bheartbeat-2\b/heartbeat/g' \
85
-e's/\bhylafax-server\b/hylafax/g' \
86
-e's/\bpartimage-server\b/partimaged/g' \
87
-e's/\bsasl2-bin\b/saslauthd/g' \
116
check="$check vsftpd wu-ftpd wzdftpd xrdp yardradius yaws"
118
if ! who | awk '{print $2}'|grep -q ':[0-9]'; then
119
check="$check kdm wdm xdm"
90
122
echo "Checking init scripts..."
91
for service in $check; do
92
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
93
idl=$(ls /etc/init.d/${service} 2> /dev/null | head -n 1)
94
if [ -n "$idl" ] && [ -x $idl ]; then
95
services="$service $services"
97
echo "WARNING: init script for $service not found."
100
if [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
101
idl=$(filerc $rl $service)
103
idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -n 1)
105
if [ -n "$idl" ] && [ -x $idl ]; then
106
services="$service $services"
123
services=$(installed_services "$check")
110
124
if [ -n "$services" ]; then
113
125
db_reset libpam0g/restart-services
114
126
db_set libpam0g/restart-services "$services"
115
127
question_priority="critical"
186
# Shut down the frontend, to make sure none of the
187
# restarted services keep a connection open to it
190
198
echo "Nothing to restart."
201
if who | awk '{print $2}' | grep -q ':[0-9]'; then
203
for service in kdm wdm xdm; do
206
*) dms="$dms $service"
209
services=$(installed_services "$dms")
210
if [ -n "$services" ]; then
211
if [ -n "$RELEASE_UPGRADE_IN_PROGRESS" ] \
212
&& [ -x /usr/share/update-notifier/notify-reboot-required ]
214
/usr/share/update-notifier/notify-reboot-required
216
db_input critical libpam0g/xdm-needs-restart || true
222
# Shut down the frontend, to make sure none of the
223
# restarted services keep a connection open to it
192
225
fi # end upgrading and $2 lt 0.99.7.1-3