Files
proxmox/scripts/deployment/fix-dev-vm-srv-projects-ownership.sh
defiQUG 4ebf2d7902
Some checks failed
Deploy to Phoenix / validate (push) Failing after 1s
Deploy to Phoenix / deploy (push) Has been skipped
Deploy to Phoenix / deploy-atomic-swap-dapp (push) Has been skipped
Deploy to Phoenix / cloudflare (push) Has been skipped
chore(repo): sync operator workspace (config, scripts, docs, multi-chain)
Add optional Cosmos/Engine-X/act-runner templates, CWUSDC/EI-matrix tooling,
non-EVM route planner in multi-chain-execution (tests passing), token list and
extraction updates, and documentation (MetaMask matrix, GRU/CWUSDC packets).

Ignore institutional evidence tarballs/sha256 under reports/status.

Validated with: bash scripts/verify/run-all-validation.sh --skip-genesis

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 16:25:08 -07:00

64 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Recursively chown /srv/projects inside Dev CT 5700 to the primary dev user.
# Use when rsync --delete-remote fails with Permission denied (root-owned files on VM).
#
# Requires: SSH as root to the Proxmox node that hosts VMID 5700 (default r630-04).
#
# Usage:
# ./scripts/deployment/fix-dev-vm-srv-projects-ownership.sh --dry-run
# ./scripts/deployment/fix-dev-vm-srv-projects-ownership.sh
#
# Env:
# DEV_VM_CTID — LXC ID (default 5700)
# DEV_VM_USER — owning user inside CT (default dev1)
# DEV_VM_PVE_HOST — override Proxmox node IP/hostname (default: get_host_for_vmid + R630_04 fallback)
# Do not use generic PROXMOX_HOST here; it may point at the wrong node.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
export PROJECT_ROOT
# shellcheck source=/dev/null
source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh" 2>/dev/null || true
DRY_RUN=0
while [[ $# -gt 0 ]]; do
case "$1" in
--dry-run) DRY_RUN=1; shift ;;
--help|-h)
sed -n '1,22p' "$0" | tail -n +2
exit 0
;;
*)
echo "ERROR: unknown argument: $1 (try --help)" >&2
exit 1
;;
esac
done
CTID="${DEV_VM_CTID:-5700}"
OWNER="${DEV_VM_USER:-dev1}"
if [[ -n "${DEV_VM_PVE_HOST:-}" ]]; then
NODE="$DEV_VM_PVE_HOST"
else
NODE="$(get_host_for_vmid "$CTID" 2>/dev/null || true)"
fi
NODE="${NODE:-${PROXMOX_HOST_R630_04:-192.168.11.14}}"
REMOTE_CMD="pct exec $CTID -- chown -R ${OWNER}:${OWNER} /srv/projects"
echo "=== Fix Dev VM /srv/projects ownership ==="
echo "Node: root@${NODE}"
echo "CT: $CTID"
echo "Owner: $OWNER"
echo ""
if [[ "$DRY_RUN" == "1" ]]; then
echo "DRY-RUN: ssh root@${NODE} \"$REMOTE_CMD\""
exit 0
fi
ssh -o BatchMode=yes -o ConnectTimeout=15 -o StrictHostKeyChecking=accept-new "root@${NODE}" "$REMOTE_CMD"
echo "Done."