[neon/ubuntu-core] /: Guess where the OVMF file is instead of hard-coding

Kevin Ottens null at kde.org
Wed Apr 3 13:41:36 BST 2024


Git commit aa53215779b4f6f3ee83016e12c216fa1b8c0ac9 by Kevin Ottens.
Committed on 03/04/2024 at 12:41.
Pushed by ervin into branch 'master'.

Guess where the OVMF file is instead of hard-coding

M  +19   -1    run-image.sh

https://invent.kde.org/neon/ubuntu-core/-/commit/aa53215779b4f6f3ee83016e12c216fa1b8c0ac9

diff --git a/run-image.sh b/run-image.sh
index c3c80f0..b859767 100755
--- a/run-image.sh
+++ b/run-image.sh
@@ -1,11 +1,29 @@
 #! /bin/sh
 
+set -e
+
+find_ovmf_bin() {
+    for f in \
+        "/usr/share/OVMF/OVMF_CODE.fd" \
+        "/usr/share/ovmf/x64/OVMF_CODE.fd" \
+        "/usr/share/qemu/ovmf-x86_64-code.binn" \
+    ; do
+        if [ -f "$f" ]; then
+            echo $f
+            return 0
+        fi
+    done
+    echo "Didn't find any usable OVMF code file!" 1>&2;
+    return 1
+}
+
 IMAGE=$1
+OVMF_BIN=`find_ovmf_bin`
 
 qemu-system-x86_64 -smp 2 -m 2048 -machine accel=kvm \
       -display gtk,gl=on \
       -net nic,model=virtio -net user,hostfwd=tcp::8022-:22 \
-      -drive file=/usr/share/qemu/ovmf-x86_64.bin,if=pflash,format=raw,unit=0,readonly=on \
+      -drive file=$OVMF_BIN,if=pflash,format=raw,unit=0,readonly=on \
       -drive file=$IMAGE,cache=none,format=raw,id=main,if=none \
       -device virtio-blk-pci,drive=main,bootindex=1 \
       -audiodev pa,id=snd0 \


More information about the Neon-commits mailing list