~ubuntu-branches/ubuntu/hardy/pam/hardy-updates

« back to all changes in this revision

Viewing changes to debian/libpam0g.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2007-09-28 23:45:24 UTC
  • Revision ID: james.westby@ubuntu.com-20070928234524-2wfepiekxqeehg06
Tags: 0.99.7.1-5ubuntu1
* Resynchronise with Debian. Remaining changes:
  - debian/control, debian/local/common-session{,md5sums}: use
    libpam-foreground for session management.
  - debian/rules: install unix_chkpwd setgid shadow instead of setuid root.
    The nis package handles overriding this as necessary.
  - debian/libpam-modules.postinst: Add PATH to /etc/environment if it's not
    present there or in /etc/security/pam_env.conf.
  - debian/patches-applied/ubuntu-fix_standard_types: Use standard u_int8_t
    type rather than __u8.
  - debian/patches-applied/ubuntu-rlimit_nice_correction: Explicitly
    initialise RLIMIT_NICE rather than relying on the kernel limits. Bound
    RLIMIT_NICE from below as well as from above. Fix off-by-one error when
    converting RLIMIT_NICE to the range of values used by the kernel.
    (Originally patch 101; converted to quilt.)
  - debian/patches-applied/ubuntu-user_defined_environment: Look at
    ~/.pam_environment too, with the same format as
    /etc/security/pam_env.conf.  (Originally patch 100; converted to quilt.)
  - debian/patches-applied/ubuntu-regression_fix_securetty: securetty's
    earlier behavior would correctly prompt for password on bad usernames
    (LP: #139075).
  - Build using db4.5 instead of db4.6.
  - debian/libpam0g.postinst: only ask questions during update-manager when
    there are non-default services running (LP: #141309).
* debian/libpam0g.postinst: don't display a debconf warning about display
  managers that need restarting when update-manager is running, instead
  signal to update-notifier if a reboot is required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    echo ""
53
53
}
54
54
 
 
55
installed_services() {
 
56
    check="$@"
 
57
 
 
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 }}')
 
60
 
 
61
    # some init scripts don't match the package names
 
62
    check=$(echo $check | \
 
63
        sed -e's/\bapache2-common\b/apache2/g' \
 
64
            -e's/\bat\b/atd/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' \
 
72
    )
 
73
 
 
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"
 
79
           else
 
80
                echo "WARNING: init script for $service not found." >&2
 
81
           fi
 
82
        else
 
83
            if [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
 
84
                idl=$(filerc $rl $service)
 
85
            else
 
86
                idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -n 1)
 
87
            fi
 
88
            if [ -n "$idl" ] && [ -x $idl ]; then
 
89
                services="$service $services"
 
90
            fi
 
91
        fi
 
92
    done
 
93
    echo "$services"
 
94
}
 
95
 
55
96
if [ "$1" = "configure" ]
56
97
then
57
98
    if [ ! -z "$2" ]; then
58
99
        if dpkg --compare-versions "$2" lt 0.99.7.1-3; then
 
100
            db_version 2.0
 
101
 
59
102
            echo -n "Checking for services that may need to be restarted..."
60
103
 
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"
74
 
            check="$check yaws"
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' \
80
 
                    -e's/\bat\b/atd/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' \
88
 
            )
 
116
            check="$check vsftpd wu-ftpd wzdftpd xrdp yardradius yaws"
 
117
 
 
118
            if ! who | awk '{print $2}'|grep -q ':[0-9]'; then
 
119
                check="$check kdm wdm xdm"
 
120
            fi
89
121
 
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"
96
 
                   else
97
 
                        echo "WARNING: init script for $service not found."
98
 
                   fi
99
 
                else
100
 
                    if [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
101
 
                        idl=$(filerc $rl $service)
102
 
                    else
103
 
                        idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -n 1)
104
 
                    fi
105
 
                    if [ -n "$idl" ] && [ -x $idl ]; then
106
 
                        services="$service $services"
107
 
                    fi
108
 
                fi
109
 
            done
 
123
            services=$(installed_services "$check")
110
124
            if [ -n "$services" ]; then
111
 
                db_version 2.0
112
 
 
113
125
                db_reset libpam0g/restart-services
114
126
                db_set libpam0g/restart-services "$services"
115
127
                question_priority="critical"
150
162
                        fi
151
163
 
152
164
                        case "$service" in
153
 
                            *dm)
 
165
                            gdm)
154
166
                                echo -n "  $service: reloading..."
155
167
                                if $idl reload > /dev/null 2>&1; then
156
168
                                    echo "done."
174
186
                    done
175
187
                    echo
176
188
                    if [ -n "$failed" ]; then
177
 
                        db_fset libpam0g/restart-failed seen false
178
189
                        db_subst libpam0g/restart-failed services "$failed"
179
190
                        db_input critical libpam0g/restart-failed || true
180
191
                        db_go || true
183
194
                    fi
184
195
                    echo
185
196
                fi
186
 
                # Shut down the frontend, to make sure none of the
187
 
                # restarted services keep a connection open to it
188
 
                db_stop
189
197
            else
190
198
                echo "Nothing to restart."
191
199
            fi
 
200
 
 
201
            if who | awk '{print $2}' | grep -q ':[0-9]'; then
 
202
                dms=""
 
203
                for service in kdm wdm xdm; do
 
204
                    case "$services" in
 
205
                        *$service*)     ;;
 
206
                        *)      dms="$dms $service"
 
207
                    esac
 
208
                done
 
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 ]
 
213
                    then
 
214
                        /usr/share/update-notifier/notify-reboot-required
 
215
                    else
 
216
                        db_input critical libpam0g/xdm-needs-restart || true
 
217
                        db_go || true
 
218
                    fi
 
219
                fi
 
220
            fi
 
221
 
 
222
            # Shut down the frontend, to make sure none of the
 
223
            # restarted services keep a connection open to it
 
224
            db_stop
192
225
        fi # end upgrading and $2 lt 0.99.7.1-3
193
226
    fi # Upgrading
194
227
fi