Distro add back full lsb_release support. Closes #493

This commit is contained in:
Dylan Araps 2016-12-05 09:13:19 +11:00
parent 772bf3b3f1
commit b5485bea7a

View file

@ -64,6 +64,14 @@ get_distro() {
*) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)" *) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)"
esac esac
elif type -p lsb_release >/dev/null; then
case "$distro_shorthand" in
"on") lsb_flags="-sir" ;;
"tiny") lsb_flags="-si" ;;
*) lsb_flags="-sd" ;;
esac
distro="$(lsb_release $lsb_flags)"
elif type -p guix >/dev/null; then elif type -p guix >/dev/null; then
distro="GuixSD" distro="GuixSD"
@ -83,15 +91,6 @@ get_distro() {
source "$file" && break source "$file" && break
done done
# If the os-release file identifies the system as "Ubuntu"
# we then use /etc/lsb-release to get the distro information.
# This is required since Linux Mint and other distros
# aren't using the os-release file correctly.
if [[ "$NAME" =~ "Ubuntu" ]]; then
source /etc/lsb-release
unset NAME VERSION_ID PRETTY_NAME UBUNTU_CODENAME
fi
# Format the distro name. # Format the distro name.
case "$distro_shorthand" in case "$distro_shorthand" in
"on") distro="${NAME:-${DISTRIB_ID}} ${VERSION_ID:-${DISTRIB_RELEASE}}" ;; "on") distro="${NAME:-${DISTRIB_ID}} ${VERSION_ID:-${DISTRIB_RELEASE}}" ;;