8 # If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory.
9 # So, let's skip to create initrd.
10 if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
14 if [[ -d "$BOOT_DIR_ABS" ]]; then
18 INITRD
="initramfs-${KERNEL_VERSION}.img"
24 INITRD_IMAGE_PREGENERATED
=${KERNEL_IMAGE%/*}/initrd
25 if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
26 # we found an initrd at the same place as the kernel
27 # use this and don't generate a new one
28 cp --reflink=auto
"$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \
29 && chown root
:root
"$BOOT_DIR_ABS/$INITRD" \
30 && chmod 0600 "$BOOT_DIR_ABS/$INITRD" \
34 if [[ -f /etc
/kernel
/cmdline
]]; then
35 read -r -d '' -a BOOT_OPTIONS
< /etc
/kernel
/cmdline
36 elif [[ -f /usr
/lib
/kernel
/cmdline
]]; then
37 read -r -d '' -a BOOT_OPTIONS
< /usr
/lib
/kernel
/cmdline
40 if ! [[ ${BOOT_OPTIONS[*]} ]]; then
41 read -r -d '' -a BOOT_OPTIONS
< /proc
/cmdline
44 unset noimageifnotneeded
46 for ((i
=0; i
< "${#BOOT_OPTIONS[@]}"; i
++)); do
47 if [[ ${BOOT_OPTIONS[$i]} == root\
=PARTUUID\
=* ]]; then
48 noimageifnotneeded
="yes"
52 dracut
-f ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
56 rm -f -- "$BOOT_DIR_ABS/$INITRD"