peerjs : standardisation scripts container (pas de pod)
This commit is contained in:
parent
82a718f9ab
commit
ed9972aad1
19
_podman-common/00_status_container.sh
Executable file
19
_podman-common/00_status_container.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
|
||||||
|
source ${ABSDIR}/../functions.sh
|
||||||
|
source ${ABSDIR}/vars.sh
|
||||||
|
|
||||||
|
ensure_pwd_is_scriptdir
|
||||||
|
ensure_not_root
|
||||||
|
|
||||||
|
echo "Podman images status..."
|
||||||
|
for image in ${upstream_images} ; do
|
||||||
|
podman images ${image} | grep ${image} || echo Image ${image} not found.
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
echo "Checking container status..."
|
||||||
|
podman ps -a | grep ${container_name} || echo container ${container_name} not found.
|
||||||
|
echo
|
||||||
|
echo "Checking systemd unit status..."
|
||||||
|
systemctl --user status ${service_name}
|
20
_podman-common/20_enable_container.sh
Executable file
20
_podman-common/20_enable_container.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
|
||||||
|
source ${ABSDIR}/../functions.sh
|
||||||
|
source ${ABSDIR}/vars.sh
|
||||||
|
|
||||||
|
ensure_pwd_is_scriptdir
|
||||||
|
ensure_not_root
|
||||||
|
|
||||||
|
# container should exist
|
||||||
|
ensure_container_exists ${container_name}
|
||||||
|
# container should NOT be running. Installation script must have stopped it.
|
||||||
|
ensure_container_not_running ${container_name}
|
||||||
|
|
||||||
|
ensure_systemd_as_user_dir_exists
|
||||||
|
|
||||||
|
podman generate systemd --files --name ${container_name}
|
||||||
|
mv *.service ~/.config/systemd/user/
|
||||||
|
|
||||||
|
systemctl --user enable ${service_name}
|
24
_podman-common/30_start_container.sh
Executable file
24
_podman-common/30_start_container.sh
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/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 container does not exists.
|
||||||
|
ensure_container_exists ${container_name}
|
||||||
|
|
||||||
|
# FAIL if systemd unit does not exists.
|
||||||
|
ensure_systemd_unit_exists ${service_name}
|
||||||
|
|
||||||
|
# FAIL if systemd unit is running.
|
||||||
|
ensure_systemd_unit_not_running ${service_name}
|
||||||
|
|
||||||
|
# FAIL if container is already running - without systemd control.
|
||||||
|
ensure_container_not_running ${container_name}
|
||||||
|
|
||||||
|
# OK
|
||||||
|
echo "Starting container through systemd"
|
||||||
|
systemctl --user start ${service_name}
|
28
_podman-common/40_stop_container.sh
Executable file
28
_podman-common/40_stop_container.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
|
||||||
|
source ${ABSDIR}/../functions.sh
|
||||||
|
source ${ABSDIR}/vars.sh
|
||||||
|
|
||||||
|
ensure_pwd_is_scriptdir
|
||||||
|
ensure_not_root
|
||||||
|
|
||||||
|
ensure_container_exists ${container_name}
|
||||||
|
|
||||||
|
# Check of running through systemd (as it should be)
|
||||||
|
if check_systemd_unit_exists ${service_name}; then
|
||||||
|
if check_systemd_unit_running ${service_name}; then
|
||||||
|
systemctl --user stop ${service_name} &&
|
||||||
|
echo Systemd service ${service_name} stopped.
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if running through podman (no systemd), stop with podman stop , then exit
|
||||||
|
if check_container_running ${container_name}; then
|
||||||
|
echo Container found running without systemd unit, stopping it now.
|
||||||
|
podman stop ${container_name}
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo Container ${container_name} is not running.
|
||||||
|
exit 1
|
||||||
|
fi
|
19
_podman-common/70_disable_container.sh
Executable file
19
_podman-common/70_disable_container.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/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 container does not exists
|
||||||
|
ensure_container_exists ${container_name}
|
||||||
|
|
||||||
|
# FAIL if systemd unit does not exists
|
||||||
|
ensure_systemd_unit_exists ${service_name}
|
||||||
|
|
||||||
|
# FAIL if systemd unit is running (stop it first)
|
||||||
|
ensure_systemd_unit_not_running ${service_name}
|
||||||
|
|
||||||
|
systemctl --user disable ${service_name}
|
20
_podman-common/80_destroy_container.sh
Executable file
20
_podman-common/80_destroy_container.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/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 container does not exists
|
||||||
|
ensure_container_exists ${container_name}
|
||||||
|
|
||||||
|
# FAIL if container is running
|
||||||
|
ensure_container_not_running ${container_name}
|
||||||
|
|
||||||
|
${ABSDIR}/70_disable.sh
|
||||||
|
|
||||||
|
rm -f ${HOME}/.config/systemd/user/${service_name}
|
||||||
|
systemctl --user daemon-reload
|
||||||
|
podman rm ${container_name}
|
22
_podman-common/90_prune_container.sh
Executable file
22
_podman-common/90_prune_container.sh
Executable file
|
@ -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 container is running
|
||||||
|
ensure_container_not_running ${container_name}
|
||||||
|
|
||||||
|
# FAIL if container exists
|
||||||
|
ensure_container_not_exists ${container_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
|
|
@ -1,19 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
|
|
||||||
source ${ABSDIR}/../functions.sh
|
|
||||||
source ${ABSDIR}/vars.sh
|
|
||||||
|
|
||||||
ensure_pwd_is_scriptdir
|
|
||||||
ensure_not_root
|
|
||||||
|
|
||||||
echo "Podman images status..."
|
|
||||||
for image in ${upstream_images} ; do
|
|
||||||
podman images ${image} | grep ${image} || echo Image ${image} not found.
|
|
||||||
done
|
|
||||||
echo
|
|
||||||
echo "Checking container status..."
|
|
||||||
podman ps -a | grep ${container_name} || echo container ${container_name} not found.
|
|
||||||
echo
|
|
||||||
echo "Checking systemd unit status..."
|
|
||||||
systemctl --user status ${service_name}
|
|
1
podman-peerjs/00_status.sh
Symbolic link
1
podman-peerjs/00_status.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../_podman-common/00_status_container.sh
|
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
|
|
||||||
source ${ABSDIR}/../functions.sh
|
|
||||||
source ${ABSDIR}/vars.sh
|
|
||||||
|
|
||||||
ensure_pwd_is_scriptdir
|
|
||||||
ensure_not_root
|
|
||||||
|
|
||||||
# container should exist
|
|
||||||
ensure_container_exists ${container_name}
|
|
||||||
# container should NOT be running. Installation script must have stopped it.
|
|
||||||
ensure_container_not_running ${container_name}
|
|
||||||
|
|
||||||
ensure_systemd_as_user_dir_exists
|
|
||||||
|
|
||||||
podman generate systemd --files --name ${container_name}
|
|
||||||
mv *.service ~/.config/systemd/user/
|
|
||||||
|
|
||||||
systemctl --user enable ${service_name}
|
|
1
podman-peerjs/20_enable.sh
Symbolic link
1
podman-peerjs/20_enable.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../_podman-common/20_enable_container.sh
|
|
@ -1,24 +0,0 @@
|
||||||
#!/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 container does not exists.
|
|
||||||
ensure_container_exists ${container_name}
|
|
||||||
|
|
||||||
# FAIL if systemd unit does not exists.
|
|
||||||
ensure_systemd_unit_exists ${service_name}
|
|
||||||
|
|
||||||
# FAIL if systemd unit is running.
|
|
||||||
ensure_systemd_unit_not_running ${service_name}
|
|
||||||
|
|
||||||
# FAIL if container is already running - without systemd control.
|
|
||||||
ensure_container_not_running ${container_name}
|
|
||||||
|
|
||||||
# OK
|
|
||||||
echo "Starting container through systemd"
|
|
||||||
systemctl --user start ${service_name}
|
|
1
podman-peerjs/30_start.sh
Symbolic link
1
podman-peerjs/30_start.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../_podman-common/30_start_container.sh
|
|
@ -1,28 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
|
|
||||||
source ${ABSDIR}/../functions.sh
|
|
||||||
source ${ABSDIR}/vars.sh
|
|
||||||
|
|
||||||
ensure_pwd_is_scriptdir
|
|
||||||
ensure_not_root
|
|
||||||
|
|
||||||
ensure_container_exists ${container_name}
|
|
||||||
|
|
||||||
# Check of running through systemd (as it should be)
|
|
||||||
if check_systemd_unit_exists ${service_name}; then
|
|
||||||
if check_systemd_unit_running ${service_name}; then
|
|
||||||
systemctl --user stop ${service_name} &&
|
|
||||||
echo Systemd service ${service_name} stopped.
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if running through podman (no systemd), stop with podman stop , then exit
|
|
||||||
if check_container_running ${container_name}; then
|
|
||||||
echo Container found running without systemd unit, stopping it now.
|
|
||||||
podman stop ${container_name}
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo Container ${container_name} is not running.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
1
podman-peerjs/40_stop.sh
Symbolic link
1
podman-peerjs/40_stop.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../_podman-common/40_stop_container.sh
|
|
@ -1,19 +0,0 @@
|
||||||
#!/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 container does not exists
|
|
||||||
ensure_container_exists ${container_name}
|
|
||||||
|
|
||||||
# FAIL if systemd unit does not exists
|
|
||||||
ensure_systemd_unit_exists ${service_name}
|
|
||||||
|
|
||||||
# FAIL if systemd unit is running (stop it first)
|
|
||||||
ensure_systemd_unit_not_running ${service_name}
|
|
||||||
|
|
||||||
systemctl --user disable ${service_name}
|
|
1
podman-peerjs/70_disable.sh
Symbolic link
1
podman-peerjs/70_disable.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../_podman-common/70_disable_container.sh
|
|
@ -1,20 +0,0 @@
|
||||||
#!/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 container does not exists
|
|
||||||
ensure_container_exists ${container_name}
|
|
||||||
|
|
||||||
# FAIL if container is running
|
|
||||||
ensure_container_not_running ${container_name}
|
|
||||||
|
|
||||||
${ABSDIR}/70_disable.sh
|
|
||||||
|
|
||||||
rm -f ${HOME}/.config/systemd/user/${service_name}
|
|
||||||
systemctl --user daemon-reload
|
|
||||||
podman rm ${container_name}
|
|
1
podman-peerjs/80_destroy.sh
Symbolic link
1
podman-peerjs/80_destroy.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../_podman-common/80_destroy_container.sh
|
|
@ -1,22 +0,0 @@
|
||||||
#!/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 container is running
|
|
||||||
ensure_container_not_running ${container_name}
|
|
||||||
|
|
||||||
# FAIL if container exists
|
|
||||||
ensure_container_not_exists ${container_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
|
|
1
podman-peerjs/90_prune.sh
Symbolic link
1
podman-peerjs/90_prune.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../_podman-common/90_prune_container.sh
|
Loading…
Reference in a new issue