-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathcheckForUpdates.sh
More file actions
70 lines (58 loc) · 1.79 KB
/
checkForUpdates.sh
File metadata and controls
70 lines (58 loc) · 1.79 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
62
63
64
65
66
67
68
69
70
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
VERSION_FILE="https://raw.githubusercontent.com/fuseio/fuse-network/master/Version"
function updateContainers {
"$DIR/quickstart.sh"
}
function getContainerImageNames {
docker ps -a --format '{{.Image}}'
}
function grabAndParseVersionFile {
wget -O "$DIR/versionFile" $VERSION_FILE
source "$DIR/versionFile"
# Print versions
echo "Oracle version = $DOCKER_IMAGE_ORACLE_VERSION"
echo "Parity version = $DOCKER_IMAGE_FUSE_PARITY_VERSION"
echo "Fuse app version = $DOCKER_IMAGE_FUSE_APP_VERSION"
echo "Netstats version = $DOCKER_IMAGE_NET_STATS_VERSION"
}
function versionComp {
local nodeName=$1
local expectedVersion=$2
if [[ $nodeName == *"$expectedVersion"* ]]; then
return 0
else
return 1
fi
}
function checkContainers {
grabAndParseVersionFile
conatiners=$(getContainerImageNames)
update=0
for IMAGE_NAME_WITH_TAG in ${conatiners[@]}; do
if [[ $IMAGE_NAME_WITH_TAG == *"netstat"* ]]; then
#netstats container
versionComp "$IMAGE_NAME_WITH_TAG" "$DOCKER_IMAGE_NET_STATS_VERSION"
update=$?
elif [[ $IMAGE_NAME_WITH_TAG == *"validator-app"* ]]; then
#fuseapp container
versionComp "$IMAGE_NAME_WITH_TAG" "$DOCKER_IMAGE_FUSE_APP_VERSION"
update=$?
elif [[ $IMAGE_NAME_WITH_TAG == *"node"* ]]; then
#parity container
versionComp "$IMAGE_NAME_WITH_TAG" "$DOCKER_IMAGE_FUSE_PARITY_VERSION"
update=$?
elif [[ $IMAGE_NAME_WITH_TAG == *"native-to-erc20-oracle"* ]]; then
#bridge container
versionComp "$IMAGE_NAME_WITH_TAG" "$DOCKER_IMAGE_ORACLE_VERSION"
update=$?
fi
if [[ $update == 1 ]]; then
break
fi
done
if [[ $update == 1 ]]; then
updateContainers
fi
}
checkContainers