add version info to deno downloads
[webi-installers/.git] / _webi / template.sh
index 6ca7bbfe73579537d1216dd29552bae0bada3485..643be6ccaa1852fe81312b45857c4aecfdd83327 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __bootstrap_webi() {
 
 set -e
 set -u
@@ -156,7 +156,11 @@ webi_download() {
         # wget has resumable downloads
         # TODO wget -c --content-disposition "$my_url"
         set +e
-        wget -q --show-progress --user-agent="wget $WEBI_UA" -c "$my_url" -O "$my_dl.part"
+        my_show_progress=""
+        if [[ $- == *i* ]]; then
+          my_show_progress="--show-progress"
+        fi
+        wget -q $my_show_progress --user-agent="wget $WEBI_UA" -c "$my_url" -O "$my_dl.part"
         if ! [ $? -eq 0 ]; then
           >&2 echo "failed to download from $WEBI_PKG_URL"
           exit 1
@@ -165,7 +169,11 @@ webi_download() {
     else
         # Neither GNU nor BSD curl have sane resume download options, hence we don't bother
         # TODO curl -fsSL --remote-name --remote-header-name --write-out "$my_url"
-        curl -fSL -H "User-Agent: curl $WEBI_UA" "$my_url" -o "$my_dl.part"
+        my_show_progress="-#"
+        if [[ $- == *i* ]]; then
+          my_show_progress=""
+        fi
+        curl -fSL $my_show_progress -H "User-Agent: curl $WEBI_UA" "$my_url" -o "$my_dl.part"
     fi
     mv "$my_dl.part" "$my_dl"
 
@@ -284,12 +292,14 @@ echo "Have a problem? Experience a bug? Please let us know:"
 echo "        https://github.com/webinstall/packages/issues"
 echo ""
 
-{
+function __init_installer() {
 
 {{ installer }}
 
 }
 
+__init_installer
+
 ##
 ##
 ## END custom override functions
@@ -354,3 +364,5 @@ rm -rf "$WEBI_TMP"
 # See? No magic. Just downloading and moving files.
 
 }
+
+__bootstrap_webi