| 1 | # Copyright 2004 Gentoo Foundation |
1 | # Copyright 2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License, v2 or later |
2 | # Distributed under the terms of the GNU General Public License, v2 or later |
| 3 | # Author Diego Pettenò <flameeyes@gentoo.org> |
3 | # Author Diego Pettenò <flameeyes@gentoo.org> |
| 4 | # $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.13 2007/07/12 14:37:40 flameeyes Exp $ |
4 | # $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.14 2007/11/04 15:00:27 flameeyes Exp $ |
| 5 | # |
5 | # |
| 6 | # This eclass contains functions to install pamd configuration files and |
6 | # This eclass contains functions to install pamd configuration files and |
| 7 | # pam modules. |
7 | # pam modules. |
| 8 | |
8 | |
| 9 | inherit multilib |
9 | inherit multilib |
| … | |
… | |
| 175 | |
175 | |
| 176 | pam_epam_expand() { |
176 | pam_epam_expand() { |
| 177 | sed -n -e 's|#%EPAM-\([[:alpha:]-]\+\):\([-+<>=/.![:alnum:]]\+\)%#.*|\1 \2|p' \ |
177 | sed -n -e 's|#%EPAM-\([[:alpha:]-]\+\):\([-+<>=/.![:alnum:]]\+\)%#.*|\1 \2|p' \ |
| 178 | "$@" | sort -u | while read condition parameter; do |
178 | "$@" | sort -u | while read condition parameter; do |
| 179 | |
179 | |
| 180 | disable="# " |
180 | disable="yes" |
| 181 | |
181 | |
| 182 | case "$condition" in |
182 | case "$condition" in |
| 183 | If-Has) |
183 | If-Has) |
| 184 | message="This can be used only if you have ${parameter} installed" |
184 | message="This can be used only if you have ${parameter} installed" |
| 185 | has_version "$parameter" && disable="" |
185 | has_version "$parameter" && disable="no" |
| 186 | ;; |
186 | ;; |
| 187 | Use-Flag) |
187 | Use-Flag) |
| 188 | message="This can be used only if you enabled the ${parameter} USE flag" |
188 | message="This can be used only if you enabled the ${parameter} USE flag" |
| 189 | use "$parameter" && disable="" |
189 | use "$parameter" && disable="no" |
| 190 | ;; |
190 | ;; |
| 191 | *) |
191 | *) |
| 192 | eerror "Unknown EPAM condition '${condition}' ('${parameter}')" |
192 | eerror "Unknown EPAM condition '${condition}' ('${parameter}')" |
| 193 | die "Unknown EPAM condition '${condition}' ('${parameter}')" |
193 | die "Unknown EPAM condition '${condition}' ('${parameter}')" |
| 194 | ;; |
194 | ;; |
| 195 | esac |
195 | esac |
| 196 | |
196 | |
|
|
197 | if [ "${disable}" = "yes" ]; then |
|
|
198 | sed -i -e "/#%EPAM-${condition}:${parameter/\//\\/}%#/d" "$@" |
|
|
199 | else |
| 197 | sed -i -e "s|#%EPAM-${condition}:${parameter}%#|# ${message}\n${disable}|" "$@" |
200 | sed -i -e "s|#%EPAM-${condition}:${parameter}%#||" "$@" |
|
|
201 | fi |
|
|
202 | |
| 198 | done |
203 | done |
| 199 | } |
204 | } |
| 200 | |
205 | |
| 201 | # Think about it before uncommenting this one, for nwo run it by hand |
206 | # Think about it before uncommenting this one, for now run it by hand |
| 202 | # pam_pkg_preinst() { |
207 | # pam_pkg_preinst() { |
| 203 | # local shopts=$- |
208 | # local shopts=$- |
| 204 | # set -o noglob # so that bash doen't expand "*" |
209 | # set -o noglob # so that bash doen't expand "*" |
| 205 | # |
210 | # |
| 206 | # pam_epam_expand "${D}"/etc/pam.d/* |
211 | # pam_epam_expand "${D}"/etc/pam.d/* |