Added check for non-portable modules in pamd files, so that pamd files that get insta...
authorDiego Elio Pettenò <flameeyes@gentoo.org>
Fri, 9 Sep 2005 10:31:35 +0000 (10:31 +0000)
committerDiego Elio Pettenò <flameeyes@gentoo.org>
Fri, 9 Sep 2005 10:31:35 +0000 (10:31 +0000)
eclass/pam.eclass

index b9ceda277f2db7887b38a90cc264b26a02d6c33e..ad8c25836ad02cd93b6ef16d13c9bbbedfc9ecbf 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright 2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License, v2 or later
 # Author Diego Pettenò <flameeyes@gentoo.org>
-# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.8 2005/07/06 20:23:20 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.9 2005/09/09 10:31:35 flameeyes Exp $
 #
 # This eclass contains functions to install pamd configuration files and
 # pam modules.
@@ -20,6 +20,7 @@ dopamd() {
 
        INSDESTTREE=/etc/pam.d \
        doins "$@" || die "failed to install $@"
+       cleanpamd "$@"
 }
 
 # newpamd <old name> <new name>
@@ -34,6 +35,7 @@ newpamd() {
 
        INSDESTTREE=/etc/pam.d \
        newins "$1" "$2" || die "failed to install $1 as $2"
+       cleanpamd $2
 }
 
 # dopamsecurity <section> <file> [more files]
@@ -144,3 +146,17 @@ pamd_mimic_system() {
                shift
        done
 }
+
+# cleanpamd <pamd file>
+#
+# Cleans a pam.d file from modules that might not be present on the system
+# where it's going to be installed
+cleanpamd() {
+       while [[ -n $1 ]]; do
+               if ! has_version sys-libs/pam; then
+                       sed -i -e '/pam_shells\|pam_console/s:^:#:' ${D}/etc/pam.d/$1
+               fi
+
+               shift
+       done
+}