-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsamtw
executable file
·38 lines (31 loc) · 1.11 KB
/
samtw
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
#!/usr/bin/env sh
if [ ! -f .samt/samt-wrapper.properties ]; then
echo ".samt/samt-wrapper.properties file not found." >&2
exit 1
fi
. .samt/samt-wrapper.properties
if ! command -v tar > /dev/null; then
echo "This script requires 'tar' to be installed." >&2
exit 1
fi
mkdir -p .samt/wrapper
currentVersion=$(cat .samt/wrapper/version.txt 2> /dev/null || echo "0.0.0")
if [ "$currentVersion" != "$samtVersion" ]; then
echo "Downloading samt $samtVersion from '$distributionUrl'..."
if command -v curl > /dev/null; then
if ! curl -s -L "$distributionUrl" | tar x -C .samt/wrapper; then
echo "An error occurred while downloading '$distributionUrl' archive using curl." >&2
exit 1
fi
elif command -v curl > /dev/null; then
if ! wget -qO- "$distributionUrl" | tar x -C .samt/wrapper; then
echo "An error occurred while downloading '$distributionUrl' archive using wget." >&2
exit 1
fi
else
echo "samtw requires either 'curl' or 'wget' to be installed." >&2
exit 1
fi
echo "$samtVersion" > .samt/wrapper/version.txt
fi
exec ".samt/wrapper/cli-shadow/bin/cli" "$@"