services-garbaye/podman-peerjs/50_update.sh
2022-08-12 19:59:57 +02:00

34 lines
863 B
Bash
Executable file

#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
ensure_container_exists ${container_name}
upstream_imageversion=${upstream_images}:${version}
current_imageversion=$(podman container inspect -f '{{.ImageName}}' ${container_name})
if [[ "${upstream_imageversion}" == "${current_imageversion}" ]] ; then
echo Container ${container_name} does not need rebuilding. Exiting.
exit 0
fi
echo Rebuilding container ${container_name} with image ${upstream_imageversion}
# pull first for minimal downtime
podman pull ${upstream_images}:${version} &&
${ABSDIR}/40_stop.sh &&
${ABSDIR}/80_destroy.sh &&
${ABSDIR}/10_install.sh &&
${ABSDIR}/20_enable.sh &&
${ABSDIR}/30_start.sh &&
podman rmi ${current_imageversion} &&
${ABSDIR}/00_status.sh