File: 03-reset-bls-entries

package info (click to toggle)
python-diskimage-builder 3.37.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,572 kB
  • sloc: sh: 7,380; python: 6,444; makefile: 37
file content (34 lines) | stat: -rwxr-xr-x 831 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

if [[ ! '9-stream' =~ ${DIB_RELEASE} ]]; then
    exit 0
fi

# This is a workaround for the grub issue reported upstream with
#  https://bugzilla.redhat.com/show_bug.cgi?id=2032680

# This renames the BLS entries from the upstream .qcow2 image in
# /boot/loader/entries with the current machine-id. This means that in the
# bootloader setup, grub2-mkconfig will update config options as required.

pushd /boot/loader/entries

machine_id=$(</etc/machine-id)

for entry in *.conf; do
    new_entry=$(echo $entry | sed "s/^[a-f0-9]*/$machine_id/")
    echo "renaming $entry to $new_entry for new machine-id"
    if [[ $entry != $new_entry ]]; then
        mv $entry $new_entry
    fi
done
popd

echo "--- Show kernels ---"
grubby --info=ALL