Change Linux build script to recognize more supported distributions

This changes the way the Linux build script recognizes which
distribution script might be compatible with the host OS.  It
does so by checking both the `ID` and `ID_LIKE` tags in
`/etc/os-release` against available scripts in `linux.d`.  First match
is used.

Note that ID_LIKE isn't a 100% compatability guarantee, but it gives the
user a fighting chance that the script will work for their distribution,
and should reduce the need for manual addition of more distribution
targets.
This commit is contained in:
Billiam Crashkopf 2025-01-03 14:01:00 -08:00 committed by Lane.Wei
parent 626f1390b2
commit 049e5f5385
1 changed files with 17 additions and 8 deletions

View File

@ -84,17 +84,26 @@ fi
DISTRIBUTION=$(awk -F= '/^ID=/ {print $2}' /etc/os-release) DISTRIBUTION=$(awk -F= '/^ID=/ {print $2}' /etc/os-release)
VERSION=$(awk -F= '/^VERSION_ID=/ {print $2}' /etc/os-release) VERSION=$(awk -F= '/^VERSION_ID=/ {print $2}' /etc/os-release)
# treat ubuntu as debian # OSLIKE is a space-delineated list of similar distributions
if [ "${DISTRIBUTION}" == "ubuntu" ] OSLIKE=$(awk -F= '/^ID_LIKE=/ {print $2}' /etc/os-release | tr -d '"')
then
DISTRIBUTION="debian" # Iterate over a list of candidate distribution targets, first match is used
fi for CANDIDATE in ${DISTRIBUTION} ${OSLIKE}; do
if [ ! -f ./linux.d/${DISTRIBUTION} ] if [ -f ./linux.d/${CANDIDATE} ]
then
TARGET_DISTRO="${CANDIDATE}"
break
fi
done
if [ -z ${TARGET_DISTRO} ]
then then
echo "Your distribution does not appear to be currently supported by these build scripts" echo "Your distribution does not appear to be currently supported by these build scripts"
exit 1 exit 1
fi fi
source ./linux.d/${DISTRIBUTION}
echo "OS distribution is '${DISTRIBUTION}'. Using package dependencies for '${TARGET_DISTRO}'."
source ./linux.d/${TARGET_DISTRO}
echo "FOUND_GTK3=${FOUND_GTK3}" echo "FOUND_GTK3=${FOUND_GTK3}"
if [[ -z "${FOUND_GTK3_DEV}" ]] if [[ -z "${FOUND_GTK3_DEV}" ]]
@ -196,4 +205,4 @@ echo "[9/9] Generating Linux app..."
fi fi
popd popd
echo "done" echo "done"
fi fi