#!/usr/bin/env bash # Maintainer helper. Not part of the community-scripts tree under deploy/. # # If bash reports "$'\r': command not found" or "set: pipefail: invalid option", the file has # CRLF line endings. Fix (use the real path to this file — not $0 from an interactive shell): # sed -i 's/\r$//' /tmp/run-metervault-ct-install.sh && bash /tmp/run-metervault-ct-install.sh # # Run this **inside** an existing Debian LXC (not on the Proxmox host). It exports the same # METERVAULT_* variables that deploy/ct/metervault.sh passes via pct exec, then runs the official # install script from the public Gitea repo. # # Optional overrides file: export METERVAULT_INSTALL_ENV=/root/metervault-install.env set -euo pipefail [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]] && { echo "Usage: $0 (run as root inside the LXC)"; exit 0; } [[ "$(id -u)" -eq 0 ]] || { echo "error: run as root inside the container" >&2; exit 1; } rand_hex() { openssl rand -hex 16 2>/dev/null || head -c 16 /dev/urandom | xxd -p; } METERVAULT_DEPLOY_BASE="${METERVAULT_DEPLOY_BASE:-https://git.finalfactory.de/FinalFactory/MeterVault/raw/branch/master/deploy}" METERVAULT_INSTALL_URL="${METERVAULT_INSTALL_URL:-${METERVAULT_DEPLOY_BASE}/install/metervault-install.sh}" [[ -n "${METERVAULT_INSTALL_ENV:-}" && -f "${METERVAULT_INSTALL_ENV}" ]] && { set -a; # shellcheck source=/dev/null source "${METERVAULT_INSTALL_ENV}"; set +a; } export CONTAINER_INSTALLING="${CONTAINER_INSTALLING:-true}" export METERVAULT_CT_URL="${METERVAULT_CT_URL:-${METERVAULT_DEPLOY_BASE}/ct/metervault.sh}" export METERVAULT_PORT="${METERVAULT_PORT:-8760}" export METERVAULT_TIMEZONE="${METERVAULT_TIMEZONE:-Europe/Berlin}" export METERVAULT_SEED="${METERVAULT_SEED:-false}" if [[ -z "${METERVAULT_DB_PASSWORD:-}" ]]; then METERVAULT_DB_PASSWORD="$(rand_hex)" echo "Generated METERVAULT_DB_PASSWORD: ${METERVAULT_DB_PASSWORD}" fi export METERVAULT_DB_PASSWORD echo "METERVAULT_INSTALL_URL=${METERVAULT_INSTALL_URL} PORT=${METERVAULT_PORT} SEED=${METERVAULT_SEED}" exec bash -c "$(curl -fsSL "$METERVAULT_INSTALL_URL")"