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

64 lines
1.3 KiB
Bash
Raw Normal View History

2022-01-21 20:36:28 +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
ensure_pod_exists ${pod_name}
2022-01-21 20:50:02 +00:00
ensure_systemd_unit_exists ${service_name}
2022-01-21 20:36:28 +00:00
current_version=$(podman ps -a --format "{{.Image}}" | grep prosody | awk -F: '{print $NF}')
reinstall_please () {
2022-08-12 19:01:57 +00:00
for image in ${upstream_images}; do
podman image pull ${image}:${version}
done &&
2022-01-21 20:36:28 +00:00
check_pod_running ${pod_name} && ./40_stop.sh
./70_disable.sh && \
./80_destroy.sh && \
./10_install.sh && \
./20_enable.sh && \
./30_start.sh
}
cleanup_images () {
echo "Remove ${current_version} images?"
select yn in "Yes" "No"; do
case $yn in
Yes)
for image in ${upstream_images}; do
podman rmi ${image}:${current_version}
done
exit 0
;;
No)
exit 0
;;
esac
done
}
if [ ${current_version} != ${version} ]; then
if [[ "${current_version}" > "${version}" ]]; then
echo "WARNING : you are about to DOWNGRADE your installation"
fi
echo "Migrating from ${current_version} to ${version}. Proceed?"
select yn in "Yes" "No"; do
case $yn in
Yes)
2022-01-21 20:50:02 +00:00
reinstall_please && \
2022-01-21 20:36:28 +00:00
cleanup_images
exit 0
;;
No)
exit 0
;;
esac
done
else
echo "Already using version ${version}. Exiting."
fi