#!/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=mkinitcpio
pkgver=32
pkgrel=03
pkgdesc="Modular initramfs image creation utility"
#url='https://github.com/archlinux/mkinitcpio'
url="https://sources.archlinux.org/other"
makedepends=('binutils' 'asciidoc' 'sed')
arch=(x86_64)
install=mkinitcpio.install
depends=('awk' 'mkinitcpio-busybox>=1.35.0' 'kmod' 'util-linux>=2.23' 'libarchive' 'coreutils'
         'bash' 'binutils' 'diffutils' 'findutils' 'grep' 'filesystem' 'gzip')
optdepends=('zstd: Use zstd compression for the initramfs image'
            'bzip2: Use bzip2 compression for the initramfs image'
            'lzop: Use lzo compression for the initramfs image'
            'lz4: Use lz4 compression for the initramfs image'
            'mkinitcpio-nfs-utils: Support for root filesystem on NFS')
provides=("mkinitcpio=$pkgver-$pkgrel"
	'initramfs')
#backup=('etc/mkinitcpio.conf')
source=("$url/$pkgname/$pkgname-$pkgver.tar.gz"{,.sig}
        nosystemd.patch
        "fix-strip.patch::https://github.com/archlinux/mkinitcpio/commit/dece596d569ca90af902bf2403227b478b629c03.patch"
	mkinitcpio.conf)

prepare() {
	cd "${pkgname}-${pkgver}"
	patch -Np1 < "$srcdir/fix-strip.patch"
	patch -Np1 -i ../nosystemd.patch
}

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

package() {
	make -C $pkgname-$pkgver DESTDIR="$pkgdir" install
	rm -f "${pkgdir}"/usr/lib/initcpio/install/sd-*
	rm -f "${pkgdir}/etc/mkinitcpio.conf"
	install -Dm644 "${srcdir}/mkinitcpio.conf" "${pkgdir}/etc/mkinitcpio.conf"
}

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

license=(GPL)

validpgpkeys=('ECCAC84C1BA08A6CC8E63FBBF22FB1D78A77AEAB'    # Giancarlo Razzolini
              'C100346676634E80C940FB9E9C02FF419FECBE16')   # Morten Linderud

sha256sums=(f167d0b9831a5b6ae388525ebc92cea3a4766429e16ee2b56dbaa8d3b7c73ab2  # mkinitcpio-32.tar.gz
	0def1b0543f75140a499ac1d3e6085f8f7d5a4443fecc319dbf08878cac9be2e  # mkinitcpio-32.tar.gz.sig
	c4afeb6b3300c4d50c3f01233705b542f59d6e95a7670f7efde097ea209ef5bd  # nosystemd.patch
	d5ca05e3f2b338f6ac988461ba9bd60c030e7cb092aecf90b43d5a470e7e3652  # fix-strip.patch
	c8ec2debd54233927dd97bd25ef4ac00e1ac850f9b34a3d414e1a66608c36040) # mkinitcpio.conf


