pkgname=shadow pkgver=4.17.0 pkgrel=1 pkgdesc="Password and account management tool suite with support for shadow files and PAM" arch=('x86_64') url="https://github.com/shadow-maint/shadow/" license=('BSD-3-Clause') groups=('base') depends=('glibc' 'acl' 'attr' 'libxcrypt' 'libpwquality' 'linux-pam') backup=(etc/default/useradd etc/login.defs etc/pam.d/{chage,chpasswd,login,passwd,su}) options=('!emptydirs') install=${pkgname}.install source=(https://github.com/shadow-maint/shadow/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.xz chage chpasswd login passwd su) sha256sums=(df0d29d09ed1db609234aaec670f55ebf724bc7bd0b377c8a299913669b7878e 656fc19e0e36740399f9d10773ac30254b48d5327aaddd89f47127acf99ccfb5 fbaed8b9d2bad9278da32f6747491ef291b332d0f977009aadb993436b2084c9 216eb2abc095566afa0ed5394f5b32765d3e3b63295c0e972ecd8ebda1a734d2 586820a13a54e92023ad3aa5dbf2ee4e2cfe470996ebb9ee5433e60abd5d8c01 f0182f4cf929c6adb5e13e8691787a8778828f5ea18911b7b7febb3e1b138c54) prepare() { cd ${pkgname}-${pkgver} sed -i 's/groups$(EXEEXT) //' src/Makefile.in find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD YESCRYPT:' \ -e 's:/var/spool/mail:/var/mail:' \ -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \ -i etc/login.defs } build() { cd ${pkgname}-${pkgver} export CFLAGS="${CFLAGS} -DEXTRA_CHECK_HOME_DIR" local configure_args=( --sysconfdir=/etc --bindir=/usr/bin --sbindir=/usr/sbin --disable-static --with-libpam --with-{b,yes}crypt --without-libbsd --without-selinux --without-nscd --with-group-name-max-length=32 ${configure_options} ) ./configure ${configure_args[@]} make } package() { cd ${pkgname}-${pkgver} make DESTDIR=${pkgdir} pamddir= install make -C man DESTDIR=${pkgdir} install-man install -vdm755 ${pkgdir}/etc/default cat > ${pkgdir}/etc/default/useradd << EOF # useradd defaults file GROUP=999 GROUPS=netdev HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/bash SKEL=/etc/skel USRSKEL=/usr/etc/skel CREATE_MAIL_SPOOL=yes LOG_INIT=yes EOF install -v -m644 ${pkgdir}/etc/login.defs ${pkgdir}/etc/login.defs.orig for FUNCTION in FAIL_DELAY \ FAILLOG_ENAB \ LASTLOG_ENAB \ MAIL_CHECK_ENAB \ OBSCURE_CHECKS_ENAB \ PORTTIME_CHECKS_ENAB \ QUOTAS_ENAB \ CONSOLE MOTD_FILE \ FTMP_FILE NOLOGINS_FILE \ ENV_HZ PASS_MIN_LEN \ SU_WHEEL_ONLY \ PASS_CHANGE_TRIES \ PASS_ALWAYS_WARN \ CHFN_AUTH ENCRYPT_METHOD \ ENVIRON_FILE do sed -i "s/^${FUNCTION}/# &/" ${pkgdir}/etc/login.defs done for pamfile in chage chpasswd login passwd su do install -vDm644 ${srcdir}/${pamfile} ${pkgdir}/etc/pam.d/${pamfile} done sed -e s/chpasswd/newusers/ ${pkgdir}/etc/pam.d/chpasswd > ${pkgdir}/etc/pam.d/newusers for PROGRAM in chfn chgpasswd chsh groupadd groupdel \ groupmems groupmod useradd userdel usermod do install -v -m644 ${pkgdir}/etc/pam.d/chage ${pkgdir}/etc/pam.d/${PROGRAM} sed -i "s/chage/$PROGRAM/" ${pkgdir}/etc/pam.d/${PROGRAM} done }