8 [[ -f /etc
/os-release
]] && .
/etc
/os-release
10 if [[ ! -f /etc
/machine-id
]] ||
[[ ! -s /etc
/machine-id
]]; then
11 systemd-machine-id-setup
14 [[ -f /etc
/machine-id
]] && read MACHINE_ID
< /etc
/machine-id
16 [[ $MACHINE_ID ]] ||
exit 1
17 [[ -f $KERNEL_IMAGE ]] ||
exit 1
19 INITRDFILE
="/boot/initramfs-0-rescue-${MACHINE_ID}.img"
20 NEW_KERNEL_IMAGE
="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}"
22 [[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0
29 while (( $# > 0 )); do
30 for i
in ${1}/*${suffix}; do
31 [[ -f $i ]] && echo ${i##*/}
38 for d
in "${args[@]}"; do
39 if [[ -f "$d/$f" ]]; then
47 # source our config dir
48 for f
in $
(dropindirs_sort
".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
52 [[ $dracut_rescue_image != "yes" ]] && exit 0
54 if [[ ! -f $INITRDFILE ]]; then
55 dracut
--no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION"
59 if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
60 cp "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
64 new-kernel-pkg
--install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID"