[F] Use /etc/debian_version to get .x on Debian

/etc/os-release on Debian only reports the major
version, so use mix os-release and debian_version
to build PRETTY_NAME.

Signed-off-by: Bailey Kasin <baileykasin@gmail.com>
This commit is contained in:
Bailey Kasin 2023-09-25 18:33:33 -07:00
parent 74d1bb5622
commit ff8f9b2879
No known key found for this signature in database
GPG key ID: AE53A329D7F3716E

View file

@ -1159,12 +1159,22 @@ get_distro() {
fi
elif type -p lsb_release >/dev/null; then
# Debian does not include .x versions in /etc/os-version, but does in debian_version
if [[ -f /etc/debian_version ]]; then
. /etc/os-release
case $distro_shorthand in
on) distro="${NAME}" ;;
tiny) distro="$(lsb_release -si)" ;;
*) distro="${NAME} $(< /etc/debian_version) (${VERSION_CODENAME})" ;;
esac
else
case $distro_shorthand in
on) lsb_flags=-si ;;
tiny) lsb_flags=-si ;;
*) lsb_flags=-sd ;;
esac
distro=$(lsb_release "$lsb_flags")
fi
elif [[ -f /etc/os-release || \
-f /usr/lib/os-release || \