Update docs, configs, and scripts
Co-Authored-By: Oz <oz-agent@warp.dev>
This commit is contained in:
@ -7,13 +7,22 @@ REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||
PURGE=0
|
||||
|
||||
log() {
|
||||
printf '[uninstall] %s
|
||||
' "$*"
|
||||
printf '[uninstall] %s\n' "$*"
|
||||
}
|
||||
|
||||
err() {
|
||||
printf '[uninstall][error] %s
|
||||
' "$*" >&2
|
||||
printf '[uninstall][error] %s\n' "$*" >&2
|
||||
}
|
||||
|
||||
load_env_file() {
|
||||
if [[ ! -f "${ENV_FILE}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
set -a
|
||||
# shellcheck disable=SC1090
|
||||
source "${ENV_FILE}"
|
||||
set +a
|
||||
}
|
||||
|
||||
usage() {
|
||||
@ -53,6 +62,7 @@ ENV_FILE="${REPO_ROOT}/.env"
|
||||
if [[ ! -f "${ENV_FILE}" ]]; then
|
||||
ENV_FILE="${REPO_ROOT}/.env.example"
|
||||
fi
|
||||
load_env_file
|
||||
|
||||
log "Stopping stack and removing containers, networks, and named/anonymous volumes."
|
||||
docker compose -f "${REPO_ROOT}/docker-compose.yml" --env-file "${ENV_FILE}" down -v || true
|
||||
@ -60,22 +70,20 @@ docker compose -f "${REPO_ROOT}/docker-compose.yml" --env-file "${ENV_FILE}" dow
|
||||
if [[ ${PURGE} -eq 1 ]]; then
|
||||
log "Purge requested. Removing local data directories used by this stack."
|
||||
|
||||
huggingface_cache_dir="$(grep -E '^HUGGINGFACE_CACHE_DIR=' "${ENV_FILE}" | tail -n1 | cut -d'=' -f2- || true)"
|
||||
open_webui_data_dir="$(grep -E '^OPEN_WEBUI_DATA_DIR=' "${ENV_FILE}" | tail -n1 | cut -d'=' -f2- || true)"
|
||||
huggingface_cache_dir="${HUGGINGFACE_CACHE_DIR:-}"
|
||||
open_webui_data_dir="${OPEN_WEBUI_DATA_DIR:-./frontend/data/open-webui}"
|
||||
|
||||
if [[ -n "${huggingface_cache_dir}" ]]; then
|
||||
# Expand potential variables such as ${USER}
|
||||
evaluated_hf_dir="$(eval "printf '%s' "${huggingface_cache_dir}"")"
|
||||
if [[ -d "${evaluated_hf_dir}" ]]; then
|
||||
log "Removing Hugging Face cache directory: ${evaluated_hf_dir}"
|
||||
rm -rf "${evaluated_hf_dir}"
|
||||
else
|
||||
log "Hugging Face cache directory not found: ${evaluated_hf_dir}"
|
||||
if [[ "${huggingface_cache_dir}" == ./* ]]; then
|
||||
huggingface_cache_dir="${REPO_ROOT}/${huggingface_cache_dir#./}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "${open_webui_data_dir}" ]]; then
|
||||
open_webui_data_dir="./frontend/data/open-webui"
|
||||
if [[ -d "${huggingface_cache_dir}" ]]; then
|
||||
log "Removing Hugging Face cache directory: ${huggingface_cache_dir}"
|
||||
rm -rf "${huggingface_cache_dir}"
|
||||
else
|
||||
log "Hugging Face cache directory not found: ${huggingface_cache_dir}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${open_webui_data_dir}" == ./* ]]; then
|
||||
|
||||
Reference in New Issue
Block a user