Fail if dracut cant install required binaries (#382)

This commit is contained in:
Itxaka 2024-10-01 14:45:22 +02:00 committed by GitHub
parent adc29fca67
commit 0180749d82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,31 +1,43 @@
#!/bin/bash
# called by dracut
# check() is called by dracut to evaluate the inclusion of a dracut module in the initramfs.
# we always want to have this module so we return 0
check() {
return 0
}
# called by dracut
# The function depends() should echo all other dracut module names the module depends on
depends() {
echo rootfs-block dm fs-lib lvm
return 0
}
# called by dracut
# In installkernel() all kernel related files should be installed
installkernel() {
instmods overlay
}
# called by dracut
# custom function to check if binaries exist before calling inst_multiple
inst_check_multiple() {
for bin in "$@"; do
if ! command -v "$bin" >/dev/null 2>&1; then
derror "Required binary $bin not found!"
exit 1
fi
done
inst_multiple "$@"
}
# The install() function is called to install everything non-kernel related.
install() {
declare moddir=${moddir}
declare systemdutildir=${systemdutildir}
declare systemdsystemunitdir=${systemdsystemunitdir}
inst_multiple immucore
inst_multiple kairos-agent
inst_check_multiple immucore kairos-agent
# add utils used by yip stages
inst_multiple partprobe sync udevadm parted mkfs.ext2 mkfs.ext3 mkfs.ext4 mkfs.vfat mkfs.fat blkid lsblk e2fsck resize2fs mount umount sgdisk rsync cryptsetup growpart sfdisk gawk awk
inst_check_multiple partprobe sync udevadm parted mkfs.ext2 mkfs.ext3 mkfs.ext4 mkfs.vfat mkfs.fat blkid lsblk e2fsck resize2fs mount umount sgdisk rsync cryptsetup growpart sfdisk gawk awk
# Install libraries needed by gawk
inst_libdir_file "libsigsegv.so*"