11#! /bin/sh
22set -e
3- # Code generated by godownloader on 2019-03-02T16:09:54Z . DO NOT EDIT.
3+ # Code generated by godownloader on 2019-08-18T15:25:39Z . DO NOT EDIT.
44#
55
66usage () {
@@ -43,43 +43,36 @@ parse_args() {
4343# network, either nothing will happen or will syntax error
4444# out preventing half-done work
4545execute () {
46- tmpdir=$( mktmpdir )
46+ tmpdir=$( mktemp -d )
4747 log_debug " downloading files into ${tmpdir} "
4848 http_download " ${tmpdir} /${TARBALL} " " ${TARBALL_URL} "
4949 http_download " ${tmpdir} /${CHECKSUM} " " ${CHECKSUM_URL} "
5050 hash_sha256_verify " ${tmpdir} /${TARBALL} " " ${tmpdir} /${CHECKSUM} "
5151 srcdir=" ${tmpdir} "
5252 (cd " ${tmpdir} " && untar " ${TARBALL} " )
53- install -d " ${BINDIR} "
54- for binexe in " gitlint " ; do
53+ test ! -d " ${BINDIR} " && install -d " ${BINDIR} "
54+ for binexe in $BINARIES ; do
5555 if [ " $OS " = " windows" ]; then
5656 binexe=" ${binexe} .exe"
5757 fi
5858 install " ${srcdir} /${binexe} " " ${BINDIR} /"
5959 log_info " installed ${BINDIR} /${binexe} "
6060 done
61- }
62- is_supported_platform () {
63- platform=$1
64- found=1
65- case " $platform " in
66- linux/386) found=0 ;;
67- linux/amd64) found=0 ;;
68- windows/386) found=0 ;;
69- windows/amd64) found=0 ;;
70- darwin/386) found=0 ;;
71- darwin/amd64) found=0 ;;
61+ rm -rf " ${tmpdir} "
62+ }
63+ get_binaries () {
64+ case " $PLATFORM " in
65+ darwin/386) BINARIES=" gitlint" ;;
66+ darwin/amd64) BINARIES=" gitlint" ;;
67+ linux/386) BINARIES=" gitlint" ;;
68+ linux/amd64) BINARIES=" gitlint" ;;
69+ windows/386) BINARIES=" gitlint" ;;
70+ windows/amd64) BINARIES=" gitlint" ;;
71+ * )
72+ 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"
73+ exit 1
74+ ;;
7275 esac
73- return $found
74- }
75- check_platform () {
76- if is_supported_platform " $PLATFORM " ; then
77- # optional logging goes here
78- true
79- else
80- 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"
81- exit 1
82- fi
8376}
8477tag_to_version () {
8578 if [ -z " ${TAG} " ]; then
@@ -97,28 +90,24 @@ tag_to_version() {
9790 VERSION=${TAG# v}
9891}
9992adjust_format () {
100- # change format (tar.gz or zip) based on ARCH
93+ # change format (tar.gz or zip) based on OS
10194 true
10295}
10396adjust_os () {
10497 # adjust archive name based on OS
10598 case ${OS} in
106- 386) OS=i386 ;;
99+ 386) OS=x86_32 ;;
107100 amd64) OS=x86_64 ;;
108- darwin) OS=Darwin ;;
109- linux) OS=Linux ;;
110- windows) OS=Windows ;;
101+ darwin) OS=osx ;;
111102 esac
112103 true
113104}
114105adjust_arch () {
115106 # adjust archive name based on ARCH
116107 case ${ARCH} in
117- 386) ARCH=i386 ;;
108+ 386) ARCH=x86_32 ;;
118109 amd64) ARCH=x86_64 ;;
119- darwin) ARCH=Darwin ;;
120- linux) ARCH=Linux ;;
121- windows) ARCH=Windows ;;
110+ darwin) ARCH=osx ;;
122111 esac
123112 true
124113}
@@ -183,7 +172,9 @@ log_crit() {
183172uname_os () {
184173 os=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
185174 case " $os " in
186- msys_nt) os=" windows" ;;
175+ cygwin_nt* ) os=" windows" ;;
176+ mingw* ) os=" windows" ;;
177+ msys_nt* ) os=" windows" ;;
187178 esac
188179 echo " $os "
189180}
@@ -252,11 +243,6 @@ untar() {
252243 ;;
253244 esac
254245}
255- mktmpdir () {
256- test -z " $TMPDIR " && TMPDIR=" $( mktemp -d) "
257- mkdir -p " ${TMPDIR} "
258- echo " ${TMPDIR} "
259- }
260246http_download_curl () {
261247 local_file=$1
262248 source_url=$2
@@ -377,7 +363,7 @@ uname_arch_check "$ARCH"
377363
378364parse_args " $@ "
379365
380- check_platform
366+ get_binaries
381367
382368tag_to_version
383369
0 commit comments