diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2019-10-01 00:44:22 +0300 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2019-10-01 00:44:22 +0300 |
| commit | 146c6b6baee1371afa32c772aa60862e84df9ebb (patch) | |
| tree | 3c0a2f54c4264abcc79b5e6f882518e040002c5c | |
| parent | d8becf6692b702a1f11ec841a5fa82d89399023e (diff) | |
| download | pfetch-146c6b6baee1371afa32c772aa60862e84df9ebb.tar.gz | |
pfetch: Fix WSL2 detection.
| -rwxr-xr-x | pfetch | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -177,17 +177,23 @@ get_os() { command -v guix && distro='Guix System' # Check to see if Linux is running in Windows 10 under - # WSL (Windows subsystem for Linux) and append a string - # accordingly. + # WSL1 (Windows subsystem for Linux [version 1]) and + # append a string accordingly. # # If the kernel version string ends in "-Microsoft", - # we're very likely running under Windows 10 in WSL. - # - # This also acts as a means of allowing the user to - # fake this by changing their kernel version to end in - # "Microsoft". + # we're very likely running under Windows 10 in WSL1. [ "${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*) |
