Merge pull request #406 from dylanaraps/distro3
Distro: [Linux] Source *ease files
This commit is contained in:
commit
edfdbf05a4
30
neofetch
30
neofetch
|
@ -160,26 +160,20 @@ getdistro() {
|
||||||
distro="Android $(getprop ro.build.version.release)"
|
distro="Android $(getprop ro.build.version.release)"
|
||||||
|
|
||||||
else
|
else
|
||||||
# Workarounds are included in every shorthand option
|
# Source the os-release file
|
||||||
|
for file in /etc/*ease /usr/lib/*ease; do
|
||||||
|
source "$file" 2>/dev/null
|
||||||
|
done
|
||||||
|
|
||||||
case "$distro_shorthand" in
|
case "$distro_shorthand" in
|
||||||
"on")
|
"on") distro="${NAME:-${DISTRIB_ID}} ${VERSION_ID:-${DISTRIB_RELEASE}}" ;;
|
||||||
distro="$(awk -F'=' '/^NAME|VERSION_ID=/ {print $2; exit}' /etc/*ease /usr/lib/*ease)"
|
"tiny") distro="${NAME:-${DISTRIB_ID:-"${TAILS_PRODUCT_NAME}"}}" ;;
|
||||||
[ -z "$distro" ] && distro="$(awk -F'=' '/^DISTRIB_ID|DISTRIB_RELEASE=/ {print $2}' /etc/openwrt_release)"
|
"off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME}" ;;
|
||||||
;;
|
|
||||||
|
|
||||||
"tiny")
|
|
||||||
distro="$(awk -F'=' '/^NAME=/ {print $2; exit}' /etc/*ease /usr/lib/*ease)"
|
|
||||||
[ -z "$distro" ] && distro="$(awk -F'=' '/^TAILS_PRODUCT_NAME=/ {print $2}' /etc/*ease)"
|
|
||||||
[ -z "$distro" ] && distro="$(awk -F'=' '/^DISTRIB_ID=/ {print $2}' /etc/openwrt_release)"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
distro="$(awk -F'=' '/^PRETTY_NAME=/ {print $2; exit}' /etc/*ease /usr/lib/*ease)"
|
|
||||||
[ -z "$distro" ] && distro="$(awk -F'=' '{print $2}' /etc/*ease)"
|
|
||||||
[ -z "$distro" ] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease)"
|
|
||||||
[ -z "$distro" ] && distro="$(awk -F'=' '/^DISTRIB_DESCRIPTION=/ {print $2}' /etc/openwrt_release)"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Workarounds for distros that go against the os-release standard.
|
||||||
|
[ -z "$(trim "$distro")" ] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease /usr/lib/*ease)"
|
||||||
|
[ -z "$(trim "$distro")" ] && distro="$(awk -F'=' '{print $2; exit}' /etc/*ease /usr/lib/*ease)"
|
||||||
fi
|
fi
|
||||||
distro="${distro//\"}"
|
distro="${distro//\"}"
|
||||||
distro="${distro//\'}"
|
distro="${distro//\'}"
|
||||||
|
|
Reference in New Issue