#!/bin/sh
# Upgrade (DSM runs this BEFORE replacing the package files):
# stop the running containers so the switch to the new image is clean.
# postupgrade recreates them with the saved port/secrets.
# Self-contained: the new package files may not be in place yet.
set -e
DOCKER="${SYNOPKG_PKGDEST}/tool/kv-helper"
if [ -x "${DOCKER}" ]; then
    for c in kvtube-ui kvtube-invidious kvtube-companion kvtube-db; do
        "${DOCKER}" stop "$c" >/dev/null 2>&1 || true
    done
fi
exit 0