1
1
#! /bin/sh
2
2
set -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.
4
4
#
5
5
6
6
usage () {
@@ -43,43 +43,36 @@ parse_args() {
43
43
# network, either nothing will happen or will syntax error
44
44
# out preventing half-done work
45
45
execute () {
46
- tmpdir=$( mktmpdir )
46
+ tmpdir=$( mktemp -d )
47
47
log_debug " downloading files into ${tmpdir} "
48
48
http_download " ${tmpdir} /${TARBALL} " " ${TARBALL_URL} "
49
49
http_download " ${tmpdir} /${CHECKSUM} " " ${CHECKSUM_URL} "
50
50
hash_sha256_verify " ${tmpdir} /${TARBALL} " " ${tmpdir} /${CHECKSUM} "
51
51
srcdir=" ${tmpdir} "
52
52
(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
55
55
if [ " $OS " = " windows" ]; then
56
56
binexe=" ${binexe} .exe"
57
57
fi
58
58
install " ${srcdir} /${binexe} " " ${BINDIR} /"
59
59
log_info " installed ${BINDIR} /${binexe} "
60
60
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
+ ;;
72
75
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
83
76
}
84
77
tag_to_version () {
85
78
if [ -z " ${TAG} " ]; then
@@ -97,28 +90,24 @@ tag_to_version() {
97
90
VERSION=${TAG# v}
98
91
}
99
92
adjust_format () {
100
- # change format (tar.gz or zip) based on ARCH
93
+ # change format (tar.gz or zip) based on OS
101
94
true
102
95
}
103
96
adjust_os () {
104
97
# adjust archive name based on OS
105
98
case ${OS} in
106
- 386) OS=i386 ;;
99
+ 386) OS=x86_32 ;;
107
100
amd64) OS=x86_64 ;;
108
- darwin) OS=Darwin ;;
109
- linux) OS=Linux ;;
110
- windows) OS=Windows ;;
101
+ darwin) OS=osx ;;
111
102
esac
112
103
true
113
104
}
114
105
adjust_arch () {
115
106
# adjust archive name based on ARCH
116
107
case ${ARCH} in
117
- 386) ARCH=i386 ;;
108
+ 386) ARCH=x86_32 ;;
118
109
amd64) ARCH=x86_64 ;;
119
- darwin) ARCH=Darwin ;;
120
- linux) ARCH=Linux ;;
121
- windows) ARCH=Windows ;;
110
+ darwin) ARCH=osx ;;
122
111
esac
123
112
true
124
113
}
@@ -183,7 +172,9 @@ log_crit() {
183
172
uname_os () {
184
173
os=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
185
174
case " $os " in
186
- msys_nt) os=" windows" ;;
175
+ cygwin_nt* ) os=" windows" ;;
176
+ mingw* ) os=" windows" ;;
177
+ msys_nt* ) os=" windows" ;;
187
178
esac
188
179
echo " $os "
189
180
}
@@ -252,11 +243,6 @@ untar() {
252
243
;;
253
244
esac
254
245
}
255
- mktmpdir () {
256
- test -z " $TMPDIR " && TMPDIR=" $( mktemp -d) "
257
- mkdir -p " ${TMPDIR} "
258
- echo " ${TMPDIR} "
259
- }
260
246
http_download_curl () {
261
247
local_file=$1
262
248
source_url=$2
@@ -377,7 +363,7 @@ uname_arch_check "$ARCH"
377
363
378
364
parse_args " $@ "
379
365
380
- check_platform
366
+ get_binaries
381
367
382
368
tag_to_version
383
369
0 commit comments