From ec0d3ff9cd4aac4cbe4636ea103c4cfb61db960c Mon Sep 17 00:00:00 2001 From: Gitouche <26656-gitouche@users.noreply.framagit.org> Date: Thu, 10 Feb 2022 21:25:52 +0100 Subject: [PATCH] peerjs : preparation uniformisation fonctionnement pour 1 container pas de pod --- podman-peerjs/00_status.sh | 8 +++++--- podman-peerjs/10_install.sh | 2 +- podman-peerjs/50_update.sh | 2 +- podman-peerjs/90_prune.sh | 5 ++++- podman-peerjs/vars.sh | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/podman-peerjs/00_status.sh b/podman-peerjs/00_status.sh index 6e0f1f6..bdfda4c 100755 --- a/podman-peerjs/00_status.sh +++ b/podman-peerjs/00_status.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -ABSDIR="$( dirname "$(readlink -f -- "$0")" )" +ABSDIR="$( dirname "$(realpath -s -- "$0")" )" source ${ABSDIR}/../functions.sh source ${ABSDIR}/vars.sh @@ -8,10 +8,12 @@ ensure_pwd_is_scriptdir ensure_not_root echo "Podman images status..." -podman images ${upstream_image} +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} +podman ps -a | grep ${container_name} || echo container ${container_name} not found. echo echo "Checking systemd unit status..." systemctl --user status ${service_name} diff --git a/podman-peerjs/10_install.sh b/podman-peerjs/10_install.sh index e7a09a7..9ddfb2d 100755 --- a/podman-peerjs/10_install.sh +++ b/podman-peerjs/10_install.sh @@ -9,4 +9,4 @@ ensure_not_root ensure_container_not_exists ${container_name} -podman run --name ${container_name} --user nobody -p ${listen_if}:${listen_port}:9000 -d ${upstream_image}:${upstream_version} && podman stop ${container_name} && echo Container ${container_name} successfully built and stopped. +podman run --name ${container_name} --user nobody -p ${listen_if}:${listen_port}:9000 -d ${upstream_images}:${upstream_version} && podman stop ${container_name} && echo Container ${container_name} successfully built and stopped. diff --git a/podman-peerjs/50_update.sh b/podman-peerjs/50_update.sh index b70675e..b32c883 100755 --- a/podman-peerjs/50_update.sh +++ b/podman-peerjs/50_update.sh @@ -9,7 +9,7 @@ ensure_not_root ensure_container_exists ${container_name} -upstream_imageversion=${upstream_image}:${upstream_version} +upstream_imageversion=${upstream_images}:${upstream_version} current_imageversion=$(podman container inspect -f '{{.ImageName}}' ${container_name}) if [[ "${upstream_imageversion}" == "${current_imageversion}" ]] ; then diff --git a/podman-peerjs/90_prune.sh b/podman-peerjs/90_prune.sh index e806745..f52ffbf 100755 --- a/podman-peerjs/90_prune.sh +++ b/podman-peerjs/90_prune.sh @@ -16,4 +16,7 @@ ensure_container_not_exists ${container_name} # FAIL if systemd unit exists ensure_systemd_unit_not_exists ${service_name} -podman rmi "$(podman images -a -q -- ${upstream_image})" || echo 'No images to remove.' +# 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-peerjs/vars.sh b/podman-peerjs/vars.sh index 6f3eb43..642d146 100644 --- a/podman-peerjs/vars.sh +++ b/podman-peerjs/vars.sh @@ -4,5 +4,5 @@ container_name='peerjs-server' service_name="container_${container_name}.service" listen_if='127.0.0.1' listen_port='9000' -upstream_image='docker.io/peerjs/peerjs-server' +upstream_images='docker.io/peerjs/peerjs-server' upstream_version='0.6.1'