From d5c8d071df6478860a6b84fd5edfb78de0e48643 Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Wed, 20 Jan 2021 22:51:22 +0100 Subject: [PATCH 1/2] scripts/ifup.sh: Set `errexit` shell option Without the shell option, if there is any error (e.g. brctl not installed), QEMU will boot regardless. In such case, the error may go unnoticed, given the amount of information dumped on the screen by the boot sequence. --- scripts/ifup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/ifup.sh b/scripts/ifup.sh index e79db66..1f3e5b9 100755 --- a/scripts/ifup.sh +++ b/scripts/ifup.sh @@ -1,4 +1,6 @@ #!/bin/sh +set -o errexit + brctl addif virbr0 $1 ifconfig $1 up From 76f026b08b3f0b3c1088a3b9f1641a937900ddf0 Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Wed, 20 Jan 2021 23:00:24 +0100 Subject: [PATCH 2/2] ifup.sh: Add helpful message for when the `brctl` command is not found In Ubuntu [20.04] for example, the package is not installed by default. --- scripts/ifup.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/ifup.sh b/scripts/ifup.sh index 1f3e5b9..770eb78 100755 --- a/scripts/ifup.sh +++ b/scripts/ifup.sh @@ -2,5 +2,10 @@ set -o errexit +if ! [ -x "$(command -v brctl)" ]; then + >&2 echo '`brctl` could not be found; please double check that the package is installed.' + exit 1 +fi + brctl addif virbr0 $1 ifconfig $1 up