-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathupdate.sh
executable file
·37 lines (30 loc) · 1.08 KB
/
update.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
#!/bin/bash
set -eo pipefail
cd "$(dirname "$BASH_SOURCE")"
versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
fi
versions=( "${versions[@]%/}" )
for version in "${versions[@]}"; do
echo "Updating Dockerfile for ${version} version"
md5="$(curl -fsSL --retry 5 "https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v${version}/geonetwork.war.md5/download" | awk '{print $1;}')"
echo "MD5 for GeoNetwork ${version} is ${md5}"
echo "Updating ${version}/Dockerfile"
sed -ri \
-e 's/^(ENV GN_VERSION) .*/\1 '"$version"'/' \
-e 's/^(ENV GN_DOWNLOAD_MD5) .*/\1 '"$md5"'/' \
"$version/Dockerfile"
if [[ -f "$version/postgres/Dockerfile" ]]; then
echo "Updating ${version}/postgres/Dockerfile"
sed -ri \
-e 's/^(FROM geonetwork):.*/\1:'"$version"'/' \
"$version/postgres/Dockerfile"
fi
if [[ -f "$version/docker-compose.yml" ]]; then
echo "Updating microservices reference"
sed -ri \
-e "s#geonetwork/gn-cloud-ogc-api-records-service:.*#geonetwork/gn-cloud-ogc-api-records-service:${version}-0#" \
"$version/docker-compose.yml"
fi
done