#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=inetutils
pkgver=2.4
pkgrel=01
pkgdesc="A collection of common network programs - w/o ipv6 & systemd"
arch=(x86_64)
url="https://www.gnu.org/software/inetutils/"
depends=('pam' 'libcap' 'readline' 'ncurses' 'libxcrypt'
	     libpam.so libcrypt.so libreadline.so libncursesw.so)
makedepends=('help2man')
backup=('etc/xinetd.d/telnet' 'etc/xinetd.d/talk'
        'etc/xinetd.d/rlogin' 'etc/xinetd.d/rsh'
        'etc/pam.d/rlogin' 'etc/pam.d/rsh')
options=('!emptydirs')
install=inetutils.install
source=("https://ftp.gnu.org/gnu/inetutils/${pkgname}-${pkgver}.tar.xz"{,.sig}
        'rlogin.pam' 'rlogin.xinetd'
        'rsh.pam' 'rsh.xinetd' 'talk.xinetd' 'telnet.xinetd')

build() {
  cd ${pkgname}-${pkgver}
  ./configure \
    --prefix=/usr \
    --libexec=/usr/bin \
    --localstatedir=/var \
    --sysconfdir=/etc \
    --without-wrap \
    --with-pam \
    --enable-ftp \
    --enable-ftpd \
    --enable-telnet \
    --enable-telnetd \
    --enable-talk \
    --enable-talkd \
    --enable-rlogin \
    --enable-rlogind \
    --enable-rsh \
    --enable-rshd \
    --enable-rcp \
    --enable-hostname \
    --enable-dnsdomainname \
    --disable-ipv6 \
    --disable-rexec \
    --disable-rexecd \
    --disable-tftp \
    --disable-tftpd \
    --disable-ping \
    --disable-ping6 \
    --disable-logger \
    --disable-syslogd \
    --disable-inetd \
    --disable-whois \
    --disable-uucpd \
    --disable-ifconfig \
    --disable-traceroute
  make
}

check() {
  cd ${pkgname}-${pkgver}
  make check
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  chmod -s "${pkgdir}"/usr/bin/{rcp,rlogin,rsh}
  install -D -m644 "${srcdir}/telnet.xinetd" "${pkgdir}/etc/xinetd.d/telnet"
  install -D -m644 "${srcdir}/talk.xinetd" "${pkgdir}/etc/xinetd.d/talk"
  install -D -m644 "${srcdir}/rlogin.xinetd" "${pkgdir}/etc/xinetd.d/rlogin"
  install -D -m644 "${srcdir}/rsh.xinetd" "${pkgdir}/etc/xinetd.d/rsh"
  install -D -m644 "${srcdir}/rlogin.pam" "${pkgdir}/etc/pam.d/rlogin"
  install -D -m644 "${srcdir}/rsh.pam" "${pkgdir}/etc/pam.d/rsh"
}

#---- license gpg-key sha256sums ----

license=('GPL3')

# GNU Keyring: https://ftp.gnu.org/gnu/gnu-keyring.gpg
validpgpkeys=(4FBD67621082C4C502448E3B180551BAD95A3C35 # Alfred M. Szmidt <ams@gnu.org>
	 9AA9BDB11BB1B99A21285A330664A76954265E8C # Simon Josefsson <simon@josefsson.org>
	 B1D2BD1375BECB784CF4F8C4D73CF638C53C06BE) # simon@josefsson.org

sha256sums=(1789d6b1b1a57dfe2a7ab7b533ee9f5dfd9cbf5b59bb1bb3c2612ed08d0f68b2  # inetutils-2.4.tar.xz
	5453c3407a380c7d79f09e644533aeff90c89bda53c41b77f97c7ffa827b3eb2  # inetutils-2.4.tar.xz.sig
	428367b148033c7fa865e92bdd73b06cb58e6909488649adebf8d2253a022f1f  # rlogin.pam
	c5ff9a299f4b09bc097069e8a4987f6db495083fb7b11443e390cabfdf230165  # rlogin.xinetd
	6317e1e62f0dcf32ac99334bafdc8972b4967048456448ef1e2458219661bf18  # rsh.pam
	5d8852f3961ea9b1aec7d50b84ddde4746ddbf4f6c5ed67cb419ab56e79d4762  # rsh.xinetd
	0f5799a8d9a8a7ad28ff99ee022b1e742b6e5cfd1ba451339173d6eb75624bab  # talk.xinetd
	b019c8d8130a5dcda5dacd988a7e35e21e34738ff4d6b4cfe39be83a413ec8ac) # telnet.xinetd

##  30e43af1ddd9ce0f370845adaa32e60e2918eb5ca3f2a625710098b4f72bb551  inetutils-2.4-01-x86_64.pkg.tar.lz

