Skip to content

Commit

Permalink
[PR] dylanaraps/neofetch#2305 from BomberFish - Fix Chrome OS.
Browse files Browse the repository at this point in the history
Upstream PR: dylanaraps/neofetch#2305
Thanks to @BomberFish

Co-authored-by: BomberFish <87151697+BomberFish@users.noreply.github.com>
  • Loading branch information
hykilpikonna and BomberFish committed Mar 15, 2023
2 parents dcff083 + 9363999 commit 5343182
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,12 @@ get_distro() {
elif [[ -f /etc/vzlinux-release ]]; then
distro='VzLinux'

# Chrome OS doesn't conform to the /etc/*-release standard.
# While the file is a series of variables they can't be sourced
# by the shell since the values aren't quoted.
elif grep -q CHROMEOS /etc/lsb-release; then
distro='Chrome OS'

elif type -p guix >/dev/null; then
case $distro_shorthand in
on|tiny) distro="Guix System" ;;
Expand Down Expand Up @@ -1255,11 +1261,14 @@ get_distro() {
distro='Chrome OS'

elif [[ $(< /proc/version) == *chrome-bot* || -f /dev/cros_ec ]]; then
# gets chrome os version from /etc/lsb-release.
# totally not written by chatgpt :trolley:
cros_version=$(grep -oE 'CHROMEOS_RELEASE_CHROME_MILESTONE=([0-9]+)' /etc/lsb-release | cut -d= -f2)
[[ $distro != *Chrome* ]] &&
case $distro_shorthand in
on) distro="Chrome OS $distro" ;;
on) distro="Chrome OS $cros_version" ;;
tiny) distro="Chrome OS" ;;
*) distro="Chrome OS $distro" ;;
*) distro="Chrome OS $cros_version $distro" ;;
esac
fi

Expand Down

0 comments on commit 5343182

Please sign in to comment.