2021-05-04 20:28:54 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2022-02-10 21:01:32 +00:00
|
|
|
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
|
2021-05-04 20:28:54 +00:00
|
|
|
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}
|
|
|
|
|
2022-02-10 20:51:36 +00:00
|
|
|
upstream_imageversion=${upstream_images}:${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
|
|
|
|
fi
|
|
|
|
|
2021-06-04 17:37:41 +00:00
|
|
|
echo Rebuilding container ${container_name} with image ${upstream_imageversion}
|
|
|
|
|
2022-03-05 09:26:09 +00:00
|
|
|
# build first for minimal downtime
|
|
|
|
source ${ABSDIR}/zz_build-images.sh
|
2021-06-04 09:07:51 +00:00
|
|
|
|
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
|