Add update script for Proxmox LXC containers
Adds scripts/proxmox/update-linkvault.sh to pull the latest git changes, refresh dependencies, and restart the systemd service on an existing container. Documents usage in the README. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
46
scripts/proxmox/update-linkvault.sh
Executable file
46
scripts/proxmox/update-linkvault.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# LinkVault – Update-Script für einen bestehenden Proxmox-LXC-Container
|
||||
#
|
||||
# Muss als root auf dem Proxmox-VE-Host ausgeführt werden. Zieht den
|
||||
# neuesten Stand aus Git, aktualisiert die Python-Abhängigkeiten und
|
||||
# startet den systemd-Service neu.
|
||||
#
|
||||
# Verwendung (auf dem Proxmox-Host):
|
||||
# CTID=113 bash update-linkvault.sh
|
||||
#
|
||||
# Bei privatem Repo zusätzlich das Gitea Access Token setzen:
|
||||
# CTID=113 GIT_TOKEN=<token> bash update-linkvault.sh
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
CTID="${CTID:-}"
|
||||
GIT_TOKEN="${GIT_TOKEN:-}"
|
||||
|
||||
if ! command -v pct &>/dev/null; then
|
||||
echo "Fehler: 'pct' nicht gefunden – dieses Script muss auf einem Proxmox-VE-Host laufen." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$CTID" ]; then
|
||||
echo "Fehler: CTID muss gesetzt sein, z.B. 'CTID=113 bash update-linkvault.sh'." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "==> Aktualisiere LinkVault in Container $CTID..."
|
||||
pct exec "$CTID" -- bash -c "
|
||||
set -euo pipefail
|
||||
cd /opt/linkvault
|
||||
|
||||
if [ -n '${GIT_TOKEN}' ]; then
|
||||
git -c http.extraHeader=\"Authorization: token ${GIT_TOKEN}\" pull --ff-only
|
||||
else
|
||||
git pull --ff-only
|
||||
fi
|
||||
|
||||
.venv/bin/pip install -q -r requirements.txt
|
||||
systemctl restart linkvault
|
||||
"
|
||||
|
||||
echo "==> Fertig. Status:"
|
||||
pct exec "$CTID" -- systemctl --no-pager status linkvault
|
||||
Reference in New Issue
Block a user