1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Dynamically extract python_ver & postgresql_version

This commit is contained in:
root 2022-12-21 13:34:30 -05:00
parent f43aebf491
commit b691bd8252
13 changed files with 55 additions and 31 deletions

View file

@ -11,7 +11,9 @@
STAGE=0
OS="none"
VERSION_ID="none" # This var's combined with the above, before being output
VERSION_ID="none" # Temp var, for: OS_VER="$OS-$VERSION_ID"
OS_VER="none"
PYTHON_VER="none"
IIAB_REMOTE_URL="none"
IIAB_BRANCH="none"
IIAB_COMMIT="none"
@ -63,6 +65,7 @@ OS_VER="$OS-$VERSION_ID"
#"ubuntu-17" | \
#"ubuntu-18" | \
#"ubuntu-19" | \
#"ubuntu-2004" | \
#"ubuntu-2104" | \
#"ubuntu-2110" | \
#"centos-7" | \
@ -76,7 +79,6 @@ OS_VER="$OS-$VERSION_ID"
case $OS_VER in
"debian-11" | \
"debian-12" | \
"ubuntu-2004" | \
"ubuntu-2204" | \
"ubuntu-2210" | \
"ubuntu-2304" | \
@ -123,6 +125,13 @@ tmp=$(ansible --version) &&
#ANSIBLE_VERSION=$(echo "$tmp" | head -1 | awk '{print $2}')
#ANSIBLE_VERSION=$(echo "$tmp" | head -1 | sed -e 's/.* //')
if tmp=$(python3 -c 'from sys import version_info; print("%s.%s" % (version_info.major, version_info.minor));'); then
PYTHON_VER=$tmp
else
echo -e "\e[1m\nPython 3 is REQUIRED for Internet-in-a-Box. You might want to run:\n\nsudo apt install python3\n\e[0m"
exit 1
fi
# THE LAST 3 BELOW ARE DIFFERENT as "systemctl is-enabled" unhelpfully returns
# the same error code (i.e. 1) REGARDLESS whether the service is (A) disabled
@ -159,5 +168,6 @@ cat <<EOF
"devicetree_model" : "$DEVICETREE_MODEL",
"ansible_version" : "$ANSIBLE_VERSION",
"os" : "$OS",
"os_ver" : "$OS_VER"}
"os_ver" : "$OS_VER",
"python_ver" : "$PYTHON_VER"}
EOF