Skip to content
This repository was archived by the owner on Apr 10, 2019. It is now read-only.

Commit 8389125

Browse files
ewohltmanalecthomas
authored andcommitted
Update install.sh for Windows
1 parent f64e0e4 commit 8389125

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

scripts/install.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ usage() {
99
$this: download go binaries for alecthomas/gometalinter
1010
1111
Usage: $this [-b] bindir [-d] [tag]
12-
-b sets bindir or installation directory, Defaults to ./bin
12+
-b sets bindir or installation directory. If not provided, checks for GOPATH bin. Otherwise defaults to ./bin
1313
-d turns on debug logging
1414
[tag] is a tag from
1515
https://github.com/alecthomas/gometalinter/releases
@@ -23,9 +23,11 @@ EOF
2323
}
2424

2525
parse_args() {
26-
#BINDIR is ./bin unless set be ENV
26+
#BINDIR is ./bin unless set be ENV or GOPATH is not set
2727
# over-ridden by flag below
2828

29+
test -n "$GOPATH" && BINDIR="${GOPATH}/bin"
30+
2931
BINDIR=${BINDIR:-./bin}
3032
while getopts "b:dh?" arg; do
3133
case "$arg" in
@@ -97,8 +99,8 @@ tag_to_version() {
9799
VERSION=${TAG#v}
98100
}
99101
adjust_format() {
100-
# change format (tar.gz or zip) based on ARCH
101-
case ${ARCH} in
102+
# change format (tar.gz or zip) based on OS
103+
case ${OS} in
102104
windows) FORMAT=zip ;;
103105
esac
104106
true
@@ -172,7 +174,7 @@ log_crit() {
172174
uname_os() {
173175
os=$(uname -s | tr '[:upper:]' '[:lower:]')
174176
case "$os" in
175-
msys_nt) os="windows" ;;
177+
msys_nt*) os="windows" ;;
176178
esac
177179
echo "$os"
178180
}
@@ -356,7 +358,7 @@ PREFIX="$OWNER/$REPO"
356358

357359
# use in logging routines
358360
log_prefix() {
359-
echo "$PREFIX"
361+
echo "$PREFIX"
360362
}
361363
PLATFORM="${OS}/${ARCH}"
362364
GITHUB_DOWNLOAD=https://github.com/${OWNER}/${REPO}/releases/download

0 commit comments

Comments
 (0)