# Maintainer: David P. <megver83@parabola.nu>
# Maintainer: Luke Shumaker <lukeshu@parabola.nu>
# Contributor: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=sysvinit
pkgver=2.96
pkgrel=1
pkgdesc='Linux System V Init'
url='http://www.nongnu.org/sysvinit/'
arch=('i686' 'x86_64' 'armv7h')
license=('GPL')
depends=('glibc' 'initscripts')
provides=('init')
conflicts=(${provides[@]})
source=(#"https://download.savannah.gnu.org/releases/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig}
        "http://download.savannah.gnu.org/releases/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})
sha256sums=('2a2e26b72aa235a23ab1c8471005f890309ce1196c83fbc9413c57b9ab62b587'
            'SKIP')
validpgpkeys=('146BF1D0D20B006B10299B4CFA3EC79A4C0C11CC') # Jesse Smith <jsmith@resonatingmedia.com>

build() {
    cd "$pkgname-$pkgver"
    make
}

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

    install -d "$pkgdir/usr/bin"
    ln -s usr/bin "$pkgdir/bin"
    ln -s usr/bin "$pkgdir/sbin"
    make ROOT="$pkgdir" install
    rm "$pkgdir/bin" "$pkgdir/sbin"

    install -d "$pkgdir/usr/share/licenses/$pkgname"
    install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

    local rmprogs=(
        # provided by e2fsprogs
        logsave
        # provided by util-linux
        last
        lastb
        mesg
        sulogin
        utmpdump
        wall
        # provided by procps-ng
        pidof
    )
    cd "$pkgdir"
    local prog
    for prog in "${rmprogs[@]}"; do
        rm usr/bin/"$prog" usr/share/man/man?/"$prog".?
    done

    # old Arch Linux sysvinit would have split out fstab-decode,
    # killall5, and bootlogd into a separate sysvinit-tools package.
    # Unfortunately, because sysvinit-tools provided pidof, procps-ng
    # still conflicts=(sysvinit-tools).
}
