# $Id$ PNAME="shadow" PVER="4.6" PBUILD="r1" PCAT="sys-apps" DESCRIPTION="Utilities to deal with user accounts, with pam support." HOMEPAGE="https://github.com/shadow-maint/shadow/" DEPEND=">= virtual/glibc >= sys-apps/base-files-0.7 >= app-shells/bash-4 >= sys-libs/pam-1.1 >= sys-libs/cracklib-2.8 >= sys-libs/readline-8.0 >= sys-apps/coreutils-8.19" SDEPEND=">= sys-dev/autoconf-5 >= sys-dev/automake-4 >= sys-dev/libtool-2.4" SRCFILE="${PNAME}-${PVER}.tar.xz" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" # no shared libs get installed, is multilib needed anymore? sminclude multilib mtools PAMD_CHAGE_REV=1.3 PAMD_LOGIN_REV=1.3 PAMD_SU_REV=1.3 SRC_URI=( https://github.com/shadow-maint/${PNAME}/releases/download/${PVER}/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/pamd-systemauth/chage-${PAMD_CHAGE_REV} mirror://${PNAME}/pamd-systemauth/login-${PAMD_LOGIN_REV} mirror://${PNAME}/pamd-systemauth/su-${PAMD_SU_REV} mirror://${PNAME}/pamd-systemauth/passwd mirror://${PNAME}/${PNAME}-4.1.2.1-defaults.patch mirror://${PNAME}/${PNAME}-4.1.5-missing-include.patch ) UP2DATE="updatecmd ${HOMEPAGE} | grep 'New release' | sed 's/.*: \(.*\).*/\1/;q'" src_prepare() { munpack ${SRCFILE} || die # fixes useradd default settings (create_mail_spool) mpatch ${PNAME}-4.1.2.1-defaults.patch || die # fix a missing include mpatch ${PNAME}-4.1.5-missing-include.patch || die # do not build 'groups'; coreutils provide a better version all-abis "sed -i 's/groups$(EXEEXT) //' src/Makefile.in" || die all-abis "sed -i '/groups/d' man/Makefile.in" || die } src_compile() { # configures shadow with pam mconfigure \ --bindir=/usr/bin \ --sbindir=/usr/sbin \ --enable-shared \ --with-libpam \ --with-libcrack \ --with-libcrypt \ --enable-nls \ --without-selinux \ --with-group-name-max-length=32 \ || die mmake || die } src_install() { # needed directories minstalldir /etc/{default,skel} || die # added exec_prefix for better bin location mmake DESTDIR=${BINDIR} install || die minstalletc etc/login.access login.access || die # install pam related configuration files minstallpam login-${PAMD_LOGIN_REV} login || die minstallpam su-${PAMD_SU_REV} su || die local i for i in chgpasswd chpasswd passwd do minstallpam passwd ${i} || die done for i in chage chfn chsh \ groupadd groupdel groupmems groupmod \ newusers useradd userdel usermod do minstallpam chage-${PAMD_CHAGE_REV} ${i} || die done # disable these checks as pam controls them now sed -e "s/^DIALUPS_CHECK_ENAB/# &/" \ -e "s/^LASTLOG_ENAB/# &/" \ -e "s/^MAIL_CHECK_ENAB/# &/" \ -e "s/^PORTTIME_CHECKS_ENAB/# &/" \ -e "s/^CONSOLE/# &/" \ -e "s/^MOTD_FILE/# &/" \ -e "s/^NOLOGINS_FILE/# &/" \ -e "s/^PASS_MIN_LEN/# &/" \ -e "s/^SU_WHEEL_ONLY/# &/" \ -e "s/^CONSOLE_GROUPS/# &/" \ -e "s/^ENVIRON_FILE/# &/" \ -e "s/^OBSCURE_CHECKS_ENAB/# &/" \ -e "s/^CRACKLIB_DICTPATH/# &/" \ -e "s/^PASS_CHANGE_TRIES/# &/" \ -e "s/^PASS_ALWAYS_WARN/# &/" \ -e "s/^FAILLOG_ENAB/# &/" \ -e "s/^QUOTAS_ENAB/# &/" \ -e "s/^FTMP_FILE/# &/" \ -e "s/^ENV_HZ/# &/" \ -e "s/^CHFN_AUTH/# &/" \ etc/login.defs > ${BINDIR}/etc/login.defs || die # fix some pathes in login.defs # md5crypt is also controlled by pam ! sed -i -e "s/^MD5_CRYPT_ENAB/# &/" \ -e 's%/var/spool/mail%/var/mail%' \ -e 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' \ ${BINDIR}/etc/login.defs || die } postinstall() { if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] then /usr/sbin/pwconv /usr/sbin/grpconv elif [[ -x $(type -P chroot) ]] && [[ -d ${MROOT} ]] then chroot ${MROOT} /usr/sbin/pwconv || die chroot ${MROOT} /usr/sbin/grpconv || die else echo echo "pwconv and grpconv could not run in MROOT='${MROOT}'." echo "PAM is not usable without any shadow/gshadow files." echo "Please chroot in your systemroot and run them by hand." echo fi # pam handles limits from now on if [[ -f ${MROOT}/etc/limits ]] then echo echo "/etc/limits found and will be removed!" echo "PAM handles all system limitations from now on." echo "Please edit /etc/security/limits.conf accordingly." echo rm ${MROOT}/etc/limits fi }