FIX: the output from which confuses an integer comparison
authorMichael Brown <supermathie@gmail.com>
Fri, 1 Oct 2021 21:17:32 +0000 (17:17 -0400)
committerMichael Brown <michael@mikeandgen.ca>
Fri, 1 Oct 2021 21:33:23 +0000 (17:33 -0400)
Thanks @ldmosquera for identifying the problem and fix

discourse-setup

index df2d5be6908bb5a01cfa212ea269eecc0b6f478e..17678ea2b24424b3c1355e04c8a3271068ad88ba 100755 (executable)
@@ -124,19 +124,16 @@ check_IP_match() {
 ##
 
 check_docker() {
-  (which docker || which docker.io) 2>/dev/null
-  echo $?
+  (which docker || which docker.io) &>/dev/null
 }
 
 check_and_install_docker() {
-  found_docker=$(check_docker)
-  if [ "$found_docker" -ne 0 ]; then
+  if ! check_docker; then
     echo Failed to find docker or docker.io on your PATH.
     read -p "Enter to install Docker from https://get.docker.com/ or Ctrl+C to exit"
     curl https://get.docker.com/ | sh
 
-    found_docker=$(check_docker)
-    if [ "$found_docker" -ne 0 ]; then
+    if ! check_docker; then
       echo Still failed to find docker or docker.io on your PATH.
       echo Docker install failed. Quitting.
       exit