Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix Chrome OS. #2305

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ 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 type -p guix >/dev/null; then
Expand Down Expand Up @@ -1112,11 +1112,14 @@ get_distro() {
esac

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]" ;;
tiny) distro="Chrome OS" ;;
*) distro+=" on Chrome OS" ;;
on) distro+=" [Chrome OS $cros_version]" ;;
tiny) distro="Chrome OS $cros_version" ;;
*) distro+="Chrome OS $cros_version" ;;
esac
distro=${distro## on }
fi
Expand Down