#!/bin/bash # lxc-background-package-install.sh # Run inside a Proxmox LXC container for long-running installs without # hanging the caller or hitting `pct exec` timeouts. # # Usage (from Proxmox host): # pct exec -- bash -c 'cat > /tmp/bg_install.sh; chmod +x /tmp/bg_install.sh; nohup /tmp/bg_install.sh &' # (paste this script via heredoc or copy with scp) # # Poll progress: # pct exec -- tail -20 /tmp/bg_install.log # pct exec -- cat /tmp/bg_install.done 2>/dev/null && echo "COMPLETE" LOG="/tmp/lxc_bg_install.log" DONE="/tmp/lxc_bg_install.done" exec >"$LOG" 2>&1 set -x # --- 1. Optional: ROCm userspace (if not yet installed) --- # amdgpu-install --usecase=rocm --no-dkms -y # --- 2. Optional: PyTorch ROCm --- # pip install torch torchvision torchaudio \ # --index-url https://download.pytorch.org/whl/rocm6.2 \ # --break-system-packages # --- 3. Application dependencies (e.g. ComfyUI) --- # cd /opt/ComfyUI || exit 1 # pip install -r requirements.txt --break-system-packages # --- 4. Prevent Debian system packages blocking pip --- # If pip fails with "Cannot uninstall X, RECORD file not found", # remove the conflicting deb package first: # dpkg --remove --force-depends python3-rich # --- Mark completion --- echo "DONE" > "$DONE"