5 KERNEL_VERSION
="$(uname -r)"
7 [[ $dracutbasedir ]] || dracutbasedir
=/usr
/lib
/dracut
8 SKIP
="$dracutbasedir/skipcpio"
9 [[ -x $SKIP ]] || SKIP
=cat
11 [[ -f /etc
/machine-id
]] && read MACHINE_ID
< /etc
/machine-id
13 if [[ $MACHINE_ID ]] && [[ -d /boot
/${MACHINE_ID} ||
-L /boot
/${MACHINE_ID} ]] ; then
14 IMG
="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
16 [[ -f $IMG ]] || IMG
="/boot/initramfs-${KERNEL_VERSION}.img"
20 [ -f .need_shutdown
-a -f "$IMG" ] ||
exit 1
21 if $SKIP "$IMG" | zcat |
cpio -id --no-absolute-filenames --quiet >/dev
/null
; then
22 rm -f -- .need_shutdown
23 elif $SKIP "$IMG" | xzcat |
cpio -id --no-absolute-filenames --quiet >/dev
/null
; then
24 rm -f -- .need_shutdown
25 elif $SKIP "$IMG" | lz4
-d -c |
cpio -id --no-absolute-filenames --quiet >/dev
/null
; then
26 rm -f -- .need_shutdown
28 # something failed, so we clean up
29 echo "Unpacking of $IMG to /run/initramfs failed" >&2
30 rm -f -- /run
/initramfs
/shutdown