From b177d4f6f657e7713548c63f8b1a3b553ecfd7b9 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Dec 2016 07:49:27 +1100 Subject: [PATCH 1/4] Distro: Add back lsb_release detection --- neofetch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/neofetch b/neofetch index d95e5fd1..407b8f13 100755 --- a/neofetch +++ b/neofetch @@ -90,6 +90,19 @@ get_distro() { "off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME}" ;; esac + # If the os-release file identifies the system as "Ubuntu" + # we then use 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 [[ "$distro" =~ "Ubuntu" ]]; then + case "$distro_shorthand" in + "on") lsb_flags="-sir" ;; + "tiny") lsb_flags="-si" ;; + "on") lsb_flags="-sd" ;; + esac + distro="$(lsb_release $lsb_flags)" + fi + # Workarounds for distros that go against the os-release standard. [[ -z "${distro// }" ]] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease /usr/lib/*ease)" [[ -z "${distro// }" ]] && distro="$(awk -F'=' '{print $2; exit}' /etc/*ease /usr/lib/*ease)" From 25fa44b2efc675b0c9a2342abad6d78395e9c0be Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Dec 2016 08:37:28 +1100 Subject: [PATCH 2/4] Distro: Use /etc/lsb-release file instead --- neofetch | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/neofetch b/neofetch index 407b8f13..bc5a92dc 100755 --- a/neofetch +++ b/neofetch @@ -83,26 +83,22 @@ get_distro() { source "$file" && break done - # The 3rd line down matches the fold marker syntax. {{{ + # 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. case "$distro_shorthand" in "on") distro="${NAME:-${DISTRIB_ID}} ${VERSION_ID:-${DISTRIB_RELEASE}}" ;; "tiny") distro="${NAME:-${DISTRIB_ID:-${TAILS_PRODUCT_NAME}}}" ;; "off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME}" ;; esac - # If the os-release file identifies the system as "Ubuntu" - # we then use 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 [[ "$distro" =~ "Ubuntu" ]]; then - case "$distro_shorthand" in - "on") lsb_flags="-sir" ;; - "tiny") lsb_flags="-si" ;; - "on") lsb_flags="-sd" ;; - esac - distro="$(lsb_release $lsb_flags)" - fi - # Workarounds for distros that go against the os-release standard. [[ -z "${distro// }" ]] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease /usr/lib/*ease)" [[ -z "${distro// }" ]] && distro="$(awk -F'=' '{print $2; exit}' /etc/*ease /usr/lib/*ease)" From 3766833329646deab7c5e07967be832522c0722d Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Dec 2016 09:14:41 +1100 Subject: [PATCH 3/4] Distro: Add DISTRIB_CODENAME --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index bc5a92dc..21cb12aa 100755 --- a/neofetch +++ b/neofetch @@ -96,7 +96,7 @@ get_distro() { case "$distro_shorthand" in "on") distro="${NAME:-${DISTRIB_ID}} ${VERSION_ID:-${DISTRIB_RELEASE}}" ;; "tiny") distro="${NAME:-${DISTRIB_ID:-${TAILS_PRODUCT_NAME}}}" ;; - "off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME}" ;; + "off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME:-${DISTRIB_CODENAME}}" ;; esac # Workarounds for distros that go against the os-release standard. From c8d5044e2e87c8798c4a434f75217ad7bbb18ca8 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Dec 2016 09:20:38 +1100 Subject: [PATCH 4/4] Distro: Remove DISTRIB_CODENAME --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 21cb12aa..bc5a92dc 100755 --- a/neofetch +++ b/neofetch @@ -96,7 +96,7 @@ get_distro() { case "$distro_shorthand" in "on") distro="${NAME:-${DISTRIB_ID}} ${VERSION_ID:-${DISTRIB_RELEASE}}" ;; "tiny") distro="${NAME:-${DISTRIB_ID:-${TAILS_PRODUCT_NAME}}}" ;; - "off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME:-${DISTRIB_CODENAME}}" ;; + "off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME}" ;; esac # Workarounds for distros that go against the os-release standard.