11#! /bin/sh
22set -e
3- # Code generated by godownloader on 2019-01-15T06:15:28Z . DO NOT EDIT.
3+ # Code generated by godownloader on 2021-12-22T16:10:52Z . DO NOT EDIT.
44#
55
66usage () {
@@ -9,7 +9,7 @@ usage() {
99$this : download go binaries for nektos/act
1010
1111Usage: $this [-b] bindir [-d] [tag]
12- -b sets bindir or installation directory, Defaults to /usr/local /bin
12+ -b sets bindir or installation directory, Defaults to . /bin
1313 -d turns on debug logging
1414 [tag] is a tag from
1515 https://github.com/nektos/act/releases
2323}
2424
2525parse_args () {
26- # BINDIR is /usr/local /bin unless set be ENV
26+ # BINDIR is . /bin unless set be ENV
2727 # over-ridden by flag below
2828
29- BINDIR=${BINDIR:-/ usr / local / bin}
30- while getopts " b:dh?" arg; do
29+ BINDIR=${BINDIR:- . / bin}
30+ while getopts " b:dh?x " arg; do
3131 case " $arg " in
3232 b) BINDIR=" $OPTARG " ;;
3333 d) log_set_priority 10 ;;
3434 h | \? ) usage " $0 " ;;
35+ x) set -x ;;
3536 esac
3637 done
3738 shift $(( OPTIND - 1 ))
@@ -42,43 +43,45 @@ parse_args() {
4243# network, either nothing will happen or will syntax error
4344# out preventing half-done work
4445execute () {
45- tmpdir=$( mktmpdir )
46+ tmpdir=$( mktemp -d )
4647 log_debug " downloading files into ${tmpdir} "
4748 http_download " ${tmpdir} /${TARBALL} " " ${TARBALL_URL} "
4849 http_download " ${tmpdir} /${CHECKSUM} " " ${CHECKSUM_URL} "
4950 hash_sha256_verify " ${tmpdir} /${TARBALL} " " ${tmpdir} /${CHECKSUM} "
5051 srcdir=" ${tmpdir} "
5152 (cd " ${tmpdir} " && untar " ${TARBALL} " )
52- install -d " ${BINDIR} "
53- for binexe in " act " ; do
53+ test ! -d " ${BINDIR} " && install -d " ${BINDIR} "
54+ for binexe in $BINARIES ; do
5455 if [ " $OS " = " windows" ]; then
5556 binexe=" ${binexe} .exe"
5657 fi
5758 install " ${srcdir} /${binexe} " " ${BINDIR} /"
5859 log_info " installed ${BINDIR} /${binexe} "
5960 done
60- }
61- is_supported_platform () {
62- platform=$1
63- found=1
64- case " $platform " in
65- darwin/amd64) found=0 ;;
66- darwin/386) found=0 ;;
67- linux/amd64) found=0 ;;
68- linux/386) found=0 ;;
69- windows/amd64) found=0 ;;
70- windows/386) found=0 ;;
61+ rm -rf " ${tmpdir} "
62+ }
63+ get_binaries () {
64+ case " $PLATFORM " in
65+ darwin/386) BINARIES=" act" ;;
66+ darwin/amd64) BINARIES=" act" ;;
67+ darwin/arm64) BINARIES=" act" ;;
68+ darwin/armv6) BINARIES=" act" ;;
69+ darwin/armv7) BINARIES=" act" ;;
70+ linux/386) BINARIES=" act" ;;
71+ linux/amd64) BINARIES=" act" ;;
72+ linux/arm64) BINARIES=" act" ;;
73+ linux/armv6) BINARIES=" act" ;;
74+ linux/armv7) BINARIES=" act" ;;
75+ windows/386) BINARIES=" act" ;;
76+ windows/amd64) BINARIES=" act" ;;
77+ windows/arm64) BINARIES=" act" ;;
78+ windows/armv6) BINARIES=" act" ;;
79+ windows/armv7) BINARIES=" act" ;;
80+ * )
81+ log_crit " platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX} /issues/new"
82+ exit 1
83+ ;;
7184 esac
72- return $found
73- }
74- check_platform () {
75- if is_supported_platform " $PLATFORM " ; then
76- # optional logging goes here
77- true
78- else
79- log_crit " platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX} /issues/new"
80- exit 1
81- fi
8285}
8386tag_to_version () {
8487 if [ -z " ${TAG} " ]; then
@@ -96,8 +99,8 @@ tag_to_version() {
9699 VERSION=${TAG# v}
97100}
98101adjust_format () {
99- # change format (tar.gz or zip) based on ARCH
100- case ${ARCH } in
102+ # change format (tar.gz or zip) based on OS
103+ case ${OS } in
101104 windows) FORMAT=zip ;;
102105 esac
103106 true
@@ -185,7 +188,9 @@ log_crit() {
185188uname_os () {
186189 os=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
187190 case " $os " in
188- msys_nt) os=" windows" ;;
191+ cygwin_nt* ) os=" windows" ;;
192+ mingw* ) os=" windows" ;;
193+ msys_nt* ) os=" windows" ;;
189194 esac
190195 echo " $os "
191196}
@@ -245,20 +250,15 @@ uname_arch_check() {
245250untar () {
246251 tarball=$1
247252 case " ${tarball} " in
248- * .tar.gz | * .tgz) tar -xzf " ${tarball} " ;;
249- * .tar) tar -xf " ${tarball} " ;;
253+ * .tar.gz | * .tgz) tar --no-same-owner - xzf " ${tarball} " ;;
254+ * .tar) tar --no-same-owner - xf " ${tarball} " ;;
250255 * .zip) unzip " ${tarball} " ;;
251256 * )
252257 log_err " untar unknown archive format for ${tarball} "
253258 return 1
254259 ;;
255260 esac
256261}
257- mktmpdir () {
258- test -z " $TMPDIR " && TMPDIR=" $( mktemp -d) "
259- mkdir -p " ${TMPDIR} "
260- echo " ${TMPDIR} "
261- }
262262http_download_curl () {
263263 local_file=$1
264264 source_url=$2
@@ -379,7 +379,7 @@ uname_arch_check "$ARCH"
379379
380380parse_args " $@ "
381381
382- check_platform
382+ get_binaries
383383
384384tag_to_version
385385
0 commit comments