pam-1.3.0.ebuild 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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/library/${MY_P}-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. S="${WORKDIR}/${MY_P}"
  33. check_old_modules() {
  34. local retval="0"
  35. if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
  36. eerror ""
  37. eerror "Your current setup is using the pam_stack module."
  38. eerror "This module is deprecated and no longer supported, and since version"
  39. eerror "0.99 is no longer installed, nor provided by any other package."
  40. eerror "The package will be built (to allow binary package builds), but will"
  41. eerror "not be installed."
  42. eerror "Please replace pam_stack usage with proper include directive usage,"
  43. eerror "following the PAM Upgrade guide at the following URL"
  44. eerror " https://wiki.gentoo.org/wiki/Project:PAM/Upgrade_to_0.99"
  45. eerror ""
  46. retval=1
  47. fi
  48. if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
  49. eerror ""
  50. eerror "Your current setup is using one or more of the following modules,"
  51. eerror "that are not built or supported anymore:"
  52. eerror "pam_pwdb, pam_console"
  53. eerror "If you are in real need for these modules, please contact the maintainers"
  54. eerror "of PAM through https://bugs.gentoo.org/ providing information about its"
  55. eerror "use cases."
  56. eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
  57. eerror " https://wiki.gentoo.org/wiki/Project:PAM/Upgrade_to_0.99"
  58. eerror ""
  59. retval=1
  60. fi
  61. return ${retval}
  62. }
  63. pkg_pretend() {
  64. # do not error out, this is just a warning, one could build a binpkg
  65. # with old modules enabled.
  66. check_old_modules
  67. }
  68. src_prepare() {
  69. # Fix non-POSIX shell code.
  70. # https://fedorahosted.org/linux-pam/ticket/60
  71. sed -i \
  72. -e '/ test /s:==:=:' \
  73. configure || die
  74. elibtoolize
  75. }
  76. multilib_src_configure() {
  77. # Do not let user's BROWSER setting mess us up. #549684
  78. unset BROWSER
  79. # Disable automatic detection of libxcrypt; we _don't_ want the
  80. # user to link libxcrypt in by default, since we won't track the
  81. # dependency and allow to break PAM this way.
  82. export ac_cv_header_xcrypt_h=no
  83. local myconf=(
  84. --docdir='$(datarootdir)'/doc/${PF}
  85. --htmldir='$(docdir)/html'
  86. --libdir='$(prefix)'/$(get_libdir)
  87. --enable-securedir="${EPREFIX}"/$(get_libdir)/security
  88. --enable-isadir='.' #464016
  89. $(use_enable nls)
  90. $(use_enable selinux)
  91. $(use_enable cracklib)
  92. $(use_enable audit)
  93. $(use_enable debug)
  94. $(use_enable berkdb db)
  95. $(use_enable nis)
  96. $(use_enable pie)
  97. --with-db-uniquename=-$(db_findver sys-libs/db)
  98. --disable-prelude
  99. --disable-regenerate-docu
  100. )
  101. ECONF_SOURCE=${S} \
  102. econf "${myconf[@]}"
  103. }
  104. multilib_src_compile() {
  105. emake sepermitlockdir="${EPREFIX}/run/sepermit"
  106. }
  107. multilib_src_install() {
  108. emake DESTDIR="${D}" install \
  109. sepermitlockdir="${EPREFIX}/run/sepermit"
  110. local prefix
  111. if multilib_is_native_abi; then
  112. prefix=
  113. gen_usr_ldscript -a pam pamc pam_misc
  114. else
  115. prefix=/usr
  116. fi
  117. # create extra symlinks just in case something depends on them...
  118. local lib
  119. for lib in pam pamc pam_misc; do
  120. if ! [[ -f "${ED}"${prefix}/$(get_libdir)/lib${lib}$(get_libname) ]]; then
  121. dosym lib${lib}$(get_libname 0) ${prefix}/$(get_libdir)/lib${lib}$(get_libname)
  122. fi
  123. done
  124. }
  125. DOCS=( CHANGELOG ChangeLog README AUTHORS Copyright NEWS )
  126. multilib_src_install_all() {
  127. einstalldocs
  128. prune_libtool_files --all
  129. docinto modules
  130. local dir
  131. for dir in modules/pam_*; do
  132. newdoc "${dir}"/README README."$(basename "${dir}")"
  133. done
  134. if use selinux; then
  135. dodir /usr/lib/tmpfiles.d
  136. cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
  137. d /run/sepermit 0755 root root
  138. EOF
  139. fi
  140. }
  141. pkg_preinst() {
  142. check_old_modules || die "deprecated PAM modules still used"
  143. }
  144. pkg_postinst() {
  145. ewarn "Some software with pre-loaded PAM libraries might experience"
  146. ewarn "warnings or failures related to missing symbols and/or versions"
  147. ewarn "after any update. While unfortunate this is a limit of the"
  148. ewarn "implementation of PAM and the software, and it requires you to"
  149. ewarn "restart the software manually after the update."
  150. ewarn ""
  151. ewarn "You can get a list of such software running a command like"
  152. ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
  153. ewarn ""
  154. ewarn "Alternatively, simply reboot your system."
  155. if [[ -x "${EROOT}"/var/log/tallylog ]] ; then
  156. elog ""
  157. elog "Because of a bug present up to version 1.1.1-r2, you have"
  158. elog "an executable /var/log/tallylog file. You can safely"
  159. elog "correct it by running the command"
  160. elog " chmod -x /var/log/tallylog"
  161. elog ""
  162. fi
  163. # The pam_unix module needs to check the password of the user which requires
  164. # read access to /etc/shadow only.
  165. fcaps cap_dac_override sbin/unix_chkpwd
  166. }