pfetch: Fix WSL2 detection.

This commit is contained in:
Dylan Araps 2019-10-01 00:44:22 +03:00
parent d8becf6692
commit 146c6b6bae

22
pfetch
View File

@ -177,17 +177,23 @@ get_os() {
command -v guix && distro='Guix System' command -v guix && distro='Guix System'
# Check to see if Linux is running in Windows 10 under # Check to see if Linux is running in Windows 10 under
# WSL (Windows subsystem for Linux) and append a string # WSL1 (Windows subsystem for Linux [version 1]) and
# accordingly. # append a string accordingly.
# #
# If the kernel version string ends in "-Microsoft", # If the kernel version string ends in "-Microsoft",
# we're very likely running under Windows 10 in WSL. # we're very likely running under Windows 10 in WSL1.
#
# This also acts as a means of allowing the user to
# fake this by changing their kernel version to end in
# "Microsoft".
[ "${kernel%%*-Microsoft}" ] || [ "${kernel%%*-Microsoft}" ] ||
distro="$distro on Windows 10" distro="$distro on Windows 10 [WSL1]"
# Check to see if Linux is running in Windows 10 under
# WSL2 (Windows subsystem for Linux [version 2]) and
# append a string accordingly.
#
# If either of these environment variables are defined
# and non-empty, we are very likely running under
# Windows 10 in WSL2.
[ "$WSL_INTEROP" ] || [ "$WSLENV" ] || [ "$WSL_DISTRO_NAME" ] &&
distro="$distro on Windows 10 [WSL1]"
;; ;;
Darwin*) Darwin*)