From 5edba76fed1eb1dc47552a456bafc6a6bc2e4ea2 Mon Sep 17 00:00:00 2001 From: Gitouche <26656-gitouche@users.noreply.framagit.org> Date: Thu, 10 Feb 2022 22:18:42 +0100 Subject: [PATCH] mutualisation scripts prune --- _podman-common/90_prune_pod.sh | 22 ++++++++++++++++++++++ podman-framadate/90_prune.sh | 23 +---------------------- podman-jitsi/90_prune.sh | 21 +++------------------ podman-matrix/90_prune.sh | 30 +----------------------------- podman-seafile/90_prune.sh | 23 +---------------------- 5 files changed, 28 insertions(+), 91 deletions(-) create mode 100755 _podman-common/90_prune_pod.sh mode change 100755 => 120000 podman-framadate/90_prune.sh mode change 100755 => 120000 podman-matrix/90_prune.sh mode change 100755 => 120000 podman-seafile/90_prune.sh diff --git a/_podman-common/90_prune_pod.sh b/_podman-common/90_prune_pod.sh new file mode 100755 index 0000000..afe3bad --- /dev/null +++ b/_podman-common/90_prune_pod.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +ABSDIR="$( dirname "$(realpath -s -- "$0")" )" +source ${ABSDIR}/../functions.sh +source ${ABSDIR}/vars.sh + +ensure_pwd_is_scriptdir +ensure_not_root + +# FAIL if pod is running +ensure_pod_not_running ${pod_name} + +# FAIL if pod exists +ensure_pod_not_exists ${pod_name} + +# FAIL if systemd unit exists +ensure_systemd_unit_not_exists ${service_name} + +# remove images +for image in ${upstream_images} ; do + podman rmi $(podman images -a -q -- ${image}) || echo Image ${image} not found. +done diff --git a/podman-framadate/90_prune.sh b/podman-framadate/90_prune.sh deleted file mode 100755 index a70384e..0000000 --- a/podman-framadate/90_prune.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -ABSDIR="$( dirname "$(readlink -f -- "$0")" )" -source ${ABSDIR}/../functions.sh -source ${ABSDIR}/vars.sh - -ensure_pwd_is_scriptdir -ensure_not_root - -# FAIL if pod is running -ensure_pod_not_running ${pod_name} - -# FAIL if pod exists -ensure_pod_not_exists ${pod_name} - -# FAIL if systemd unit exists -ensure_systemd_unit_not_exists ${service_name} - -# remove images -for image in ${upstream_images} ; do - podman rmi $(podman images -a -q -- ${image}) || echo Image ${image} not found. -done diff --git a/podman-framadate/90_prune.sh b/podman-framadate/90_prune.sh new file mode 120000 index 0000000..5fed91e --- /dev/null +++ b/podman-framadate/90_prune.sh @@ -0,0 +1 @@ +../_podman-common/90_prune_pod.sh \ No newline at end of file diff --git a/podman-jitsi/90_prune.sh b/podman-jitsi/90_prune.sh index 284d7be..0a73c82 100755 --- a/podman-jitsi/90_prune.sh +++ b/podman-jitsi/90_prune.sh @@ -4,22 +4,7 @@ ABSDIR="$( dirname "$(readlink -f -- "$0")" )" source ${ABSDIR}/../functions.sh source ${ABSDIR}/vars.sh -ensure_pwd_is_scriptdir -ensure_not_root - -# FAIL if pod is running -ensure_pod_not_running ${pod_name} - -# FAIL if pod exists -ensure_pod_not_exists ${pod_name} - -# FAIL if systemd unit exists -ensure_systemd_unit_not_exists ${service_name} - -# remove volume +# Run regular prune script for pods +../_podman-common/90_prune_pod.sh && +# Remove configuration volume podman unshare rm -rf ~/${confvolume}/ - -# remove images -for image in ${upstream_images} ; do - podman rmi $(podman images -a -q -- ${image}) || echo Image ${image} not found. -done diff --git a/podman-matrix/90_prune.sh b/podman-matrix/90_prune.sh deleted file mode 100755 index 93231ad..0000000 --- a/podman-matrix/90_prune.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -ABSDIR="$( dirname "$(readlink -f -- "$0")" )" -source ${ABSDIR}/../functions.sh -source ${ABSDIR}/vars.sh - -ensure_pwd_is_scriptdir -ensure_not_root - -# FAIL if pod is running -ensure_pod_not_running ${pod_name} - -# FAIL if pod exists -ensure_pod_not_exists ${pod_name} - -# FAIL if systemd unit exists -ensure_systemd_unit_not_exists ${service_name} - -# remove volume -#podman unshare rm -rf ~/${confvolume}/ -#podman volume rm matrixdotorg_synapse-data -#podman volume rm matrixdotorg_synapse-pgsql - -# remove images -#for image in ${upstream_images} ; do -# podman rmi $(podman images -a -q -- ${image}) || echo Image ${image} not found. -#done -podman rmi $(podman images -a -q -- ${postgres_image}) || echo Image ${postgres_image} not found. -podman rmi $(podman images -a -q -- ${synapse_image}) || echo Image ${synapse_image} not found. diff --git a/podman-matrix/90_prune.sh b/podman-matrix/90_prune.sh new file mode 120000 index 0000000..5fed91e --- /dev/null +++ b/podman-matrix/90_prune.sh @@ -0,0 +1 @@ +../_podman-common/90_prune_pod.sh \ No newline at end of file diff --git a/podman-seafile/90_prune.sh b/podman-seafile/90_prune.sh deleted file mode 100755 index a70384e..0000000 --- a/podman-seafile/90_prune.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -ABSDIR="$( dirname "$(readlink -f -- "$0")" )" -source ${ABSDIR}/../functions.sh -source ${ABSDIR}/vars.sh - -ensure_pwd_is_scriptdir -ensure_not_root - -# FAIL if pod is running -ensure_pod_not_running ${pod_name} - -# FAIL if pod exists -ensure_pod_not_exists ${pod_name} - -# FAIL if systemd unit exists -ensure_systemd_unit_not_exists ${service_name} - -# remove images -for image in ${upstream_images} ; do - podman rmi $(podman images -a -q -- ${image}) || echo Image ${image} not found. -done diff --git a/podman-seafile/90_prune.sh b/podman-seafile/90_prune.sh new file mode 120000 index 0000000..5fed91e --- /dev/null +++ b/podman-seafile/90_prune.sh @@ -0,0 +1 @@ +../_podman-common/90_prune_pod.sh \ No newline at end of file