kernel-install: automatically generate "sort-key" field

Let's order by IMAGE_ID=/ID= by default.
This commit is contained in:
Lennart Poettering
2022-02-15 14:27:01 +01:00
parent cf5d9598b6
commit d23b3bfdd6

View File

@@ -62,6 +62,9 @@ fi
[ -n "$PRETTY_NAME" ] || PRETTY_NAME="Linux $KERNEL_VERSION"
SORT_KEY="$IMAGE_ID"
[ -z "$SORT_KEY" ] && SORT_KEY="$ID"
if [ -r /etc/kernel/cmdline ]; then
BOOT_OPTIONS="$(tr -s "$IFS" ' ' </etc/kernel/cmdline)"
elif [ -r /usr/lib/kernel/cmdline ]; then
@@ -130,6 +133,7 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
# See similar logic above for the systemd.machine_id= kernel command line option
echo "machine-id $MACHINE_ID"
fi
[ -n "$SORT_KEY" ] && echo "sort-key $SORT_KEY"
echo "options $BOOT_OPTIONS"
echo "linux $ENTRY_DIR/linux"