Skip to content

Commit 650e9e6

Browse files
committedOct 10, 2024··
docs: add install.sh installation script
Signed-off-by: Yves Brissaud <[email protected]>
1 parent 5aee5e0 commit 650e9e6

File tree

3 files changed

+743
-0
lines changed

3 files changed

+743
-0
lines changed
 

‎README.md

+16
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,22 @@ The `runx` image manifest will reference at max two layers, one for the `runx.ya
268268

269269
## CLI Plugin Installation
270270

271+
### Script Installation (macOS and Linux)
272+
273+
Install the `docker-runx` CLI plugin using the following command:
274+
275+
```sh
276+
curl -sSfL https://raw.githubusercontent.com/eunomie/docker-runx/main/install.sh | sh -s --
277+
```
278+
279+
You can also download [the installation script](./install.sh) and run it locally:
280+
281+
```sh
282+
DOWNLOAD_TAG_INSTALL_SCRIPT=false sh install.sh
283+
```
284+
285+
Please be sure to have the `install.sh` script corresponding to the version you want to install.
286+
271287
### Manual Installation
272288

273289
<details>

‎docs/index.markdown

+17
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,23 @@ The `runx` image manifest will reference at max two layers, one for the `runx.ya
273273

274274
## CLI Plugin Installation
275275

