diff mbox series

[v2,2/3] start-qemu.sh: parse .config.yaml for ease of use

Message ID 20211124143131.939349-3-Quirin.Gylstorff@siemens.com (mailing list archive)
State New
Headers show
Series start-qemu.sh: Add some ease of use functionality | expand

Commit Message

Gylstorff Quirin Nov. 24, 2021, 2:31 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

Suggested-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 README.md     |  6 ++++--
 start-qemu.sh | 16 +++++++++++++++-
 2 files changed, 19 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/README.md b/README.md
index 53ef679..bd707a4 100644
--- a/README.md
+++ b/README.md
@@ -38,8 +38,10 @@  Run, e.g.,
 
     ./start-qemu.sh x86
 
-when having built a QEMU AMD64 image. A security image for QEMU can be started
-like this:
+when having built a QEMU AMD64 image. Using the image configuration menu will
+initialize variables used by start-qemu.sh with fitting defaults.
+
+A security image for QEMU can be started like this:
 
     TARGET_IMAGE=cip-core-image-security ./start-qemu.sh x86
 
diff --git a/start-qemu.sh b/start-qemu.sh
index 2c0a751..94c3611 100755
--- a/start-qemu.sh
+++ b/start-qemu.sh
@@ -20,15 +20,29 @@  usage()
 	exit 1
 }
 
+if grep -s -q "IMAGE_SECURE_BOOT: true" .config.yaml; then
+	SECURE_BOOT="true"
+fi
+
 if [ -n "${QEMU_PATH}" ]; then
 	QEMU_PATH="${QEMU_PATH}/"
 fi
 
 if [ -z "${DISTRO_RELEASE}" ]; then
-  DISTRO_RELEASE="buster"
+	if grep -s -q "DEBIAN_BULLSEYE: true" .config.yaml; then
+		DISTRO_RELEASE="bullseye"
+	elif grep -s -q "DEBIAN_STRETCH: true" .config.yaml; then
+		DISTRO_RELEASE="stretch"
+	else
+		DISTRO_RELEASE="buster"
+	fi
 fi
+
 if [ -z "${TARGET_IMAGE}" ];then
 	TARGET_IMAGE="cip-core-image"
+	if grep -s -q "IMAGE_SECURITY: true" .config.yaml; then
+		TARGET_IMAGE="cip-core-image-security"
+	fi
 fi
 
 case "$1" in