shellcheck

This commit is contained in:
Gitouche 2023-07-29 16:48:12 +02:00
parent d5e94c31a4
commit f133550d4b
9 changed files with 59 additions and 59 deletions

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root

View File

@ -1,19 +1,19 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
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 image list ${image} | grep ${image} || echo Image ${image} not found.
podman image list "${image}" | grep "${image}" || echo Image "${image}" not found.
done
echo
echo "Checking pod status..."
podman pod ps | grep ${pod_name} || echo Pod ${pod_name} not found.
podman pod ps | grep "${pod_name}" || echo Pod "${pod_name}" not found.
echo
echo "Checking systemd unit status..."
systemctl --user status ${service_name}
systemctl --user status "${service_name}"

View File

@ -1,21 +1,21 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
# container should exist
ensure_container_exists ${container_name}
ensure_container_exists "${container_name}"
# container should NOT be running. Installation script must have stopped it.
ensure_container_not_running ${container_name}
ensure_container_not_running "${container_name}"
ensure_systemd_as_user_dir_exists
podman generate systemd --stop-timeout=30 --files --name ${container_name}
mv *.service ~/.config/systemd/user/
podman generate systemd --stop-timeout=30 --files --name "${container_name}"
mv -- *.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable ${service_name}
systemctl --user enable "${service_name}"

View File

@ -1,21 +1,21 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
# pod should exist
ensure_pod_exists ${pod_name}
ensure_pod_exists "${pod_name}"
# pod should NOT be running. Installation script must have stopped it.
ensure_pod_not_running ${pod_name}
ensure_pod_not_running "${pod_name}"
ensure_systemd_as_user_dir_exists
podman generate systemd --stop-timeout=30 --files --name ${pod_name}
mv *.service ~/.config/systemd/user/
podman generate systemd --stop-timeout=30 --files --name "${pod_name}"
mv -- *.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable ${service_name}
systemctl --user enable "${service_name}"

View File

@ -1,24 +1,24 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
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}
ensure_container_exists "${container_name}"
# FAIL if systemd unit does not exists.
ensure_systemd_unit_exists ${service_name}
ensure_systemd_unit_exists "${service_name}"
# FAIL if systemd unit is running.
ensure_systemd_unit_not_running ${service_name}
ensure_systemd_unit_not_running "${service_name}"
# FAIL if container is already running - without systemd control.
ensure_container_not_running ${container_name}
ensure_container_not_running "${container_name}"
# OK
echo "Starting container through systemd"
systemctl --user start ${service_name}
systemctl --user start "${service_name}"

View File

@ -1,32 +1,32 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
ensure_container_exists ${container_name}
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.
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
# Leave if container is correctly stopped
if ! check_container_running ${container_name}; then
if ! check_container_running "${container_name}"; then
exit 0
fi
fi
# Check if running through podman (no systemd), stop with podman container stop , then exit
if check_container_running ${container_name}; then
if check_container_running "${container_name}"; then
echo Container found running without systemd unit, stopping it now.
podman container stop ${container_name}
podman container stop "${container_name}"
exit 0
else
echo Container ${container_name} is not running.
echo Container "${container_name}" is not running.
exit 1
fi

View File

@ -1,19 +1,19 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
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}
ensure_container_exists "${container_name}"
# FAIL if systemd unit does not exists
ensure_systemd_unit_exists ${service_name}
ensure_systemd_unit_exists "${service_name}"
# FAIL if systemd unit is running (stop it first)
ensure_systemd_unit_not_running ${service_name}
ensure_systemd_unit_not_running "${service_name}"
systemctl --user disable ${service_name}
systemctl --user disable "${service_name}"

View File

@ -1,24 +1,24 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
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}
ensure_container_exists "${container_name}"
# FAIL if container is running
ensure_container_not_running ${container_name}
ensure_container_not_running "${container_name}"
${ABSDIR}/70_disable.sh
"${ABSDIR}"/70_disable.sh
rm -f ${HOME}/.config/systemd/user/${service_name}
rm -f "${HOME}/.config/systemd/user/${service_name}"
systemctl --user daemon-reload
podman container rm ${container_name}
podman container rm "${container_name}"
for volume in ${nonpersistent_volumes}; do
podman volume rm ${volume}
podman volume rm "${volume}"
done

View File

@ -1,22 +1,22 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
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}
ensure_container_not_running "${container_name}"
# FAIL if container exists
ensure_container_not_exists ${container_name}
ensure_container_not_exists "${container_name}"
# FAIL if systemd unit exists
ensure_systemd_unit_not_exists ${service_name}
ensure_systemd_unit_not_exists "${service_name}"
# remove images
for image in ${upstream_images} ; do
podman image rm -f $(podman image list -a -q -- ${image}) || echo Image ${image} not found.
podman image rm -f "$(podman image list -a -q -- ${image})" || echo Image "${image}" not found.
done