services-garbaye/podman-peerjs/50_update.sh

34 lines
853 B
Bash
Raw Normal View History

2021-05-04 20:28:54 +00:00
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
2021-06-04 09:07:51 +00:00
ensure_container_exists ${container_name}
2021-06-04 08:56:44 +00:00
upstream_imageversion=${upstream_image}:${upstream_version}
2021-06-04 08:52:34 +00:00
current_imageversion=$(podman container inspect -f '{{.ImageName}}' ${container_name})
2021-06-04 09:07:51 +00:00
if [[ "${upstream_imageversion}" == "${current_imageversion}" ]] ; then
2021-06-04 09:40:33 +00:00
echo Container ${container_name} does not need rebuilding. Exiting.
2021-06-04 08:52:34 +00:00
exit 0
2021-06-04 09:07:51 +00:00
else
2021-06-04 09:40:33 +00:00
echo Rebuilding container ${container_name} with image ${upstream_imageversion}
2021-06-04 08:52:34 +00:00
fi
2021-06-04 09:13:50 +00:00
# pull first for minimal downtime
2021-06-04 09:07:51 +00:00
podman pull ${upstream_imageversion}
2021-06-04 09:27:29 +00:00
${ABSDIR}/40_stop.sh
2021-06-04 09:07:51 +00:00
${ABSDIR}/80_destroy.sh
${ABSDIR}/10_install.sh
${ABSDIR}/20_enable.sh
${ABSDIR}/30_start.sh
2021-06-04 09:13:50 +00:00
podman rmi ${current_imageversion}
${ABSDIR}/00_status.sh