summaryrefslogtreecommitdiffstats
path: root/debian/libpam-modules.preinst
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/libpam-modules.preinst46
1 files changed, 46 insertions, 0 deletions
diff --git a/debian/libpam-modules.preinst b/debian/libpam-modules.preinst
new file mode 100644
index 0000000..50505ef
--- /dev/null
+++ b/debian/libpam-modules.preinst
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+
+handle_profiles_with_removed_modules() {
+ removed_modules="$1"
+ profiles=""
+ modules=""
+ test -x /usr/sbin/pam-auth-update ||return 0
+ test -r /var/lib/pam/auth ||return 0
+ for module in $removed_modules; do
+ new_profiles=$( perl -nle 'BEGIN {$removed = shift;} /^Module: (.*)$/&&($profile = $1); /^[^#]*$removed/&&$profile&&($profiles{$profile} = 1); END {print join("\n",keys %profiles) if %profiles;}' \
+ $module \
+ /var/lib/pam/auth /var/lib/pam/account \
+ /var/lib/pam/password /var/lib/pam/session \
+ /var/lib/pam/session-noninteractive)
+ if [ "$new_profiles" != "" ]; then
+ modules="$modules $module"
+ profiles="${profiles}${new_profiles}"
+ fi
+ done
+ profiles=$( echo "$profiles" |sort |uniq)
+ if [ "$profiles" != "" ]; then
+ db_reset libpam-modules/profiles-disabled
+ db_subst libpam-modules/profiles-disabled modules "$modules"
+ db_input critical libpam-modules/profiles-disabled ||true
+ db_go ||true
+ pam-auth-update --remove $profiles
+ fi
+}
+
+
+
+if dpkg --compare-versions "$2" lt-nl 1.4.0-5; then
+ db_version 2.0
+
+ if pidof xscreensaver xlockmore >/dev/null; then
+ db_input critical libpam-modules/disable-screensaver || true
+ db_go || true
+ fi
+fi
+
+#DEBHELPER#