Skip to content

Commit 1b02882

Browse files
authored
Merge pull request #170 from StefanScherer/check-docker-desktop
[DESKTOP-2757] Check for macOS and WSL and suggest Docker Desktop
2 parents b50fac9 + eb9f7d5 commit 1b02882

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

install.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,22 @@ is_dry_run() {
8181
fi
8282
}
8383

84+
is_wsl() {
85+
case "$(uname -r)" in
86+
*microsoft* ) true ;; # WSL 2
87+
*Microsoft* ) true ;; # WSL 1
88+
* ) false;;
89+
esac
90+
}
91+
92+
is_darwin() {
93+
case "$(uname -s)" in
94+
*darwin* ) true ;;
95+
*Darwin* ) true ;;
96+
* ) false;;
97+
esac
98+
}
99+
84100
deprecation_notice() {
85101
distro=$1
86102
date=$2
@@ -283,6 +299,18 @@ do_install() {
283299
lsb_dist=$( get_distribution )
284300
lsb_dist="$(echo "$lsb_dist" | tr '[:upper:]' '[:lower:]')"
285301

302+
if is_wsl; then
303+
echo
304+
echo "WSL DETECTED: We recommend using Docker Desktop for Windows."
305+
echo "Please get Docker Desktop from https://www.docker.com/products/docker-desktop"
306+
echo
307+
cat >&2 <<-'EOF'
308+
309+
You may press Ctrl+C now to abort this script.
310+
EOF
311+
( set -x; sleep 20 )
312+
fi
313+
286314
case "$lsb_dist" in
287315

288316
ubuntu)
@@ -465,6 +493,15 @@ do_install() {
465493
exit 0
466494
;;
467495
*)
496+
if [ -z "$lsb_dist" ]; then
497+
if is_darwin; then
498+
echo
499+
echo "ERROR: Unsupported operating system 'macOS'"
500+
echo "Please get Docker Desktop from https://www.docker.com/products/docker-desktop"
501+
echo
502+
exit 1
503+
fi
504+
fi
468505
echo
469506
echo "ERROR: Unsupported distribution '$lsb_dist'"
470507
echo

0 commit comments

Comments
 (0)