summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-01-04 21:43:52 +0100
committerThomas Haller <thaller@redhat.com>2023-01-05 08:17:24 +0100
commit897a96da7b3aa9218be499ef6ad074790e9f2101 (patch)
tree76e668652243e027981338ffb95bf44c80cae18f
parent81527052d78f9328d2b90aaef70329682725be5a (diff)
downloadNetworkManager-897a96da7b3aa9218be499ef6ad074790e9f2101.tar.gz
contrib: default to run same fedora version in nm-in-container.sh as host
If the out host runs Fedora, it's most useful that the container is the same Fedora version. Detect it.
-rwxr-xr-xcontrib/scripts/nm-in-container.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/scripts/nm-in-container.sh b/contrib/scripts/nm-in-container.sh
index 129eb33c99..f2c34810a7 100755
--- a/contrib/scripts/nm-in-container.sh
+++ b/contrib/scripts/nm-in-container.sh
@@ -34,7 +34,14 @@ set -e
# running a CI test.
###############################################################################
-BASE_IMAGE="${BASE_IMAGE:-fedora:latest}"
+if [ -z "$BASE_IMAGE" ]; then
+ if grep -q "^ID=fedora$" /etc/os-release 2>/dev/null ; then
+ BASE_IMAGE="$(sed -n 's/^VERSION_ID=\([0-9]\+\)$/fedora:\1/p' /etc/os-release)"
+ fi
+fi
+if [ -z "$BASE_IMAGE" ]; then
+ BASE_IMAGE=fedora:latest
+fi
BASEDIR_NM="$(readlink -f "$(dirname "$(readlink -f "$0")")/../..")"
BASEDIR="$BASEDIR_NM/contrib/scripts/nm-in-container.d"