@@ -44,22 +44,31 @@ gojq() {
4444 local archive=" $basename .$ext "
4545
4646 local gojqURL=" https://github.com/itchyny/gojq/releases/download/$gojqVersion /$archive "
47- if [[ ! -e " $gjDir /$archive " ]]; then
48- curl --fail --location --silent --output " $gjDir /$archive " " $gojqURL "
49-
47+ local archivePath=" $gjDir /$archive "
48+ if [[ ! -e $archivePath ]]; then
49+ if command -v busybox > /dev/null; then
50+ busybox wget --quiet --output-document " $archivePath " " $gojqURL "
51+ elif command -v wget > /dev/null; then
52+ wget --quiet --output-document " $archivePath " " $gojqURL "
53+ elif command -v curl > /dev/null; then
54+ curl --fail --location --silent --output " $archivePath " " $gojqURL "
55+ else
56+ echo " No download tool found (looked for busybox, wget, curl)" >&2
57+ exit 1
58+ fi
5059 fi
5160
52- if [[ ! -e " $gjDir / $archive " ]]; then
61+ if [[ ! -e $archivePath ]]; then
5362 echo " Failed to download gojq ($gojqURL )" >&2
5463 exit 1
5564 fi
5665
5766 if [[ $ext == " zip" ]]; then
5867 # Explanation of flags:
5968 # quiet, junk paths/dont make directories, extract to directory
60- unzip -q -j -d " $gjDir " " $gjDir / $archive " " $basename /gojq"
69+ unzip -q -j -d " $gjDir " " $archivePath " " $basename /gojq"
6170 else
62- tar --strip-components=1 --directory=" $gjDir " --extract --file=" $gjDir / $archive " " $basename /gojq"
71+ tar --strip-components=1 --directory=" $gjDir " --extract --file=" $archivePath " " $basename /gojq"
6372 fi
6473 mv " $gjDir " /gojq " $gojq "
6574 fi
0 commit comments