services-garbaye/podman-peerjs/50_update.sh
2021-06-04 11:40:33 +02:00

34 lines
853 B
Bash
Executable file

#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
ensure_container_exists ${container_name}
upstream_imageversion=${upstream_image}:${upstream_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
else
echo Rebuilding container ${container_name} with image ${upstream_imageversion}
fi
# pull first for minimal downtime
podman pull ${upstream_imageversion}
${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