pam-1.2.1-r1.ebuild 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit libtool multilib multilib-minimal eutils pam toolchain-funcs flag-o-matic db-use fcaps
  5. MY_PN="Linux-PAM"
  6. MY_P="${MY_PN}-${PV}"
  7. DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
  8. HOMEPAGE="http://www.linux-pam.org/ https://fedorahosted.org/linux-pam/"
  9. SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
  10. http://www.linux-pam.org/documentation/${MY_PN}-1.2.0-docs.tar.bz2"
  11. LICENSE="|| ( BSD GPL-2 )"
  12. SLOT="0"
  13. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
  14. IUSE="audit berkdb cracklib debug nis nls +pie selinux test vim-syntax"
  15. RDEPEND="nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
  16. cracklib? ( >=sys-libs/cracklib-2.9.1-r1[${MULTILIB_USEDEP}] )
  17. audit? ( >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}] )
  18. selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
  19. berkdb? ( >=sys-libs/db-4.8.30-r1:=[${MULTILIB_USEDEP}] )
  20. nis? ( >=net-libs/libtirpc-0.2.4-r2[${MULTILIB_USEDEP}] )"
  21. DEPEND="${RDEPEND}
  22. >=sys-devel/libtool-2
  23. >=sys-devel/flex-2.5.39-r1[${MULTILIB_USEDEP}]
  24. nls? ( sys-devel/gettext )
  25. nis? ( >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}] )"
  26. PDEPEND="sys-auth/pambase
  27. vim-syntax? ( app-vim/pam-syntax )"
  28. RDEPEND="${RDEPEND}
  29. !<sys-apps/openrc-0.11.8
  30. !sys-auth/openpam
  31. !sys-auth/pam_userdb
  32. abi_x86_32? (
  33. !<=app-emulation/emul-linux-x86-baselibs-20140508-r7
  34. !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
  35. )"
  36. S="${WORKDIR}/${MY_P}"
  37. check_old_modules() {
  38. local retval="0"
  39. if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
  40. eerror ""
  41. eerror "Your current setup is using the pam_stack module."
  42. eerror "This module is deprecated and no longer supported, and since version"
  43. eerror "0.99 is no longer installed, nor provided by any other package."
  44. eerror "The package will be built (to allow binary package builds), but will"
  45. eerror "not be installed."
  46. eerror "Please replace pam_stack usage with proper include directive usage,"
  47. eerror "following the PAM Upgrade guide at the following URL"
  48. eerror " https://wiki.gentoo.org/wiki/Project:PAM/Upgrade_to_0.99"
  49. eerror ""
  50. retval=1
  51. fi
  52. if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
  53. eerror ""
  54. eerror "Your current setup is using one or more of the following modules,"
  55. eerror "that are not built or supported anymore:"
  56. eerror "pam_pwdb, pam_console"
  57. eerror "If you are in real need for these modules, please contact the maintainers"
  58. eerror "of PAM through https://bugs.gentoo.org/ providing information about its"
  59. eerror "use cases."
  60. eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
  61. eerror " https://wiki.gentoo.org/wiki/Project:PAM/Upgrade_to_0.99"
  62. eerror ""
  63. retval=1
  64. fi
  65. return ${retval}
  66. }
  67. pkg_pretend() {
  68. # do not error out, this is just a warning, one could build a binpkg
  69. # with old modules enabled.
  70. check_old_modules
  71. }
  72. src_unpack() {
  73. # Upstream didn't release a new doc tarball (since nothing changed?).
  74. unpack ${MY_PN}-1.2.0-docs.tar.bz2
  75. # Update timestamps to avoid regenerating at build time. #569338
  76. find -type f -exec touch -r "${T}" {} + || die
  77. mv Linux-PAM-1.2.{0,1} || die
  78. unpack ${MY_P}.tar.bz2
  79. }
  80. src_prepare() {
  81. elibtoolize
  82. }
  83. multilib_src_configure() {
  84. # Do not let user's BROWSER setting mess us up. #549684
  85. unset BROWSER
  86. # Disable automatic detection of libxcrypt; we _don't_ want the
  87. # user to link libxcrypt in by default, since we won't track the
  88. # dependency and allow to break PAM this way.
  89. export ac_cv_header_xcrypt_h=no
  90. local myconf=(
  91. --docdir='$(datarootdir)'/doc/${PF}
  92. --htmldir='$(docdir)/html'
  93. --libdir='$(prefix)'/$(get_libdir)
  94. --enable-securedir="${EPREFIX}"/$(get_libdir)/security
  95. --enable-isadir='.' #464016
  96. $(use_enable nls)
  97. $(use_enable selinux)
  98. $(use_enable cracklib)
  99. $(use_enable audit)
  100. $(use_enable debug)
  101. $(use_enable berkdb db)
  102. $(use_enable nis)
  103. $(use_enable pie)
  104. --with-db-uniquename=-$(db_findver sys-libs/db)
  105. --disable-prelude
  106. --disable-regenerate-docu
  107. )
  108. ECONF_SOURCE=${S} \
  109. econf "${myconf[@]}"
  110. }
  111. multilib_src_compile() {
  112. emake sepermitlockdir="${EPREFIX}/run/sepermit"
  113. }
  114. multilib_src_install() {
  115. emake DESTDIR="${D}" install \
  116. sepermitlockdir="${EPREFIX}/run/sepermit"
  117. local prefix
  118. if multilib_is_native_abi; then
  119. prefix=
  120. gen_usr_ldscript -a pam pamc pam_misc
  121. else
  122. prefix=/usr
  123. fi
  124. # create extra symlinks just in case something depends on them...
  125. local lib
  126. for lib in pam pamc pam_misc; do
  127. if ! [[ -f "${ED}"${prefix}/$(get_libdir)/lib${lib}$(get_libname) ]]; then
  128. dosym lib${lib}$(get_libname 0) ${prefix}/$(get_libdir)/lib${lib}$(get_libname)
  129. fi
  130. done
  131. }
  132. DOCS=( CHANGELOG ChangeLog README AUTHORS Copyright NEWS )
  133. multilib_src_install_all() {
  134. einstalldocs
  135. prune_libtool_files --all
  136. docinto modules
  137. local dir
  138. for dir in modules/pam_*; do
  139. newdoc "${dir}"/README README."$(basename "${dir}")"
  140. done
  141. if use selinux; then
  142. dodir /usr/lib/tmpfiles.d
  143. cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
  144. d /run/sepermit 0755 root root
  145. EOF
  146. fi
  147. }
  148. pkg_preinst() {
  149. check_old_modules || die "deprecated PAM modules still used"
  150. }
  151. pkg_postinst() {
  152. ewarn "Some software with pre-loaded PAM libraries might experience"
  153. ewarn "warnings or failures related to missing symbols and/or versions"
  154. ewarn "after any update. While unfortunate this is a limit of the"
  155. ewarn "implementation of PAM and the software, and it requires you to"
  156. ewarn "restart the software manually after the update."
  157. ewarn ""
  158. ewarn "You can get a list of such software running a command like"
  159. ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
  160. ewarn ""
  161. ewarn "Alternatively, simply reboot your system."
  162. if [[ -x "${EROOT}"/var/log/tallylog ]] ; then
  163. elog ""
  164. elog "Because of a bug present up to version 1.1.1-r2, you have"
  165. elog "an executable /var/log/tallylog file. You can safely"
  166. elog "correct it by running the command"
  167. elog " chmod -x /var/log/tallylog"
  168. elog ""
  169. fi
  170. # The pam_unix module needs to check the password of the user which requires
  171. # read access to /etc/shadow only.
  172. fcaps cap_dac_override sbin/unix_chkpwd
  173. }