better os-release handling, and sunos ascii
This commit is contained in:
parent
9985e6cfe9
commit
fcd62e9043
34
pfetch
34
pfetch
|
@ -154,19 +154,23 @@ get_os() {
|
||||||
if command -v lsb_release; then
|
if command -v lsb_release; then
|
||||||
distro=$(lsb_release -sd)
|
distro=$(lsb_release -sd)
|
||||||
|
|
||||||
# lsb_release sometimes adds quotes around the output,
|
|
||||||
# this simply remove quotes from the start/end if they
|
|
||||||
# exist.
|
|
||||||
distro=${distro##\"}
|
|
||||||
distro=${distro%%\"}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
# Disable warning about shellcheck not being able
|
# This used to be a simple '. /etc/os-release' but I believe
|
||||||
# to read '/etc/os-release'. This is fine.
|
# this is insecure as we blindly execute whatever is in the
|
||||||
# shellcheck source=/dev/null
|
# file. This parser instead simply handles 'key=val', treating
|
||||||
. /etc/os-release && distro=$PRETTY_NAME
|
# the file contents as plain-text.
|
||||||
|
while IFS='=' read -r key val; do
|
||||||
|
case $key in
|
||||||
|
PRETTY_NAME) distro=$val ;;
|
||||||
|
esac
|
||||||
|
done < /etc/os-release
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 'os-release' and 'lsb_release' sometimes add quotes
|
||||||
|
# around the distribution name, strip them.
|
||||||
|
distro=${distro##[\"\']}
|
||||||
|
distro=${distro%%[\"\']}
|
||||||
|
|
||||||
# Special cases for (independent) distributions which
|
# Special cases for (independent) distributions which
|
||||||
# don't follow any os-release/lsb standards whatsoever.
|
# don't follow any os-release/lsb standards whatsoever.
|
||||||
command -v crux && distro=$(crux)
|
command -v crux && distro=$(crux)
|
||||||
|
@ -1029,6 +1033,16 @@ get_ascii() {
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
[Ss]un[Oo][Ss])
|
||||||
|
read_ascii 3 <<-EOF
|
||||||
|
${c3} . .; .
|
||||||
|
. :; :: ;: .
|
||||||
|
.;. .. .. .;.
|
||||||
|
.. .. .. ..
|
||||||
|
.;, ,;.
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
|
||||||
[Uu]buntu*)
|
[Uu]buntu*)
|
||||||
read_ascii 3 <<-EOF
|
read_ascii 3 <<-EOF
|
||||||
${c3} _
|
${c3} _
|
||||||
|
|
Loading…
Reference in New Issue
Block a user