forked from gesinn-it/docker-mediawiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
42 lines (34 loc) · 1.1 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
#!/bin/bash
set -euo pipefail
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
mediawikiReleases=("$@")
if [ ${#mediawikiReleases[@]} -eq 0 ]; then
mediawikiReleases=(1.*/)
fi
mediawikiReleases=("${mediawikiReleases[@]%/}")
echo ${mediawikiReleases[*]}
declare -A composerVersion=(
[1.31]='1.10.24'
[default]='2.1.14'
)
function mediawiki_version() {
git ls-remote --sort=version:refname --tags https://github.com/wikimedia/mediawiki.git |
cut -d/ -f3 |
tr -d '^{}' |
grep -E "^$1" |
tail -1
}
for mediawikiRelease in "${mediawikiReleases[@]}"; do
mediawikiReleaseDir="$mediawikiRelease"
mediawikiVersion="$(mediawiki_version $mediawikiRelease)"
composerVersion=${composerVersion[$mediawikiRelease]-${composerVersion[default]}}
for dbType in sqlite mysql; do
dir="$mediawikiReleaseDir/$dbType"
mkdir -p "$dir"
sed -r \
-e 's!%%MEDIAWIKI_VERSION%%!'"$mediawikiVersion"'!g' \
-e 's!%%MEDIAWIKI_MAJOR_VERSION%%!'"$mediawikiRelease"'!g' \
-e 's!%%COMPOSER_VERSION%%!'"$composerVersion"'!g' \
"Dockerfile-${dbType}.template" >"$dir/Dockerfile"
done
done