5 # do some sanity checks first
6 [ -e /run
/initramfs
/bin
/sh
] && exit 0
7 [ -e /run
/initramfs
/.need_shutdown
] ||
exit 0
9 KERNEL_VERSION
="$(uname -r)"
11 [[ $dracutbasedir ]] || dracutbasedir
=/usr
/lib
/dracut
12 SKIP
="$dracutbasedir/skipcpio"
13 [[ -x $SKIP ]] || SKIP
=cat
15 [[ -f /etc
/machine-id
]] && read MACHINE_ID
< /etc
/machine-id
17 if [[ $MACHINE_ID ]] && [[ -d /boot
/${MACHINE_ID} ||
-L /boot
/${MACHINE_ID} ]] ; then
18 IMG
="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
20 [[ -f $IMG ]] || IMG
="/boot/initramfs-${KERNEL_VERSION}.img"
24 [ -f .need_shutdown
-a -f "$IMG" ] ||
exit 1
25 if $SKIP "$IMG" | zcat |
cpio -id --no-absolute-filenames --quiet >/dev
/null
; then
26 rm -f -- .need_shutdown
27 elif $SKIP "$IMG" | xzcat |
cpio -id --no-absolute-filenames --quiet >/dev
/null
; then
28 rm -f -- .need_shutdown
29 elif $SKIP "$IMG" | lz4
-d -c |
cpio -id --no-absolute-filenames --quiet >/dev
/null
; then
30 rm -f -- .need_shutdown
32 # something failed, so we clean up
33 echo "Unpacking of $IMG to /run/initramfs failed" >&2
34 rm -f -- /run
/initramfs
/shutdown