From 77c8f53a0a5e6efdfc89ab8d8b47981874a7fe92 Mon Sep 17 00:00:00 2001 From: Diego Elio Pettenò Date: Sun, 4 Nov 2007 15:00:27 +0000 Subject: Now that it has been tested, we can remove the EPAM lines that didn't hit, instead of cluttering the pam file. --- eclass/pam.eclass | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'eclass') diff --git a/eclass/pam.eclass b/eclass/pam.eclass index e09e3dbee7f6..51c58ea1b61c 100644 --- a/eclass/pam.eclass +++ b/eclass/pam.eclass @@ -1,7 +1,7 @@ # Copyright 2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later # Author Diego Pettenò -# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.13 2007/07/12 14:37:40 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.14 2007/11/04 15:00:27 flameeyes Exp $ # # This eclass contains functions to install pamd configuration files and # pam modules. @@ -177,16 +177,16 @@ pam_epam_expand() { sed -n -e 's|#%EPAM-\([[:alpha:]-]\+\):\([-+<>=/.![:alnum:]]\+\)%#.*|\1 \2|p' \ "$@" | sort -u | while read condition parameter; do - disable="# " + disable="yes" case "$condition" in If-Has) message="This can be used only if you have ${parameter} installed" - has_version "$parameter" && disable="" + has_version "$parameter" && disable="no" ;; Use-Flag) message="This can be used only if you enabled the ${parameter} USE flag" - use "$parameter" && disable="" + use "$parameter" && disable="no" ;; *) eerror "Unknown EPAM condition '${condition}' ('${parameter}')" @@ -194,11 +194,16 @@ pam_epam_expand() { ;; esac - sed -i -e "s|#%EPAM-${condition}:${parameter}%#|# ${message}\n${disable}|" "$@" + if [ "${disable}" = "yes" ]; then + sed -i -e "/#%EPAM-${condition}:${parameter/\//\\/}%#/d" "$@" + else + sed -i -e "s|#%EPAM-${condition}:${parameter}%#||" "$@" + fi + done } -# Think about it before uncommenting this one, for nwo run it by hand +# Think about it before uncommenting this one, for now run it by hand # pam_pkg_preinst() { # local shopts=$- # set -o noglob # so that bash doen't expand "*" -- cgit v1.2.3-65-gdbad