-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·74 lines (62 loc) · 1.69 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
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
71
72
73
74
#!/bin/bash
set -Eeuo pipefail
declare -A r_versions=(
[3.1]='3.1.3'
[3.2]='3.2.5'
[3.3]='3.3.3'
[3.4]='3.4.4'
[3.5]='3.5.3'
[3.6]='3.6.3'
[4.0]='4.0.5'
[4.1]='4.1.3'
[4.2]='4.2.1'
[devel]='devel'
)
declare -A os_identifiers=(
[bionic]='ubuntu-1804'
[focal]='ubuntu-2004'
[jammy]='ubuntu-2204'
[centos7]='centos-7'
[rockylinux8]='centos-8'
[rockylinux9]='rhel-9'
[opensuse153]='opensuse-153'
[opensuse154]='opensuse-154'
)
generated_warning() {
cat <<-EOH
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
EOH
}
for version in "${!r_versions[@]}"; do
for variant in "${!os_identifiers[@]}"; do
dir="$version/$variant"
mkdir -p $dir
case "$variant" in
bionic|focal|jammy) template='ubuntu'
;;
centos7|rockylinux8) template='centos'
;;
rockylinux9) template='rockylinux'
;;
opensuse153|opensuse154) template='opensuse'
;;
esac
template="Dockerfile-${template}.template"
{ generated_warning; cat "$template"; } > "$dir/Dockerfile"
sed -ri \
-e "s/%%VARIANT%%/${variant}/" \
-e "s/%%R_VERSION%%/${r_versions[$version]}/" \
-e "s/%%OS_IDENTIFIER%%/${os_identifiers[$variant]}/" \
"$dir/Dockerfile"
cp docker-compose.test.yml $dir
# Add MAJOR.MINOR.PATCH version tags
mkdir -p "$dir/hooks" && cp post_push.template.sh "$dir/hooks/post_push"
sed -ri \
-e "s/%%TAG%%/${r_versions[$version]}-${variant}/" \
"$dir/hooks/post_push"
done
done