aboutsummaryrefslogblamecommitdiffstats
path: root/shadow-libpassphrase/PKGBUILD
blob: 0023ebee7c4752c212271601fa769bf6fb0b7095 (plain) (tree)
1
                                                             
































































































































































                                                                                                              
# Maintainer: Mattias Andrée <m@`base64 -d`(bWFhbmRyZWU).se>
# Maintainer of the shadow package: Dave Reisner <dreisner@archlinux.org>
# Maintainer of the shadow package: Aaron Griffin <aaron@archlinux.org>

_pkgname=shadow
pkgname=shadow-libpassphrase
pkgver=4.2.1
pkgrel=1
pkgdesc="Patched version of shadow that uses libpassphrase and can indicate the strenght of your new password"
arch=('i686' 'x86_64')
url='https://github.com/maandree/shadow'
license=('BSD')
groups=('base')
depends=('bash' 'pam' 'acl' 'libpassphrase>=1449331105')
makedepends=('pam' 'acl' 'libpassphrase>=1449331105')
optdepends=('passcheck: for password strenght meter')
conflicts=(shadow)
provides=('shadow=4.2.1')
backup=(etc/login.defs
        etc/pam.d/{chage,passwd,shadow,useradd,usermod,userdel}
        etc/pam.d/{chpasswd,newusers,groupadd,groupdel,groupmod}
        etc/pam.d/{chgpasswd,groupmems}
        etc/default/useradd)
options=(strip)
install='shadow.install'
source=("http://pkg-shadow.alioth.debian.org/releases/$_pkgname-$pkgver.tar.xz"
	'0001-Use-libpassphrase-when-entering-passwords.patch'
	'0002-Make-libpassphrase-optional.patch'
        LICENSE
        chgpasswd
        chpasswd
        defaults.pam
        login.defs
        newusers
        passwd
        shadow.{timer,service}
        useradd.defaults
        xstrdup.patch
        shadow-strncpy-usage.patch
        lastlog.tmpfiles)
sha1sums=('0917cbadd4ce0c7c36670e5ecd37bbed92e6d82d'
	  08ac0b8cbcfaa9dbab5caec52aeab702e7869a0c
	  8d163eb290c2a41009abb9f0e1f84cacb9febb78
          '33a6cf1e44a1410e5c9726c89e5de68b78f5f922'
          '4ad0e059406a305c8640ed30d93c2a1f62c2f4ad'
          '12427b1ca92a9b85ca8202239f0d9f50198b818f'
          '0e56fed7fc93572c6bf0d8f3b099166558bb46f1'
          'bb3509087947d08bfb6e5d1b5c033856b9146ad9'
          '12427b1ca92a9b85ca8202239f0d9f50198b818f'
          '611be25d91c3f8f307c7fe2485d5f781e5dee75f'
          'a154a94b47a3d0c6c287253b98c0d10b861226d0'
          'e40fc20894e69a07fb0070b41f567d0c27133720'
          '9ae93de5987dd0ae428f0cc1a5a5a5cd53583f19'
          '6010fffeed1fc6673ad9875492e1193b1a847b53'
          '21e12966a6befb25ec123b403cd9b5c492fe5b16'
          'f57ecde3f72b4738fad75c097d19cf46a412350f')

prepare() {
  cd "$_pkgname-$pkgver"

  patch -Np1 <"$srcdir/0001-Use-libpassphrase-when-entering-passwords.patch"
  patch -Np1 <"$srcdir/0002-Make-libpassphrase-optional.patch"

  # need to offer these upstream
  patch -Np1 <"$srcdir/xstrdup.patch"
  patch -Np1 <"$srcdir/shadow-strncpy-usage.patch"

  # supress etc/pam.d/*, we provide our own
  sed -i '/^SUBDIRS/s/pam\.d//' etc/Makefile.in
}

build() {
  cd "$_pkgname-$pkgver"

  libtoolize
  aclocal
  autoheader
  autoconf
  automake --add-missing

  ./configure \
    LIBS="-lcrypt" \
    --prefix=/usr \
    --bindir=/usr/bin \
    --sbindir=/usr/bin \
    --libdir=/usr/lib \
    --mandir=/usr/share/man \
    --sysconfdir=/etc \
    --without-libpam \
    --with-group-name-max-length=32 \
    --without-selinux \
    --with-libpassphrase

  make
}

package() {
  cd "$_pkgname-$pkgver"

  make DESTDIR="$pkgdir" install

  # license
  install -Dm644 "$srcdir/LICENSE" "$pkgdir/usr/share/licenses/shadow/LICENSE"

  # useradd defaults
  install -Dm644 "$srcdir/useradd.defaults" "$pkgdir/etc/default/useradd"

  # systemd timer
  install -D -m644 "$srcdir/shadow.timer" "$pkgdir/usr/lib/systemd/system/shadow.timer"
  install -D -m644 "$srcdir/shadow.service" $pkgdir/usr/lib/systemd/system/shadow.service
  install -d -m755 "$pkgdir/usr/lib/systemd/system/multi-user.target.wants"
  ln -s ../shadow.timer "$pkgdir/usr/lib/systemd/system/multi-user.target.wants/shadow.timer"

  # login.defs
  install -Dm644 "$srcdir/login.defs" "$pkgdir/etc/login.defs"

  # PAM config - custom
  install -dm755 "$pkgdir/etc/pam.d"
  install -t "$pkgdir/etc/pam.d" -m644 "$srcdir"/{passwd,chgpasswd,chpasswd,newusers}

  # PAM config - from tarball
  install -Dm644 etc/pam.d/groupmems "$pkgdir/etc/pam.d/groupmems"

  # we use the 'useradd' PAM file for other similar utilities
  for file in chage groupadd groupdel groupmod shadow \
      useradd usermod userdel; do
    install -Dm644 "$srcdir/defaults.pam" "$pkgdir/etc/pam.d/$file"
  done

  # lastlog log file creation
  install -Dm644 "$srcdir/lastlog.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/lastlog.conf"

  # Remove evil/broken tools
  rm "$pkgdir"/usr/sbin/logoutd

  # Remove utilities provided by util-linux
  rm \
      "$pkgdir"/usr/bin/{login,su,chsh,chfn,sg,nologin} \
      "$pkgdir"/usr/sbin/{vipw,vigr}

  # but we keep newgrp, as sg is really an alias to it
  mv "$pkgdir"/usr/bin/{newgrp,sg}

  # ...and their many man pages
  find "$pkgdir"/usr/share/man \
      '(' -name 'chsh.1'    -o \
          -name 'chfn.1'    -o \
          -name 'su.1'      -o \
          -name 'logoutd.8' -o \
          -name 'login.1'   -o \
          -name 'nologin.8' -o \
          -name 'vipw.8'    -o \
          -name 'vigr.8'    -o \
          -name 'newgrp.1' ')' \
      -delete
  rmdir \
      "$pkgdir"/usr/share/man/{fi,id,zh_TW}/man1 \
      "$pkgdir"/usr/share/man/{fi,ko/man8}

  # move everything else to /usr/bin, because this isn't handled by ./configure
  mv "$pkgdir"/usr/sbin/* "$pkgdir"/usr/bin
  rmdir "$pkgdir/usr/sbin"
}