-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.update-abstreet.sh
executable file
·46 lines (32 loc) · 1 KB
/
.update-abstreet.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
43
44
45
46
#!/bin/sh
# Settings
REPOSITORY=cyipt/actdev
########################################
# Bomb out if something goes wrong
set -e
# Get the version
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
version=`get_latest_release $REPOSITORY`
# End if already present
downloadFile="abst_actdev-${version}.zip"
if [ -f "${downloadFile}" ]; then
exit
fi
# Get the data
rm -f abst_actdev-*.zip
wget -O $downloadFile "https://github.com/cyipt/actdev/releases/download/${version}/abst_actdev.zip"
# Unzip the new version
unzip $downloadFile
# Archive off the old version
rm -rf abstreet.old/
if [ -d "abstreet" ]; then
mv abstreet abstreet.old
fi
# Move the new one into place
mv abst_actdev abstreet
# Change group ownership to the rollout group
chgrp -R rollout abstreet