kernel-install: respect $MACHINE_ID and ignore /etc/machine-id if on tmpfs
Confer https://github.com/systemd/systemd/pull/19006#issuecomment-800234022: On some systems it's the admin's explicit choice not to to have the machine ID leak into the ESP On some systems the machine ID is transient, generated at every boot, and hence should not be written to the ESP
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
733caba389
commit
dcd9d196a4
@@ -85,20 +85,14 @@ fi
|
||||
KERNEL_VERSION="$1"
|
||||
KERNEL_IMAGE="$2"
|
||||
|
||||
# Reuse directory created without a machine ID present if it exists.
|
||||
if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then
|
||||
MACHINE_ID="Default"
|
||||
elif [[ -f /etc/machine-id ]]; then
|
||||
read MACHINE_ID < /etc/machine-id
|
||||
else
|
||||
MACHINE_ID="Default"
|
||||
fi
|
||||
|
||||
if [[ ! $COMMAND ]] || [[ ! $KERNEL_VERSION ]]; then
|
||||
echo "Not enough arguments" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -z "$MACHINE_ID" ] && [ -f /etc/machine-id ] && [ "$(stat -fc %T /etc/machine-id)" != "tmpfs" ] && read -r MACHINE_ID < /etc/machine-id
|
||||
[ -z "$MACHINE_ID" ] && MACHINE_ID="Default"
|
||||
|
||||
if [[ -d /efi/loader/entries ]] || [[ -d /efi/$MACHINE_ID ]]; then
|
||||
ENTRY_DIR_ABS="/efi/$MACHINE_ID/$KERNEL_VERSION"
|
||||
elif [[ -d /boot/loader/entries ]] || [[ -d /boot/$MACHINE_ID ]]; then
|
||||
@@ -113,7 +107,7 @@ else
|
||||
ENTRY_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
|
||||
fi
|
||||
|
||||
export KERNEL_INSTALL_MACHINE_ID=$MACHINE_ID
|
||||
export KERNEL_INSTALL_MACHINE_ID="$MACHINE_ID"
|
||||
|
||||
ret=0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user