-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·76 lines (64 loc) · 1.8 KB
/
update.sh
File metadata and controls
executable file
·76 lines (64 loc) · 1.8 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
71
72
73
74
75
76
#!/bin/bash
set -Eeuo pipefail
declare -A r_versions=(
[4.1]='4.1.3'
[4.2]='4.2.3'
[4.3]='4.3.3'
[4.4]='4.4.3'
[4.5]='4.5.3'
[devel]='devel'
[next]='next'
)
declare -A os_identifiers=(
[jammy]='ubuntu-2204'
[noble]='ubuntu-2404'
[resolute]='ubuntu-2604'
[bookworm]='debian-12'
[trixie]='debian-13'
[centos7]='centos-7'
[rockylinux8]='centos-8'
[rockylinux9]='rhel-9'
[rockylinux10]='rhel-10'
[opensuse156]='opensuse-156'
)
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
# R 3.x versions are not supported on Rocky Linux 10
major=$(cut -d '.' -f1 <<< "$version")
if [[ "$variant" == "rockylinux10" ]] && [ "$major" == "3" ]; then
continue
fi
dir="$version/$variant"
mkdir -p $dir
case "$variant" in
jammy|noble|resolute) template='ubuntu'
;;
bookworm|trixie) template='debian'
;;
centos7|rockylinux8) template='centos'
;;
rockylinux9|rockylinux10) template='rockylinux'
;;
opensuse156) 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"
# Record MAJOR.MINOR.PATCH version as the tag alias
echo "${r_versions[$version]}" > "$dir/version.txt"
done
done