#!/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 image 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 image rm ${current_imageversion} && ${ABSDIR}/00_status.sh