From db912968935773af60787ff6aedd9189a33fda9c Mon Sep 17 00:00:00 2001 From: Gitouche <26656-gitouche@users.noreply.framagit.org> Date: Fri, 28 Jan 2022 13:31:22 +0100 Subject: [PATCH] refactoring scripts identiques : pod destroy --- _podman-common/80_destroy_pod.sh | 20 ++++++++++++++++++++ podman-framadate/80_destroy.sh | 21 +-------------------- podman-jitsi/80_destroy.sh | 21 +-------------------- podman-matrix/80_destroy.sh | 23 +---------------------- podman-seafile/80_destroy.sh | 21 +-------------------- 5 files changed, 24 insertions(+), 82 deletions(-) create mode 100755 _podman-common/80_destroy_pod.sh mode change 100755 => 120000 podman-framadate/80_destroy.sh mode change 100755 => 120000 podman-jitsi/80_destroy.sh mode change 100755 => 120000 podman-matrix/80_destroy.sh mode change 100755 => 120000 podman-seafile/80_destroy.sh diff --git a/_podman-common/80_destroy_pod.sh b/_podman-common/80_destroy_pod.sh new file mode 100755 index 0000000..f4bea63 --- /dev/null +++ b/_podman-common/80_destroy_pod.sh @@ -0,0 +1,20 @@ +#!/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 does not exists +ensure_pod_exists ${pod_name} + +# FAIL if pod is running +ensure_pod_not_running ${pod_name} + +${ABSDIR}/70_disable.sh + +rm -f ${HOME}/.config/systemd/user/${service_name} +systemctl --user daemon-reload +podman pod rm ${pod_name} diff --git a/podman-framadate/80_destroy.sh b/podman-framadate/80_destroy.sh deleted file mode 100755 index f4bea63..0000000 --- a/podman-framadate/80_destroy.sh +++ /dev/null @@ -1,20 +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 does not exists -ensure_pod_exists ${pod_name} - -# FAIL if pod is running -ensure_pod_not_running ${pod_name} - -${ABSDIR}/70_disable.sh - -rm -f ${HOME}/.config/systemd/user/${service_name} -systemctl --user daemon-reload -podman pod rm ${pod_name} diff --git a/podman-framadate/80_destroy.sh b/podman-framadate/80_destroy.sh new file mode 120000 index 0000000..1b8a370 --- /dev/null +++ b/podman-framadate/80_destroy.sh @@ -0,0 +1 @@ +../_podman-common/80_destroy_pod.sh \ No newline at end of file diff --git a/podman-jitsi/80_destroy.sh b/podman-jitsi/80_destroy.sh deleted file mode 100755 index f4bea63..0000000 --- a/podman-jitsi/80_destroy.sh +++ /dev/null @@ -1,20 +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 does not exists -ensure_pod_exists ${pod_name} - -# FAIL if pod is running -ensure_pod_not_running ${pod_name} - -${ABSDIR}/70_disable.sh - -rm -f ${HOME}/.config/systemd/user/${service_name} -systemctl --user daemon-reload -podman pod rm ${pod_name} diff --git a/podman-jitsi/80_destroy.sh b/podman-jitsi/80_destroy.sh new file mode 120000 index 0000000..1b8a370 --- /dev/null +++ b/podman-jitsi/80_destroy.sh @@ -0,0 +1 @@ +../_podman-common/80_destroy_pod.sh \ No newline at end of file diff --git a/podman-matrix/80_destroy.sh b/podman-matrix/80_destroy.sh deleted file mode 100755 index 9c1d475..0000000 --- a/podman-matrix/80_destroy.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 does not exists -ensure_pod_exists ${pod_name} - -# FAIL if pod is running -ensure_pod_not_running ${pod_name} - -${ABSDIR}/70_disable.sh - -rm -f ${HOME}/.config/systemd/user/${service_name} -rm -f ${HOME}/.config/systemd/user/container-${container_name}.service -rm -f ${HOME}/.config/systemd/user/container-${db_container_name}.service -systemctl --user daemon-reload -podman pod rm ${pod_name} diff --git a/podman-matrix/80_destroy.sh b/podman-matrix/80_destroy.sh new file mode 120000 index 0000000..1b8a370 --- /dev/null +++ b/podman-matrix/80_destroy.sh @@ -0,0 +1 @@ +../_podman-common/80_destroy_pod.sh \ No newline at end of file diff --git a/podman-seafile/80_destroy.sh b/podman-seafile/80_destroy.sh deleted file mode 100755 index f4bea63..0000000 --- a/podman-seafile/80_destroy.sh +++ /dev/null @@ -1,20 +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 does not exists -ensure_pod_exists ${pod_name} - -# FAIL if pod is running -ensure_pod_not_running ${pod_name} - -${ABSDIR}/70_disable.sh - -rm -f ${HOME}/.config/systemd/user/${service_name} -systemctl --user daemon-reload -podman pod rm ${pod_name} diff --git a/podman-seafile/80_destroy.sh b/podman-seafile/80_destroy.sh new file mode 120000 index 0000000..1b8a370 --- /dev/null +++ b/podman-seafile/80_destroy.sh @@ -0,0 +1 @@ +../_podman-common/80_destroy_pod.sh \ No newline at end of file