From bbb688436cebd010aedefeabc1fcac1e879c8777 Mon Sep 17 00:00:00 2001 From: Gitouche <26656-gitouche@users.noreply.framagit.org> Date: Fri, 28 Jan 2022 13:15:48 +0100 Subject: [PATCH] refactoring scripts identiques : pod enable --- _podman-common/20_enable_pod.sh | 19 +++++++++++++++++++ podman-framadate/20_enable.sh | 20 +------------------- podman-jitsi/20_enable.sh | 20 +------------------- podman-matrix/20_enable.sh | 20 +------------------- podman-seafile/20_enable.sh | 20 +------------------- 5 files changed, 23 insertions(+), 76 deletions(-) create mode 100755 _podman-common/20_enable_pod.sh mode change 100755 => 120000 podman-framadate/20_enable.sh mode change 100755 => 120000 podman-jitsi/20_enable.sh mode change 100755 => 120000 podman-matrix/20_enable.sh mode change 100755 => 120000 podman-seafile/20_enable.sh diff --git a/_podman-common/20_enable_pod.sh b/_podman-common/20_enable_pod.sh new file mode 100755 index 0000000..e64292c --- /dev/null +++ b/_podman-common/20_enable_pod.sh @@ -0,0 +1,19 @@ +#!/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} + +ensure_systemd_as_user_dir_exists + +# pod must be running and not managed by systemd +podman generate systemd --files --name ${pod_name} +mv *.service ~/.config/systemd/user/ + +podman pod stop ${pod_name} +systemctl --user enable ${service_name} diff --git a/podman-framadate/20_enable.sh b/podman-framadate/20_enable.sh deleted file mode 100755 index e64292c..0000000 --- a/podman-framadate/20_enable.sh +++ /dev/null @@ -1,19 +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 - -ensure_pod_exists ${pod_name} - -ensure_systemd_as_user_dir_exists - -# pod must be running and not managed by systemd -podman generate systemd --files --name ${pod_name} -mv *.service ~/.config/systemd/user/ - -podman pod stop ${pod_name} -systemctl --user enable ${service_name} diff --git a/podman-framadate/20_enable.sh b/podman-framadate/20_enable.sh new file mode 120000 index 0000000..ea522ac --- /dev/null +++ b/podman-framadate/20_enable.sh @@ -0,0 +1 @@ +../_podman-common/20_enable_pod.sh \ No newline at end of file diff --git a/podman-jitsi/20_enable.sh b/podman-jitsi/20_enable.sh deleted file mode 100755 index e64292c..0000000 --- a/podman-jitsi/20_enable.sh +++ /dev/null @@ -1,19 +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 - -ensure_pod_exists ${pod_name} - -ensure_systemd_as_user_dir_exists - -# pod must be running and not managed by systemd -podman generate systemd --files --name ${pod_name} -mv *.service ~/.config/systemd/user/ - -podman pod stop ${pod_name} -systemctl --user enable ${service_name} diff --git a/podman-jitsi/20_enable.sh b/podman-jitsi/20_enable.sh new file mode 120000 index 0000000..ea522ac --- /dev/null +++ b/podman-jitsi/20_enable.sh @@ -0,0 +1 @@ +../_podman-common/20_enable_pod.sh \ No newline at end of file diff --git a/podman-matrix/20_enable.sh b/podman-matrix/20_enable.sh deleted file mode 100755 index e64292c..0000000 --- a/podman-matrix/20_enable.sh +++ /dev/null @@ -1,19 +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 - -ensure_pod_exists ${pod_name} - -ensure_systemd_as_user_dir_exists - -# pod must be running and not managed by systemd -podman generate systemd --files --name ${pod_name} -mv *.service ~/.config/systemd/user/ - -podman pod stop ${pod_name} -systemctl --user enable ${service_name} diff --git a/podman-matrix/20_enable.sh b/podman-matrix/20_enable.sh new file mode 120000 index 0000000..ea522ac --- /dev/null +++ b/podman-matrix/20_enable.sh @@ -0,0 +1 @@ +../_podman-common/20_enable_pod.sh \ No newline at end of file diff --git a/podman-seafile/20_enable.sh b/podman-seafile/20_enable.sh deleted file mode 100755 index e64292c..0000000 --- a/podman-seafile/20_enable.sh +++ /dev/null @@ -1,19 +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 - -ensure_pod_exists ${pod_name} - -ensure_systemd_as_user_dir_exists - -# pod must be running and not managed by systemd -podman generate systemd --files --name ${pod_name} -mv *.service ~/.config/systemd/user/ - -podman pod stop ${pod_name} -systemctl --user enable ${service_name} diff --git a/podman-seafile/20_enable.sh b/podman-seafile/20_enable.sh new file mode 120000 index 0000000..ea522ac --- /dev/null +++ b/podman-seafile/20_enable.sh @@ -0,0 +1 @@ +../_podman-common/20_enable_pod.sh \ No newline at end of file