From 2b6eed37e5e6a11db7b656e41a9b5a0ac72d5fd3 Mon Sep 17 00:00:00 2001 From: Gitouche <26656-gitouche@users.noreply.framagit.org> Date: Fri, 21 Jan 2022 21:36:28 +0100 Subject: [PATCH] Jitsi : ajout script de MAJ (youpi!) --- podman-jitsi/50_update.sh | 63 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 podman-jitsi/50_update.sh diff --git a/podman-jitsi/50_update.sh b/podman-jitsi/50_update.sh new file mode 100755 index 0000000..01c1537 --- /dev/null +++ b/podman-jitsi/50_update.sh @@ -0,0 +1,63 @@ +#!/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} + +current_version=$(podman ps -a --format "{{.Image}}" | grep prosody | awk -F: '{print $NF}') + +reinstall_please () { + for image in ${upstream_images}; do + podman pull ${image}:${version} || exit 1 + done + check_pod_running ${pod_name} && ./40_stop.sh + ./70_disable.sh && \ + ./80_destroy.sh && \ + ./10_install.sh && \ + ./40_stop.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) + reinstall_please + cleanup_images + exit 0 + ;; + No) + exit 0 + ;; + esac + done +else + echo "Already using version ${version}. Exiting." +fi