mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-30 07:20:09 +00:00
Agent-Logs-Url: https://github.com/nextcloud/all-in-one/sessions/cd05ca56-d0e8-4260-988b-a7cc0747beff Co-authored-by: szaimen <42591237+szaimen@users.noreply.github.com>
32 lines
1.1 KiB
Bash
32 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
# Check if socket is available and readable
|
|
if ! [ -e "/var/run/docker.sock" ]; then
|
|
echo "Docker socket is not available. Cannot continue."
|
|
exit 1
|
|
elif ! test -r /var/run/docker.sock; then
|
|
echo "Docker socket is not readable by the root user. Cannot continue."
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f /run/.containerenv ]; then
|
|
# If running under podman disable memory_swappiness setting in watchtower.
|
|
# It is a necessary workaround until https://github.com/containers/podman/issues/23824 gets fixed.
|
|
echo "Running under Podman. Setting WATCHTOWER_DISABLE_MEMORY_SWAPPINESS to 1."
|
|
export WATCHTOWER_DISABLE_MEMORY_SWAPPINESS=1
|
|
fi
|
|
|
|
if [ -n "$CONTAINER_TO_UPDATE" ]; then
|
|
# Map AIO_LOG_LEVEL to watchtower log level (watchtower uses 'warn' not 'warning')
|
|
case "${AIO_LOG_LEVEL:-warning}" in
|
|
warning) WATCHTOWER_LOG_LEVEL="warn" ;;
|
|
*) WATCHTOWER_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}" ;;
|
|
esac
|
|
exec /watchtower --cleanup --log-level "$WATCHTOWER_LOG_LEVEL" --run-once "$CONTAINER_TO_UPDATE"
|
|
else
|
|
echo "'CONTAINER_TO_UPDATE' is not set. Cannot update anything."
|
|
exit 1
|
|
fi
|
|
|
|
exec "$@"
|