forked from exercism/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetch-configlet
More file actions
executable file
·61 lines (51 loc) · 1.09 KB
/
fetch-configlet
File metadata and controls
executable file
·61 lines (51 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
LATEST=https://github.com/exercism/configlet/releases/latest
echo ">>> Fetching configlet..."
echo
echo "$ uname"
uname
OS=$(
case $(uname) in
(Darwin*)
echo "mac";;
(Linux*)
echo "linux";;
(Windows*)
echo "windows";;
(MINGW*)
echo "windows";;
(*)
echo "linux";;
esac)
EXT=$(
case $OS in
(windows*)
echo "zip";;
(*)
echo "tgz";;
esac)
echo "$ uname -m"
uname -m
ARCH=$(
case $(uname -m) in
(*64*)
echo 64bit;;
(*686*)
echo 32bit;;
(*386*)
echo 32bit;;
(*)
echo 64bit;;
esac)
VERSION="$(curl --silent --head $LATEST | awk -v FS=/ 'BEGIN {IGNORECASE = 1} /Location:/{print $NF}' | tr -d '\r')"
URL=https://github.com/exercism/configlet/releases/download/$VERSION/configlet-$OS-${ARCH}.$EXT
echo
echo ">>> Downloading from ${URL}"
case $EXT in
(*zip)
curl -s --location $URL -o bin/latest-configlet.zip
unzip bin/latest-configlet.zip -d bin/
rm bin/latest-configlet.zip;;
(*)
curl -s --location $URL | tar xz -C bin/;;
esac