Silent download the new version of the image

Also print the new version in the temp file.
This commit is contained in:
Jeremy Gardais 2018-08-28 11:20:33 +02:00
parent 9e5e3fa563
commit 805905fbbd
1 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,7 @@
# Purpose {{{
## Create a temp file (to monitor) if an upgrade is available for rocket.chat
## image on the Docker Hub.
## Download the new version of the image.
## How-to use {{{
### 1. Needs imagetags script, in the same directory
### cf. https://git.ipr.univ-rennes1.fr/cellinfo/scripts/src/master/docker/imagetags
@ -37,6 +38,7 @@ if [ ! $(docker container ls | grep -q -- "${rkt_repo_name}${rkt_image_name}") ]
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test ${rkt_image_name} — Current version is ${rkt_current_version}."
else
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test ${rkt_image_name} — No container runs with ${rkt_image_name} image on this host."
rm -f -- "${rkt_new_version_file}"
exit 1
fi
# }}}
@ -46,6 +48,8 @@ if [ "${rkt_current_version}" != "${rkt_new_version}" ]; then
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test version — An upgrade is available for ${rkt_image_name}: ${rkt_new_version}."
# Create a temp file to monitor
touch -- "${rkt_new_version_file}"
printf '\e[1;35m%-6s\e[m\n' "An upgrade is available for ${rkt_image_name}: ${rkt_new_version}." >> "${rkt_new_version_file}"
docker pull "${rkt_repo_name}/${rkt_image_name}:${rkt_new_version}" > /dev/null
else
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test version — The current version is up-to-date."
rm -f -- "${rkt_new_version_file}"