# Maintainer: Giancarlo Razzolini <grazzolini@archlinux.org>
# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Contributor: Dave Reisner <dreisner@archlinux.org>
# Contributor: Thomas Bächler <thomas@archlinux.org>

pkgname=mkinitcpio
pkgver=39.2
pkgrel=7
pkgdesc="Modular initramfs image creation utility"
arch=('any')
url='https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio'
license=('GPL-2.0-only')
depends=('awk' 'mkinitcpio-busybox>=1.19.4-2' 'kmod' 'util-linux>=2.23' 'libarchive' 'coreutils'
         'bash' 'binutils' 'diffutils' 'findutils' 'grep' 'filesystem>=2011.10-1' 'zstd' 'systemd')
checkdepends=('bats' 'bats-assert' 'lzop')
makedepends=('asciidoc')
optdepends=('gzip: Use gzip compression for the initramfs image'
            'xz: Use lzma or xz 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=('initramfs')
backup=('etc/mkinitcpio.conf')
source=("https://sources.archlinux.org/other/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig}
        '0001-trigger.patch'
        '0002-udev-debugging.patch')
sha512sums=('e4ba9fe901da56bb116510ec0c6abeba5153e57d9545baccbc466932951b7f324aa75ef7cc3de87f966456b0365b17552f367411d62585d500e88dc5c815058b'
            'SKIP'
            '0f728a24e3a92031484f22e39ba783ec9ace7e5b3bc7ded978470c3c60afe64cd8e5270e2d17f0594f5d7d9307507bf047df7da322c72bfa96277d191eee2577'
            '8b01136f996e7daa2195d44e8b44a38bbb0b18fb22056052e5d791a22c8463bb2fb990aa55d1acb82cf961138f917d47b3a15e69d9d9fe5b360c3ddcdc706c6c')
b2sums=('7bd6bf491dd8b23d83e42834566375736cf8868d5120c7e24f4c8923eb03a64864cdda51d6a6f41373db88c29905535e4c8aa4bde172955bc7529e6b3ffc252c'
        'SKIP'
        '82c825a7ae83e355f80a98a9e331d3319843f0ce721afcf74f02461988808bc1567ee28a7a8bb392ecd29f7522fe64aff4bdbeafe6c561dfda6ad31e9039d9c3'
        '4deef383aa6e71ff4c8f92435b04d5e966ead209ae3b35f04748f277dc45e2a6e02cc133a6827ead3773402a9c8e3596d5ae610ed14481b5f3ebd14eee4272d7')
validpgpkeys=('ECCAC84C1BA08A6CC8E63FBBF22FB1D78A77AEAB'    # Giancarlo Razzolini
              'C100346676634E80C940FB9E9C02FF419FECBE16')   # Morten Linderud

prepare() {
  cd "$pkgname-$pkgver"
  patch -Np1 < ../0001-trigger.patch
  patch -Np1 < ../0002-udev-debugging.patch
}

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

package() {
  make -C "$pkgname-$pkgver" DESTDIR="$pkgdir" install
}
