Seafile : work in progress
This commit is contained in:
parent
6d7b76f8d5
commit
d4a966927e
19
podman-seafile/00_status.sh
Executable file
19
podman-seafile/00_status.sh
Executable file
|
@ -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
|
||||||
|
|
||||||
|
echo "Podman images status..."
|
||||||
|
for image in ${upstream_images} ; do
|
||||||
|
podman images ${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.
|
||||||
|
echo
|
||||||
|
echo "Checking systemd unit status..."
|
||||||
|
systemctl --user status ${service_name}
|
|
@ -1,5 +1,19 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
podman generate systemd --files --name podman-seafile
|
|
||||||
mkdir -p ~/.config/systemd/user/
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
||||||
cp *.service ~/.config/systemd/user/
|
source ${ABSDIR}/../functions.sh
|
||||||
systemctl --user enable pod-podman-seafile.service
|
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}
|
||||||
|
|
24
podman-seafile/30_start.sh
Executable file
24
podman-seafile/30_start.sh
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/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 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 pod is already running - without systemd control.
|
||||||
|
ensure_pod_not_running ${pod_name}
|
||||||
|
|
||||||
|
# OK
|
||||||
|
echo "Starting pod through systemd"
|
||||||
|
systemctl --user start ${service_name}
|
28
podman-seafile/40_stop.sh
Executable file
28
podman-seafile/40_stop.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/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}
|
||||||
|
|
||||||
|
# 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_pod_running ${pod_name}; then
|
||||||
|
echo Pod found running without systemd unit, stopping it now.
|
||||||
|
podman pod stop ${pod_name}
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo Pod ${pod_name} is not running.
|
||||||
|
exit 1
|
||||||
|
fi
|
19
podman-seafile/70_disable.sh
Executable file
19
podman-seafile/70_disable.sh
Executable file
|
@ -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
|
||||||
|
|
||||||
|
# FAIL if pod does not exists
|
||||||
|
ensure_pod_exists ${pod_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-seafile/80_destroy.sh
Executable file
20
podman-seafile/80_destroy.sh
Executable file
|
@ -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}
|
22
podman-seafile/90_prune.sh
Executable file
22
podman-seafile/90_prune.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/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 is running
|
||||||
|
ensure_pod_not_running ${pod_name}
|
||||||
|
|
||||||
|
# FAIL if pod exists
|
||||||
|
ensure_pod_not_exists ${pod_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
|
6
podman-seafile/vars.sh
Normal file
6
podman-seafile/vars.sh
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
pod_name='podman-seafile'
|
||||||
|
service_name="pod-${pod_name}.service"
|
||||||
|
upstream_images="docker.io/seafileltd/seafile-mc docker.io/library/mariadb"
|
||||||
|
version='8.0.8'
|
Loading…
Reference in a new issue