diff --git a/run_qemu.sh b/run_qemu.sh index a148704..14ef27d 100755 --- a/run_qemu.sh +++ b/run_qemu.sh @@ -932,13 +932,25 @@ update_rootfs_boot_kernel() sudo cp "$builddir/mkosi.extra/boot/vmlinuz-$kver" "$builddir/mnt/run-qemu-kernel/$kver/vmlinuz" defconf="$builddir/mnt/loader/loader.conf" + local loader_timeout=4 + + # mkosi->"bootctl install ..." creates a stub loader.conf. + # It can also come from a previous run of this script. if [ -f "$defconf" ]; then - sudo sed -i -e 's/^#.*timeout.*/timeout 4/' "$defconf" - sudo sed -i -e '/default.*/d' "$defconf" - else - echo "timeout 4" | sudo tee "$defconf" + # Comment out existing values. Last value seems to win but it's not + # documented in "man loader.conf" so let's not rely on it + sudo sed -i -e 's/^[[:blank:]]*timeout\(.*\)/# timeout \1/' "$defconf" + sudo sed -i -e 's/^[[:blank:]]*default\(.*\)/# default \1/' "$defconf" fi - echo "default run-qemu-kernel-$kver.conf" | sudo tee -a "$defconf" + + { + generatedfrom_header "update_rootfs_boot_kernel() >> $defconf" + cat <