diff --git a/51-dracut-rescue-postinst.sh b/51-dracut-rescue-postinst.sh index 8b4e6c3d..e290f1a1 100755 --- a/51-dracut-rescue-postinst.sh +++ b/51-dracut-rescue-postinst.sh @@ -8,6 +8,11 @@ KERNEL_VERSION="$1" KERNEL_IMAGE="$2" [[ -f /etc/os-release ]] && . /etc/os-release + +if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then + systemd-machine-id-setup +fi + [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id [[ $MACHINE_ID ]] || exit 1 diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install index 1c0a6e11..39d01a76 100755 --- a/51-dracut-rescue.install +++ b/51-dracut-rescue.install @@ -31,7 +31,13 @@ dropindirs_sort() } [[ -f /etc/os-release ]] && . /etc/os-release + +if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then + systemd-machine-id-setup +fi + [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id + if [[ -f /etc/kernel/cmdline ]]; then readarray -t BOOT_OPTIONS < /etc/kernel/cmdline fi