diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-03-17 18:25:40 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-03-22 00:34:49 +0100 |
commit | 41f630598d98466db0c54db25242a6feec6768e0 (patch) | |
tree | 5121f6cc984570896e4b26bd797036084f8a081e /src/kernel-install | |
parent | 80889bd9cc6e4513e0d965c6f263743f858e1982 (diff) | |
download | systemd-41f630598d98466db0c54db25242a6feec6768e0.tar.gz |
kernel-install: check for /loader/entries.srel file as explicit marker for standards compliant /loader/entries directory
Diffstat (limited to 'src/kernel-install')
-rwxr-xr-x | src/kernel-install/kernel-install | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install index 719abf2b81..a09b998362 100755 --- a/src/kernel-install/kernel-install +++ b/src/kernel-install/kernel-install @@ -155,10 +155,29 @@ done [ -z "$ENTRY_TOKEN" ] && ENTRY_TOKEN="$MACHINE_ID" if [ -z "$layout" ]; then - # Administrative decision: if not present, some scripts generate into /boot. - if [ -d "$BOOT_ROOT/$ENTRY_TOKEN" ]; then + # No layout configured by the administrator. Let's try to figure it out + # automatically from metadata already contained in $BOOT_ROOT. + if [ -e "$BOOT_ROOT/loader/entries.srel" ]; then + read -r ENTRIES_SREL <"$BOOT_ROOT/loader/entries.srel" + if [ "$ENTRIES_SREL" = "type1" ]; then + # The loader/entries.srel file clearly indicates that the installed + # boot loader implements the proper standard upstream boot loader + # spec for Type #1 entries. Let's default to that, then. + layout="bls" + else + # The loader/entries.srel file indicates some other spec is + # implemented and owns the /loader/entries/ directory. Since we + # have no idea what that means, let's stay away from it by default. + layout="other" + fi + elif [ -d "$BOOT_ROOT/$ENTRY_TOKEN" ]; then + # If the metadata in $BOOT_ROOT doesn't tell us anything, then check if + # the entry token directory already exists. If so, let's assume it's + # the standard boot loader spec, too. layout="bls" else + # There's no metadata in $BOOT_ROOT, and apparently no entry token + # directory installed? Then we really don't know anything. layout="other" fi fi |