add cros fixes

This commit is contained in:
BomberFish 2023-03-15 12:26:15 -04:00
parent ccd5d9f526
commit 5f39250003

View file

@ -1066,7 +1066,7 @@ get_distro() {
# Chrome OS doesn't conform to the /etc/*-release standard. # Chrome OS doesn't conform to the /etc/*-release standard.
# While the file is a series of variables they can't be sourced # While the file is a series of variables they can't be sourced
# by the shell since the values aren't quoted. # 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' distro='Chrome OS'
elif type -p guix >/dev/null; then elif type -p guix >/dev/null; then
@ -1112,11 +1112,14 @@ get_distro() {
esac esac
elif [[ $(< /proc/version) == *chrome-bot* || -f /dev/cros_ec ]]; then 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_BRANCH_NUMBER=([0-9]+)' /etc/lsb-release | cut -d= -f2)
[[ $distro != *Chrome* ]] && [[ $distro != *Chrome* ]] &&
case $distro_shorthand in case $distro_shorthand in
on) distro+=" [Chrome OS]" ;; on) distro+=" [Chrome OS $cros_version]" ;;
tiny) distro="Chrome OS" ;; tiny) distro="Chrome OS $cros_version" ;;
*) distro+=" on Chrome OS" ;; *) distro+="Chrome OS $cros_version" ;;
esac esac
distro=${distro## on } distro=${distro## on }
fi fi