Skip to content

Commit

Permalink
kernel-install: ignore errors when reading /etc/machine-id
Browse files Browse the repository at this point in the history
If /etc/machine-id doesn't end with a newline (which is wrong, but it
can happen), kernel-install fails. That's because `read` returns 1 if it
reaches EOF and we're using `set -e`. Let's just ignore that error, as
it doesn't matter: we have either read a valid machine ID, in which case
we continue, or we haven't, in which case we exit anyway.

RHEL-only: feature

Resolves: RHEL-50672
  • Loading branch information
dtardon authored and github-actions[bot] committed Aug 1, 2024
1 parent 09d24c0 commit 86572fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/kernel-install/kernel-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ if [ -z "$MACHINE_ID" ] && [ -f /etc/machine-info ]; then
log_verbose "machine-id $MACHINE_ID acquired from /etc/machine-info"
fi
if [ -z "$MACHINE_ID" ] && [ -s /etc/machine-id ]; then
read -r MACHINE_ID </etc/machine-id
read -r MACHINE_ID </etc/machine-id || :
if [ "$MACHINE_ID" = "uninitialized" ]; then
unset MACHINE_ID
elif [ {{ '${#MACHINE_ID}' }} -ne 32 ]; then
Expand Down

0 comments on commit 86572fe

Please sign in to comment.