Skip to content

Commit dbfffe5

Browse files
committed
update.sh: Add 'create_variant' function
This commit includes no functional changes besides a new debug info. Signed-off-by: Daniel Rudolf <[email protected]>
1 parent fb5c1a2 commit dbfffe5

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

update.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,33 @@ declare -A base=(
1919
[fpm-alpine]='alpine'
2020
)
2121

22-
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
23-
sha256="$(curl -fsSL "https://files.phpmyadmin.net/phpMyAdmin/$latest/phpMyAdmin-$latest-all-languages.tar.xz.sha256" | cut -f1 -d ' ' | tr -cd 'a-f0-9' | cut -c 1-64)"
22+
function create_variant() {
23+
local variant="$1"
24+
local version="$2"
25+
local sha256="$3"
2426

25-
for variant in apache fpm fpm-alpine; do
26-
template="Dockerfile-${base[$variant]}.template"
27-
cp $template "$variant/Dockerfile"
27+
local branch="$(sed -ne 's/^\([0-9]*\.[0-9]*\)\..*$/\1/p' <<< "$version")"
28+
29+
echo "updating $version [$branch] $variant"
30+
31+
local template="Dockerfile-${base[$variant]}.template"
32+
cp "$template" "$variant/Dockerfile"
2833
cp config.inc.php "$variant/config.inc.php"
2934
cp docker-entrypoint.sh "$variant/docker-entrypoint.sh"
3035
sed -ri -e '
31-
s/%%VERSION%%/'"$latest"'/;
36+
s/%%VERSION%%/'"$version"'/;
3237
s/%%SHA256%%/'"$sha256"'/;
3338
s/%%VARIANT%%/'"$variant"'/;
3439
s/%%CMD%%/'"${cmd[$variant]}"'/;
3540
' "$variant/Dockerfile"
3641
if [ "$variant" != "apache" ]; then
3742
sed -i "/^# start: Apache specific settings$/,/^# end: Apache specific settings$/d" "$variant/docker-entrypoint.sh"
3843
fi
44+
}
45+
46+
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
47+
sha256="$(curl -fsSL "https://files.phpmyadmin.net/phpMyAdmin/$latest/phpMyAdmin-$latest-all-languages.tar.xz.sha256" | cut -f1 -d ' ' | tr -cd 'a-f0-9' | cut -c 1-64)"
48+
49+
for variant in apache fpm fpm-alpine; do
50+
create_variant "$variant" "$latest" "$sha256"
3951
done

0 commit comments

Comments
 (0)