276+
### Script Installation (macOS and Linux)
277+
278+
Install the `docker-runx` CLI plugin using the following command:
279+
280+
```sh
281+
curl -sSfL https://raw.githubusercontent.com/eunomie/docker-runx/main/install.sh | sh -s --
282+
```
283+
284+
You can also download [the installation script](https://github.com/eunomie/docker-runx/blob/main/install.sh) and run it locally:
285+
286+
```sh
287+
DOWNLOAD_TAG_INSTALL_SCRIPT=false sh install.sh
288+
```
289+
290+
Please be sure to have the `install.sh` script corresponding to the version you want to install.
291+
292+
276293
### Manual Installation
277294

278295
To install it manually:

‎install.sh

+710
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,710 @@
1+
#!/bin/sh
2+
3+
# note: we require errors to propagate (don't set -e)
4+
5+
# Copyright © 2023 Docker, Inc.
6+
7+
set -u
8+
9+
PROJECT_NAME="docker-runx"
10+
OWNER=eunomie
11+
REPO="docker-runx"
12+
GITHUB_DOWNLOAD_PREFIX=https://github.com/${OWNER}/${REPO}/releases/download
13+
INSTALL_SH_BASE_URL=https://raw.githubusercontent.com/${OWNER}/${REPO}
14+
BINARY="docker-runx"
15+
DOCKER_HOME=${DOCKER_HOME:-~/.docker}
16+
DEFAULT_INSTALL_DIR=${DOCKER_HOME}/cli-plugins
17+
PROGRAM_ARGS=$@
18+
19+
# do not change the name of this parameter (this must always be backwards compatible)
20+
DOWNLOAD_TAG_INSTALL_SCRIPT=${DOWNLOAD_TAG_INSTALL_SCRIPT:-true}
21+
22+
#
23+
# usage [script-name]
24+
#
25+
usage() (
26+
this="$1"
27+
cat <<EOF
28+
$this: download go binaries for ${OWNER}/${REPO}
29+
30+
Usage: $this [-b] dir [-d] [tag]
31+
-b the installation directory (defaults to ${DEFAULT_INSTALL_DIR})
32+
-d turns on debug logging
33+
-dd turns on trace logging
34+
[tag] the specific release to use (if missing, then the latest will be used)
35+
EOF
36+
exit 2
37+
)
38+
39+
40+
# ------------------------------------------------------------------------
41+
# https://github.com/client9/shlib - portable posix shell functions
42+
# Public domain - http://unlicense.org
43+
# https://github.com/client9/shlib/blob/master/LICENSE.md
44+
# but credit (and pull requests) appreciated.
45+
# ------------------------------------------------------------------------
46+
47+
is_command() (
48+
command -v "$1" >/dev/null
49+
)
50+
51+
echo_stderr() (
52+
echo "$@" 1>&2
53+
)
54+
55+
_logp=2
56+
log_set_priority() {
57+
_logp="$1"
58+
}
59+
60+
log_priority() (
61+
if test -z "$1"; then
62+
echo "$_logp"
63+
return
64+
fi
65+
[ "$1" -le "$_logp" ]
66+
)
67+
68+
init_colors() {
69+
RED=''
70+
BLUE=''
71+
PURPLE=''
72+
BOLD=''
73+
RESET=''
74+
# check if stdout is a terminal
75+
if test -t 1 && is_command tput; then
76+
# see if it supports colors
77+
ncolors=$(tput colors)
78+
if test -n "$ncolors" && test "$ncolors" -ge 8; then
79+
RED='\033[0;31m'
80+
BLUE='\033[0;34m'
81+
PURPLE='\033[0;35m'
82+
BOLD='\033[1m'
83+
RESET='\033[0m'
84+
fi
85+
fi
86+
}
87+
88+
init_colors
89+
90+
log_tag() (
91+
case "$1" in
92+
0) echo "${RED}${BOLD}[error]${RESET}" ;;
93+
1) echo "${RED}[warn]${RESET}" ;;
94+
2) echo "[info]${RESET}" ;;
95+
3) echo "${BLUE}[debug]${RESET}" ;;
96+
4) echo "${PURPLE}[trace]${RESET}" ;;
97+
*) echo "[$1]" ;;
98+
esac
99+
)
100+
101+
102+
log_trace_priority=4
103+
log_trace() (
104+
priority=$log_trace_priority
105+
log_priority "$priority" || return 0
106+
echo_stderr "$(log_tag $priority)" "${@}" "$RESET"
107+
)
108+
109+
log_debug_priority=3
110+
log_debug() (
111+
priority=$log_debug_priority
112+
log_priority "$priority" || return 0
113+
echo_stderr "$(log_tag $priority)" "${@}" "$RESET"
114+
)
115+
116+
log_info_priority=2
117+
log_info() (
118+
priority=$log_info_priority
119+
log_priority "$priority" || return 0
120+
echo_stderr "$(log_tag $priority)" "${@}" "$RESET"
121+
)
122+
123+
log_warn_priority=1
124+
log_warn() (
125+
priority=$log_warn_priority
126+
log_priority "$priority" || return 0
127+
echo_stderr "$(log_tag $priority)" "${@}" "$RESET"
128+
)
129+
130+
log_err_priority=0
131+
log_err() (
132+
priority=$log_err_priority
133+
log_priority "$priority" || return 0
134+
echo_stderr "$(log_tag $priority)" "${@}" "$RESET"
135+
)
136+
137+
uname_os_check() (
138+
os="$1"
139+
case "$os" in
140+
darwin) return 0 ;;
141+
dragonfly) return 0 ;;
142+
freebsd) return 0 ;;
143+
linux) return 0 ;;
144+
android) return 0 ;;
145+
nacl) return 0 ;;
146+
netbsd) return 0 ;;
147+
openbsd) return 0 ;;
148+
plan9) return 0 ;;
149+
solaris) return 0 ;;
150+
windows) return 0 ;;
151+
esac
152+
log_err "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib"
153+
return 1
154+
)
155+
156+
uname_arch_check() (
157+
arch="$1"
158+
case "$arch" in
159+
386) return 0 ;;
160+
amd64) return 0 ;;
161+
arm64) return 0 ;;
162+
armv5) return 0 ;;
163+
armv6) return 0 ;;
164+
armv7) return 0 ;;
165+
ppc64) return 0 ;;
166+
ppc64le) return 0 ;;
167+
mips) return 0 ;;
168+
mipsle) return 0 ;;
169+
mips64) return 0 ;;
170+
mips64le) return 0 ;;
171+
s390x) return 0 ;;
172+
amd64p32) return 0 ;;
173+
esac
174+
log_err "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib"
175+
return 1
176+
)
177+
178+
unpack() (
179+
archive="$1"
180+
181+
log_trace "unpack(archive=${archive})"
182+
183+
case "$archive" in
184+
*.tar.gz | *.tgz) tar --no-same-owner -xzf "$archive" ;;
185+
*.tar) tar --no-same-owner -xf "$archive" ;;
186+
*.zip) unzip -q "$archive" ;;
187+
*.dmg) extract_from_dmg "$archive" ;;
188+
*)
189+
log_err "unpack unknown archive format for ${archive}"
190+
return 1
191+
;;
192+
esac
193+
)
194+
195+
extract_from_dmg() (
196+
dmg_file="$1"
197+
198+
mount_point="/Volumes/tmp-dmg"
199+
hdiutil attach -quiet -nobrowse -mountpoint "$mount_point" "$dmg_file"
200+
cp -fR "${mount_point}/." ./
201+
hdiutil detach -quiet -force "$mount_point"
202+
)
203+
204+
http_download_curl() (
205+
local_file="$1"
206+
source_url="$2"
207+
header="$3"
208+
209+
log_trace "http_download_curl(local_file=$local_file, source_url=$source_url, header=$header)"
210+
211+
if [ -z "$header" ]; then
212+
code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url")
213+
else
214+
code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url")
215+
fi
216+
217+
if [ "$code" != "200" ]; then
218+
log_err "received HTTP status=$code for url='$source_url'"
219+
return 1
220+
fi
221+
return 0
222+
)
223+
224+
http_download_wget() (
225+
local_file="$1"
226+
source_url="$2"
227+
header="$3"
228+
229+
log_trace "http_download_wget(local_file=$local_file, source_url=$source_url, header=$header)"
230+
231+
if [ -z "$header" ]; then
232+
wget -q -O "$local_file" "$source_url"
233+
else
234+
wget -q --header "$header" -O "$local_file" "$source_url"
235+
fi
236+
)
237+
238+
http_download() (
239+
log_debug "http_download(url=$2)"
240+
if is_command curl; then
241+
http_download_curl "$@"
242+
return
243+
elif is_command wget; then
244+
http_download_wget "$@"
245+
return
246+
fi
247+
log_err "http_download unable to find wget or curl"
248+
return 1
249+
)
250+
251+
http_copy() (
252+
tmp=$(mktemp)
253+
http_download "$tmp" "$1" "$2" || return 1
254+
body=$(cat "$tmp")
255+
rm -f "$tmp"
256+
echo "$body"
257+
)
258+
259+
hash_sha256() (
260+
TARGET=${1:-/dev/stdin}
261+
if is_command gsha256sum; then
262+
hash=$(gsha256sum "$TARGET") || return 1
263+
echo "$hash" | cut -d ' ' -f 1
264+
elif is_command sha256sum; then
265+
hash=$(sha256sum "$TARGET") || return 1
266+
echo "$hash" | cut -d ' ' -f 1
267+
elif is_command shasum; then
268+
hash=$(shasum -a 256 "$TARGET" 2>/dev/null) || return 1
269+
echo "$hash" | cut -d ' ' -f 1
270+
elif is_command openssl; then
271+
hash=$(openssl -dst openssl dgst -sha256 "$TARGET") || return 1
272+
echo "$hash" | cut -d ' ' -f a
273+
else
274+
log_err "hash_sha256 unable to find command to compute sha-256 hash"
275+
return 1
276+
fi
277+
)
278+
279+
hash_sha256_verify() (
280+
TARGET="$1"
281+
checksums="$2"
282+
if [ -z "$checksums" ]; then
283+
log_err "hash_sha256_verify checksum file not specified in arg2"
284+
return 1
285+
fi
286+
BASENAME=${TARGET##*/}
287+
want=$(grep "$BASENAME" "$checksums" 2>/dev/null | tr '\t' ' ' | cut -d ' ' -f 1)
288+
if [ -z "$want" ]; then
289+
log_err "hash_sha256_verify unable to find checksum for '${TARGET}' in '${checksums}'"
290+
return 1
291+
fi
292+
got=$(hash_sha256 "$TARGET")
293+
if [ "$want" != "$got" ]; then
294+
log_err "hash_sha256_verify checksum for '$TARGET' did not verify ${want} vs $got"
295+
return 1
296+
fi
297+
)
298+
299+
# ------------------------------------------------------------------------
300+
# End of functions from https://github.com/client9/shlib
301+
# ------------------------------------------------------------------------
302+
303+
# asset_file_exists [path]
304+
#
305+
# returns 1 if the given file does not exist
306+
#
307+
asset_file_exists() (
308+
path="$1"
309+
if [ ! -f "$path" ]; then
310+
return 1
311+
fi
312+
)
313+
314+
315+
# github_release_json [owner] [repo] [version]
316+
#
317+
# outputs release json string
318+
#
319+
github_release_json() (
320+
owner="$1"
321+
repo="$2"
322+
version="$3"
323+
test -z "$version" && version="latest"
324+
giturl="https://github.com/${owner}/${repo}/releases/${version}"
325+
json=$(http_copy "$giturl" "Accept:application/json")
326+
327+
log_trace "github_release_json(owner=${owner}, repo=${repo}, version=${version}) returned '${json}'"
328+
329+
test -z "$json" && return 1
330+
echo "$json"
331+
)
332+
333+
# extract_value [key-value-pair]
334+
#
335+
# outputs value from a colon delimited key-value pair
336+
#
337+
extract_value() (
338+
key_value="$1"
339+
IFS=':' read -r _ value << EOF
340+
${key_value}
341+
EOF
342+
echo "$value"
343+
)
344+
345+
# extract_json_value [json] [key]
346+
#
347+
# outputs value of the key from the given json string
348+
#
349+
extract_json_value() (
350+
json="$1"
351+
key="$2"
352+
key_value=$(echo "$json" | grep -o "\"$key\":[^,]*[,}]" | tr -d '",}')
353+
354+
extract_value "$key_value"
355+
)
356+
357+
# github_release_tag [release-json]
358+
#
359+
# outputs release tag string
360+
#
361+
github_release_tag() (
362+
json="$1"
363+
tag=$(extract_json_value "$json" "tag_name")
364+
test -z "$tag" && return 1
365+
echo "$tag"
366+
)
367+
368+
# download_github_release_checksums [release-url-prefix] [name] [output-dir]
369+
#
370+
# outputs path to the downloaded checksums file
371+
#
372+
download_github_release_checksums() (
373+
download_url="$1"
374+
name="$2"
375+
output_dir="$3"
376+
377+
log_trace "download_github_release_checksums(url=${download_url}, name=${name}, output_dir=${output_dir})"
378+
379+
checksum_filename=${name}-checksums.txt
380+
checksum_url=${download_url}/${checksum_filename}
381+
output_path="${output_dir}/${checksum_filename}"
382+
383+
http_download "$output_path" "$checksum_url" ""
384+
asset_file_exists "$output_path"
385+
386+
log_trace "download_github_release_checksums() returned '${output_path}'"
387+
388+
echo "$output_path"
389+
)
390+
391+
# search_for_asset [checksums-file-path] [name] [os] [arch] [format]
392+
#
393+
# outputs name of the asset to download
394+
#
395+
search_for_asset() (
396+
checksum_path="$1"
397+
name="$2"
398+
os="$3"
399+
arch="$4"
400+
format="$5"
401+
402+
log_trace "search_for_asset(checksum-path=${checksum_path}, name=${name}, os=${os}, arch=${arch}, format=${format})"
403+
404+
asset_glob="${name}-${os}-${arch}.${format}"
405+
output_path=$(grep -o "$asset_glob" "$checksum_path" || true)
406+
407+
log_trace "search_for_asset() returned '${output_path}'"
408+
409+
echo "$output_path"
410+
)
411+
412+
# uname_os
413+
#
414+
# outputs an adjusted os value
415+
#
416+
uname_os() (
417+
os=$(uname -s | tr '[:upper:]' '[:lower:]')
418+
case "$os" in
419+
cygwin_nt*) os="windows" ;;
420+
mingw*) os="windows" ;;
421+
msys_nt*) os="windows" ;;
422+
esac
423+
424+
uname_os_check "$os"
425+
426+
log_trace "uname_os() returned '${os}'"
427+
428+
echo "$os"
429+
)
430+
431+
# uname_arch
432+
#
433+
# outputs an adjusted architecture value
434+
#
435+
uname_arch() (
436+
arch=$(uname -m)
437+
case "$arch" in
438+
x86_64) arch="amd64" ;;
439+
x86) arch="386" ;;
440+
i686) arch="386" ;;
441+
i386) arch="386" ;;
442+
aarch64) arch="arm64" ;;
443+
armv5*) arch="armv5" ;;
444+
armv6*) arch="armv6" ;;
445+
armv7*) arch="armv7" ;;
446+
esac
447+
448+
uname_arch_check "$arch"
449+
450+
log_trace "uname_arch() returned '${arch}'"
451+
452+
echo "$arch"
453+
)
454+
455+
# get_release_tag [owner] [repo] [tag]
456+
#
457+
# outputs tag string
458+
#
459+
get_release_tag() (
460+
owner="$1"
461+
repo="$2"
462+
tag="$3"
463+
464+
log_trace "get_release_tag(owner=${owner}, repo=${repo}, tag=${tag})"
465+
466+
json=$(github_release_json "$owner" "$repo" "$tag")
467+
real_tag=$(github_release_tag "$json")
468+
if test -z "$real_tag"; then
469+
return 1
470+
fi
471+
472+
log_trace "get_release_tag() returned '${real_tag}'"
473+
474+
echo "$real_tag"
475+
)
476+
477+
# tag_to_version [tag]
478+
#
479+
# outputs version string
480+
#
481+
tag_to_version() (
482+
tag="$1"
483+
value="${tag#v}"
484+
485+
log_trace "tag_to_version(tag=${tag}) returned '${value}'"
486+
487+
echo "$value"
488+
)
489+
490+
# get_binary_name [os] [arch] [default-name]
491+
#
492+
# outputs a the binary string name
493+
#
494+
get_binary_name() (
495+
os="$1"
496+
arch="$2"
497+
binary="$3"
498+
original_binary="$binary"
499+
500+
case "$os" in
501+
windows) binary="${binary}.exe" ;;
502+
esac
503+
504+
log_trace "get_binary_name(os=${os}, arch=${arch}, binary=${original_binary}) returned '${binary}'"
505+
506+
echo "$binary"
507+
)
508+
509+
510+
# get_format_name [os] [arch] [default-format]
511+
#
512+
# outputs an adjusted file format
513+
#
514+
get_format_name() (
515+
os="$1"
516+
arch="$2"
517+
format="$3"
518+
original_format="$format"
519+
520+
case "$os" in
521+
windows) format=zip ;;
522+
esac
523+
524+
log_trace "get_format_name(os=${os}, arch=${arch}, format=${original_format}) returned '${format}'"
525+
526+
echo "$format"
527+
)
528+
529+
# download_and_install_asset [release-url-prefix] [download-path] [install-path] [name] [os] [arch] [format] [binary]
530+
#
531+
# attempts to download the archive and install it to the given path.
532+
#
533+
download_and_install_asset() (
534+
download_url="$1"
535+
download_path="$2"
536+
install_path="$3"
537+
name="$4"
538+
os="$5"
539+
arch="$6"
540+
format="$7"
541+
binary="$8"
542+
543+
asset_filepath=$(download_asset "$download_url" "$download_path" "$name" "$os" "$arch" "$format")
544+
545+
# don't continue if we couldn't download an asset
546+
if [ -z "$asset_filepath" ]; then
547+
log_err "could not find release asset for os='${os}' arch='${arch}' format='${format}' "
548+
return 1
549+
fi
550+
551+
install_asset "$asset_filepath" "$install_path" "$binary"
552+
)
553+
554+
# download_asset [release-url-prefix] [download-path] [name] [os] [arch] [format] [binary]
555+
#
556+
# outputs the path to the downloaded asset asset_filepath
557+
#
558+
download_asset() (
559+
download_url="$1"
560+
destination="$2"
561+
name="$3"
562+
os="$4"
563+
arch="$5"
564+
format="$6"
565+
566+
log_trace "download_asset(url=${download_url}, destination=${destination}, name=${name}, os=${os}, arch=${arch}, version=${version}, format=${format})"
567+
568+
checksums_filepath=$(download_github_release_checksums "$download_url" "$name" "$destination")
569+
570+
log_trace "checksums content:\n$(cat ${checksums_filepath})"
571+
572+
asset_filename=$(search_for_asset "$checksums_filepath" "$name" "$os" "$arch" "$format")
573+
574+
# don't continue if we couldn't find a matching asset from the checksums file
575+
if [ -z "$asset_filename" ]; then
576+
return 1
577+
fi
578+
579+
asset_url="${download_url}/${asset_filename}"
580+
asset_filepath="${destination}/${asset_filename}"
581+
http_download "$asset_filepath" "$asset_url" ""
582+
583+
hash_sha256_verify "$asset_filepath" "$checksums_filepath"
584+
585+
log_trace "download_asset_by_checksums_file() returned '${asset_filepath}'"
586+
587+
echo "$asset_filepath"
588+
)
589+
590+
# install_asset [asset-path] [destination-path] [binary]
591+
#
592+
install_asset() (
593+
asset_filepath="$1"
594+
destination="$2"
595+
binary="$3"
596+
597+
log_trace "install_asset(asset=${asset_filepath}, destination=${destination}, binary=${binary})"
598+
599+
# don't continue if we don't have anything to install
600+
if [ -z "$asset_filepath" ]; then
601+
return
602+
fi
603+
604+
archive_dir=$(dirname "$asset_filepath")
605+
606+
# unarchive the downloaded archive to the temp dir
607+
(cd "$archive_dir" && unpack "$asset_filepath")
608+
609+
# create the destination dir
610+
test ! -d "$destination" && install -d "$destination"
611+
612+
# install the binary to the destination dir
613+
install "${archive_dir}/${binary}" "${destination}/"
614+
)
615+
616+
main() (
617+
# parse arguments
618+
619+
# note: never change default install directory (this must always be backwards compatible)
620+
install_dir=${install_dir:-${DEFAULT_INSTALL_DIR}}
621+
622+
# note: never change the program flags or arguments (this must always be backwards compatible)
623+
while getopts "b:dh?x" arg; do
624+
case "$arg" in
625+
b) install_dir="$OPTARG" ;;
626+
d)
627+
if [ "$_logp" = "$log_info_priority" ]; then
628+
# -d == debug
629+
log_set_priority $log_debug_priority
630+
else
631+
# -dd (or -ddd...) == trace
632+
log_set_priority $log_trace_priority
633+
fi
634+
;;
635+
h | \?) usage "$0" ;;
636+
x) set -x ;;
637+
esac
638+
done
639+
shift $((OPTIND - 1))
640+
set +u
641+
tag="$1"
642+
643+
if [ "$install_dir" = "$DEFAULT_INSTALL_DIR" ]; then
644+
if [ ! -d "$DOCKER_HOME" ]; then
645+
log_err "docker is not installed; refusing to install to '${install_dir}'"
646+
exit 1
647+
fi
648+
fi
649+
650+
if [ -z "$tag" ]; then
651+
log_debug "checking github for the current release tag"
652+
tag=""
653+
else
654+
log_debug "checking github for release tag='${tag}'"
655+
fi
656+
set -u
657+
658+
tag=$(get_release_tag "$OWNER" "$REPO" "$tag")
659+
660+
if [ "$?" != "0" ]; then
661+
log_err "unable to find tag='${tag}'"
662+
log_err "do not specify a version or select a valid version from https://github.com/${OWNER}/${REPO}/releases"
663+
return 1
664+
fi
665+
666+
# run the application
667+
668+
version=$(tag_to_version "$tag")
669+
os=$(uname_os)
670+
arch=$(uname_arch)
671+
format=$(get_format_name "$os" "$arch" "tar.gz")
672+
binary=$(get_binary_name "$os" "$arch" "$BINARY")
673+
download_url="${GITHUB_DOWNLOAD_PREFIX}/${tag}"
674+
675+
# we always use the install.sh script that is associated with the tagged release. Why? the latest install.sh is not
676+
# guaranteed to be able to install every version of the application. We use the DOWNLOAD_TAG_INSTALL_SCRIPT env var
677+
# to indicate if we should continue processing with the existing script or to download the script from the given tag.
678+
if [ "$DOWNLOAD_TAG_INSTALL_SCRIPT" = "true" ]; then
679+
export DOWNLOAD_TAG_INSTALL_SCRIPT=false
680+
log_info "fetching release script for tag='${tag}'"
681+
http_copy "${INSTALL_SH_BASE_URL}/${tag}/install.sh" "" | sh -s -- ${PROGRAM_ARGS}
682+
exit "$?"
683+
fi
684+
685+
log_info "using release tag='${tag}' version='${version}' os='${os}' arch='${arch}'"
686+
687+
download_dir=$(mktemp -d)
688+
trap 'rm -rf -- "$download_dir"' EXIT
689+
690+
log_debug "downloading files into ${download_dir}"
691+
692+
download_and_install_asset "$download_url" "$download_dir" "$install_dir" "$PROJECT_NAME" "$os" "$arch" "$format" "$binary"
693+
694+
# don't continue if we couldn't install the asset
695+
if [ "$?" != "0" ]; then
696+
log_err "failed to install ${BINARY}"
697+
return 1
698+
fi
699+
700+
log_info "installed ${install_dir}/${binary}"
701+
)
702+
703+
# entrypoint
704+
705+
set +u
706+
if [ -z "$TEST_INSTALL_SH" ]; then
707+
set -u
708+
main "$@"
709+
fi
710+
set -u

0 commit comments

Comments
 (0)
Please sign in to comment.