-
Notifications
You must be signed in to change notification settings - Fork 5
/
update-validate-article-json.sh
executable file
·42 lines (37 loc) · 1.2 KB
/
update-validate-article-json.sh
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
#!/bin/bash
# fetch latest validate-article-json
set -e
arch=$(uname -m)
fname=""
if [ "$arch" = "x86_64" ]; then
fname="linux-amd64"
fi
# aka "ARM64"
if [ "$arch" = "aarch64" ]; then
fname="linux-arm64"
fi
if [ -z "$fname" ]; then
echo "unsupported architecture: $arch"
exit 1
fi
if [ ! -e validate-article-json ]; then
wget "https://github.com/elifesciences/validate-article-json/releases/latest/download/$fname" \
--quiet \
--output-document=validate-article-json
chmod +x validate-article-json
else
printf "checking ... "
wget "https://github.com/elifesciences/validate-article-json/releases/latest/download/$fname.sha256" \
--quiet \
--output-document=validate-article-json.sha256
sed -ie 's/linux-amd64/validate-article-json/' validate-article-json.sha256
sha256sum --check validate-article-json.sha256 || {
printf "updating validate-article-json ... "
rm -f validate-article-json
wget "https://github.com/elifesciences/validate-article-json/releases/latest/download/$fname" \
--quiet \
--output-document=validate-article-json
chmod +x validate-article-json
printf "done\n"
}
fi