forked from rstudio/r-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·72 lines (60 loc) · 1.67 KB
/
update.sh
File metadata and controls
executable file
·72 lines (60 loc) · 1.67 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
#!/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.1'
[devel]='devel'
)
declare -A os_identifiers=(
[xenial]='ubuntu-1604'
[bionic]='ubuntu-1804'
[focal]='ubuntu-2004'
[centos7]='centos-7'
[centos8]='centos-8'
[opensuse42]='opensuse-42'
[opensuse15]='opensuse-15'
[opensuse152]='opensuse-152'
[opensuse153]='opensuse-153'
)
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
xenial|bionic|focal) template='ubuntu'
;;
centos7|centos8) template='centos'
;;
opensuse42|opensuse15|opensuse152|opensuse153) 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