fixes and cleanup
[webi-installers/.git] / macos / macos.bash
index 97656290adce002911fd18f2520d9f0d33567153..6e7582f2ade3561e1f00d08a76a409f04234ec17 100644 (file)
@@ -17,11 +17,8 @@ set -u
 if [ -z "${WEBI_PKG_URL:-}" ]; then
   # dmg
   release_tab="${WEBI_HOST}/api/releases/macos@${WEBI_VERSION:-}.csv?os=$(uname -s)&arch=$(uname -m)&limit=1"
-  echo $release_tab
   WEBI_CSV=$(curl -fsSL "$release_tab" -H "User-Agent: $(uname -a)")
-  echo $WEBI_CSV
   WEBI_CHANNEL=$(echo $WEBI_CSV | cut -d ',' -f 3)
-  echo $WEBI_CHANNEL
   if [ "error" == "$WEBI_CHANNEL" ]; then
      echo "could not find release for macOS v${WEBI_VERSION}"
      exit 1
@@ -33,7 +30,15 @@ fi
 mkdir -p ~/Downloads
 pushd ~/Downloads 2>&1 >/dev/null
 
-wget -c "$WEBI_PKG_URL"
+# TODO use downloads directory because this is big
+set +e
+if [ -n "$(command -v wget)" ]; then
+  # better progress bar
+  wget -c "${WEBI_PKG_URL}"
+else
+  curl -fL "${WEBI_PKG_URL}" -o "$(echo "${WEBI_PKG_FILE}" | sed 's:.*/::' )"
+fi
+set -e
 
 if [ "Darwin" == "$(uname -s)" ]; then
   curl -fsSL 'https://gist.githubusercontent.com/solderjs/8c36d132250163011c83bad8284975ee/raw/5a291955813743c20c12ca2d35c7b1bb34f8aecc/create-bootable-installer-for-os-x-el-capitan.sh' -o create-bootable-installer-for-os-x-el-capitan.sh