cleanup: shfmt, shellcheck, and whitespace
[webi-installers/.git] / _webi / bootstrap.sh
index 6562087db0de61fd82f9b33fd3d66d7efe782a60..dfbf9de0210902998fab0fad566ea0c6c9c745ed 100644 (file)
@@ -2,16 +2,16 @@
 
 {
 
-set -e
-set -u
+    set -e
+    set -u
 
-#WEBI_PKG=
-#WEBI_HOST=https://webinstall.dev
-export WEBI_HOST
+    #WEBI_PKG=
+    #WEBI_HOST=https://webinstall.dev
+    export WEBI_HOST
 
-mkdir -p "$HOME/.local/bin"
+    mkdir -p "$HOME/.local/bin"
 
-cat << EOF > "$HOME/.local/bin/webi"
+    cat << EOF > "$HOME/.local/bin/webi"
 #!/bin/bash
 
 set -e
@@ -52,9 +52,9 @@ if [ -n "\$(command -v unxz)" ]; then
 fi
 if [ -n "\$(command -v unzip)" ]; then
     my_ext="zip,\$my_ext"
-else
-    >&2 echo "WARN: 'unzip' not found"
 fi
+# for mac/linux 'exe' refers to the uncompressed binary without extension
+my_ext="exe,\$my_ext"
 if [ -n "\$(command -v tar)" ]; then
     my_ext="tar,\$my_ext"
 fi
@@ -139,10 +139,10 @@ show_path_updates
 
 EOF
 
-chmod a+x "$HOME/.local/bin/webi"
+    chmod a+x "$HOME/.local/bin/webi"
 
-if [ -n "${WEBI_PKG:-}" ]; then
-    "$HOME/.local/bin/webi" "${WEBI_PKG}"
-fi
+    if [ -n "${WEBI_PKG:-}" ]; then
+        "$HOME/.local/bin/webi" "${WEBI_PKG}"
+    fi
 
 }