Check if lsb_release exists before using it (#302)

This commit is contained in:
bobslept 2021-12-07 17:43:29 +01:00 committed by GitHub
parent 4c5681b2d8
commit 4d30f771e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -7,9 +7,14 @@ SCRIPT_PATH=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "${SCRIPT_PATH}")
cd "${SCRIPT_DIR}"
distro="$(lsb_release -is)"
release="$(lsb_release -rs)"
codename="$(lsb_release -cs)"
# check if lsb_release exists on the system before using it
if command -v lsb_release > /dev/null
then
distro="$(lsb_release -is)"
release="$(lsb_release -rs)"
codename="$(lsb_release -cs)"
fi
sep="\n-------------------------------------------------------------------------------"
# functions