Skip to content

Commit 5343182

Browse files
[PR] dylanaraps/neofetch#2305 from BomberFish - Fix Chrome OS.
Upstream PR: dylanaraps/neofetch#2305 Thanks to @bomberfish Co-authored-by: BomberFish <[email protected]>
2 parents dcff083 + 9363999 commit 5343182

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

neofetch

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,12 @@ get_distro() {
11871187
elif [[ -f /etc/vzlinux-release ]]; then
11881188
distro='VzLinux'
11891189

1190+
# Chrome OS doesn't conform to the /etc/*-release standard.
1191+
# While the file is a series of variables they can't be sourced
1192+
# by the shell since the values aren't quoted.
1193+
elif grep -q CHROMEOS /etc/lsb-release; then
1194+
distro='Chrome OS'
1195+
11901196
elif type -p guix >/dev/null; then
11911197
case $distro_shorthand in
11921198
on|tiny) distro="Guix System" ;;
@@ -1255,11 +1261,14 @@ get_distro() {
12551261
distro='Chrome OS'
12561262

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

0 commit comments

Comments
 (0)