Skip to content

Commit

Permalink
Fix Chrome OS (dylanaraps#2305)
Browse files Browse the repository at this point in the history
  • Loading branch information
hayatehay committed Mar 19, 2023
1 parent 5d53584 commit ed45c21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Add Floflis (dylanaraps#2289)
* Simple improvements for Solaris (dylanaraps#2293)
* Add Salient OS (dylanaraps#2301)
* Fix Chrome OS (dylanaraps#2305)

# 1.2
* Update Makefile & CONTRIBUTING.md (dylanaraps#2245 & dylanaraps#2246)
Expand Down
11 changes: 7 additions & 4 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -1221,15 +1221,18 @@ get_distro() {
# 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 [[ -f /etc/lsb-release && $(< /etc/lsb-release) == *CHROMEOS* ]]; then
elif grep -q CHROMEOS /etc/lsb-release; then
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" ;;
tiny) distro="Chrome OS" ;;
*) distro="Chrome OS $distro" ;;
on) distro+=" [Chrome OS $cros_version]" ;;
tiny) distro="Chrome OS $cros_version" ;;
*) distro+="Chrome OS $cros_version" ;;
esac
fi

Expand Down

0 comments on commit ed45c21

Please sign in to comment.