void-packages/srcpkgs/mkinitcpio/template
Andrew J. Hesford 7998ae32c1 mkinitcpio: update to 30, add mkinitcpio-zfs subpackage
ZFS hooks taken from [1] and slightly modified:

1. If present, /etc/hostid is included in the image
2. Pool imports are read/write by default
3. Dracut-style root=zfs:<filesystem> arguments are recognized

[1] https://github.com/archzfs/archzfs/tree/master/src/zfs-utils
2021-05-17 18:02:45 +02:00

90 lines
2.9 KiB
Bash

# Template file for 'mkinitcpio'
pkgname=mkinitcpio
version=30
revision=1
build_style=gnu-makefile
hostmakedepends="asciidoc"
depends="busybox-static bsdtar bash"
checkdepends="busybox-static"
short_desc="Next generation of initramfs creation"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
license="GPL-2.0-only"
homepage="https://git.archlinux.org/mkinitcpio.git"
distfiles="https://sources.archlinux.org/other/${pkgname}/${pkgname}-${version}.tar.gz"
checksum=c7725035a06d2ab6ef6e97601b69859d6061aec95c4551e2a1ad2e27d307258f
conf_files="/etc/mkinitcpio.conf"
patch_args="-Np1"
replaces="mkinitcpio-udev>=0"
pre_check() {
sed -i -e '1s,/lib/initcpio/busybox,/usr/bin/busybox.static,' test/*
}
post_install() {
# Install udev hooks
vinstall ${FILESDIR}/udev_hook 644 usr/lib/initcpio/hooks udev
vinstall ${FILESDIR}/udev_install 644 usr/lib/initcpio/install udev
# Remove unneeded systemd bits
rm -rf ${DESTDIR}/usr/lib/kernel
rm -rf ${DESTDIR}/usr/lib/systemd
rm -rf ${DESTDIR}/usr/lib/initcpio/install/sd*
rm -rf ${DESTDIR}/usr/lib/tmpfiles.d
# Remove unneeded pacman hooks
rm -rf ${DESTDIR}/usr/share/libalpm
ln -s /usr/bin/busybox.static $DESTDIR/usr/lib/initcpio/busybox
vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-mkinitcpio
vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-mkinitcpio
}
mkinitcpio-lvm2_package() {
depends="${sourcepkg}>=${version}_${revision} lvm2 thin-provisioning-tools"
short_desc+=" - lvm2 support"
pkg_install() {
vinstall ${FILESDIR}/lvm2_hook 644 usr/lib/initcpio/hooks lvm2
vinstall ${FILESDIR}/lvm2_install 644 usr/lib/initcpio/install lvm2
for RULES in ${FILESDIR}/*.rules; do
vinstall $RULES 644 usr/lib/initcpio/udev $(basename $RULES)
done
}
}
mkinitcpio-encrypt_package() {
depends="${sourcepkg}>=${version}_${revision}
${sourcepkg}-lvm2>=${version}_${revision} cryptsetup"
short_desc+=" - encrypt support"
pkg_install() {
vinstall ${FILESDIR}/encrypt_hook 644 usr/lib/initcpio/hooks encrypt
vinstall ${FILESDIR}/encrypt_install 644 usr/lib/initcpio/install encrypt
}
}
mkinitcpio-mdadm_package() {
depends="${sourcepkg}>=${version}_${revision} mdadm"
short_desc+=" - mdadm support"
pkg_install() {
vinstall ${FILESDIR}/mdadm_hook 644 usr/lib/initcpio/hooks mdadm
vinstall ${FILESDIR}/mdadm_install 644 usr/lib/initcpio/install mdadm
vinstall ${FILESDIR}/mdadm_udev_install 644 usr/lib/initcpio/install mdadm_udev
}
}
mkinitcpio-xbps_package() {
depends="${sourcepkg}>=${version}_${revision} xbps"
short_desc+=" - xbps support"
pkg_install() {
vinstall ${FILESDIR}/xbps_install 644 usr/lib/initcpio/install xbps
}
}
mkinitcpio-zfs_package() {
depends="${sourcepkg}>=${version}_${revision} zfs"
short_desc+=" - ZFS support"
pkg_install() {
vinstall ${FILESDIR}/zfs_hook 644 usr/lib/initcpio/hooks zfs
vinstall ${FILESDIR}/zfs_install 644 usr/lib/initcpio/install zfs
}
}