Skip to content
Snippets Groups Projects
PKGBUILD 2.47 KiB
Newer Older
# Maintainer: Sébastien Luttringer <seblu@seblu.net>

pkgname=(kernel-install-hook kernel-install-compat kernel-install-grub)
Seblu's avatar
Seblu committed
pkgver=2024.10.07
pkgrel=1
arch=('any')
Seblu's avatar
Seblu committed
url='https://git.seblu.net/archlinux/kernel-install-poc'
license=('GPL2')
source=('hook.sh'
        'hook.install'
        'hook.remove'
        '50-mkinitcpio-compat.install'
        '90-loaderentry-compat.install'
        '95-grub-update.install')
Seblu's avatar
Seblu committed
sha224sums=('01cff51f05c8b381117a564569a68df8e4a15fbc97a7804c5f0bb99f'
            'ae0813a7f42a11efb02c03c7ab80671ff756b17109f4481fbe756bcb'
            '32fbc4e69a3c9a6d917aed2f9e3b7a05b63a1bec8bd5002e6067b731'
            'caaec9eeb5d6616d2e9fcbfa4255d0fcddd7d43af19e95319a683889'
            'f7aa11f7f92713734919497c5e8aa53c4786e1676bb9518c1123d56c'
            'c94240e8716f39361ad0249354cc1bb3860c7b1d898589d26bdb4755')

package_kernel-install-hook() {
  pkgdesc='kernel-install hook to run when install/remove kernels'
  depends=('systemd')
  optdepends=('kernel-install-compat: Install kernel in /boot'
              'kernel-install-grub: Regen grub config')

  install -dm755 "$pkgdir"/usr/share/libalpm/hooks
  install -m644 hook.install "$pkgdir"/usr/share/libalpm/hooks/90-kernel-install.hook
  install -m644 hook.remove "$pkgdir"/usr/share/libalpm/hooks/90-kernel-remove.hook
  install -Dm755 hook.sh "$pkgdir"/usr/bin/kernel-install-hook
Seblu's avatar
Seblu committed
  # disable mkinitcpio hooks which conflicts with kernel-install
  install -dm755 "$pkgdir"/etc/pacman.d/hooks
  ln -s /dev/null "$pkgdir"/etc/pacman.d/hooks/60-mkinitcpio-remove.hook
  ln -s /dev/null "$pkgdir"/etc/pacman.d/hooks/90-mkinitcpio-install.hook
}

package_kernel-install-compat() {
  pkgdesc='override default kernel-install script to gen arch compatible kernel and initramfs'
  depends=('mkinitcpio' 'kernel-install-hook')

  # disable arch default
  install -dm755 $_f "$pkgdir/etc/kernel/install.d"
  ln -s /dev/null "$pkgdir/etc/kernel/install.d/90-loaderentry.install"
  ln -s /dev/null "$pkgdir/etc/kernel/install.d/50-mkinitcpio.install"
  install -Dm755 50-mkinitcpio-compat.install \
    "$pkgdir/usr/lib/kernel/install.d/50-mkinitcpio-compat.install"
  install -Dm755 90-loaderentry-compat.install \
    "$pkgdir/usr/lib/kernel/install.d/90-loaderentry-compat.install"
}

package_kernel-install-grub() {
  pkgdesc='kernel-install script to regen grub config'
  depends=('grub' 'kernel-install-compat')

  install -Dm755 95-grub-update.install \
    "$pkgdir/usr/lib/kernel/install.d/95-grub-update.install"
}

# vim:set ts=2 sw=2 et: