nextcloud-install/docker/uninstall.sh
2026-06-24 09:23:58 +03:00

31 lines
1.1 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${SCRIPT_DIR}"
# shellcheck source=../lib/common.sh
source "${SCRIPT_DIR}/../lib/common.sh"
drop_root_if_sudo "${SCRIPT_DIR}/uninstall.sh" "$@"
PURGE=false
[[ "${1:-}" == --purge ]] && PURGE=true
read -r -p "Удалить контейнеры? (yes/no): " c
[[ "${c}" == yes ]] || exit 0
if [[ "${PURGE}" == true ]]; then
run_compose down -v --remove-orphans
if [[ -f .env ]]; then
# shellcheck disable=SC1091
source .env
if [[ -n "${NEXTCLOUD_CONFIG_DIR:-}" && -d "${NEXTCLOUD_CONFIG_DIR}" ]]; then
backup_and_remove_config_php "${NEXTCLOUD_CONFIG_DIR}" "purge удалил БД volume"
rm -f "${NEXTCLOUD_CONFIG_DIR}/CAN_INSTALL" 2>/dev/null || sudo rm -f "${NEXTCLOUD_CONFIG_DIR}/CAN_INSTALL" 2>/dev/null || true
fix_config_permissions "${NEXTCLOUD_CONFIG_DIR}" || true
fi
fi
echo "[WARN] Данные на хосте НЕ удалены (см. пути в .env):"
echo " NEXTCLOUD_CONFIG_DIR, NEXTCLOUD_DATADIR, APPDATA, CUSTOM_APPS, BACKUP_DIR"
else
run_compose down --remove-orphans
fi
echo "[INFO] Готово."