Created
August 24, 2020 05:10
-
-
Save ImSingee/f791d660c1527e96a03ea69e957ddca5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -e | |
| is_wsl() { | |
| case "$(uname -r)" in | |
| *microsoft* ) true ;; # WSL 2 | |
| *Microsoft* ) true ;; # WSL 1 | |
| * ) false;; | |
| esac | |
| } | |
| is_darwin() { | |
| case "$(uname -s)" in | |
| *darwin* ) true ;; | |
| *Darwin* ) true ;; | |
| * ) false;; | |
| esac | |
| } | |
| get_distribution() { | |
| lsb_dist="" | |
| # Every system that we officially support has /etc/os-release | |
| if [ -r /etc/os-release ]; then | |
| lsb_dist="$(. /etc/os-release && echo "$ID")" | |
| fi | |
| # Returning an empty string here should be alright since the | |
| # case statements don't act unless you provide an actual value | |
| echo "$lsb_dist" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment