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.
This commit is contained in:
Thomas Haller 2023-01-04 21:43:52 +01:00
parent 81527052d7
commit 897a96da7b
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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"