Files
Florian Schmidt 399628bf16 feat(deploy): one-step install/update from the Proxmox host (#6)
bootstrap.sh runs on the Proxmox host via
  bash -c "$(curl -fsSL .../deploy/proxmox/bootstrap.sh)"
It unpacks the repository into a temporary directory, runs
create-ct.sh and removes everything again; create-ct.sh also removes
the installer files it pushed into the CT. Nothing stays on the host.

install.sh now installs or updates: an existing checkout is pulled
(fast-forward, SHELLBOOK_REF pins are kept), the service is restarted
and health-checked, and the summary prints the address, the one-time
setup token while setup is pending, the Claude login state and the
SSH public key.

It also installs a root-owned `shellbook-update` that downloads the
installer from the repository and reruns it. Root never executes
scripts from /opt/shellbook, which the service user and its terminal
panel can modify, so deploy/update.sh is removed.

Verified in a Debian 13 container: fresh install, then an update that
pulls a new commit while a tampered checkout script is not executed;
bootstrap.test.sh checks that host and CT keep no installer files.
2026-11-16 10:57:42 +01:00

16 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Install or update ShellBook in a Proxmox CT in one step, leaving nothing on the host.
# Run on the Proxmox host as root:
# bash -c "$(curl -fsSL https://git.finalfactory.de/FinalFactory/ShellBook/raw/branch/main/deploy/proxmox/bootstrap.sh)"
# Accepts the overrides of create-ct.sh (CTID, CT_*, SHELLBOOK_*, TS_AUTHKEY).
# The repository is unpacked into a temporary directory that is always removed.
set -euo pipefail
[[ $EUID == 0 ]] && command -v pct >/dev/null || { echo 'Run on the Proxmox host as root' >&2; exit 1; }
archive=${SHELLBOOK_ARCHIVE_URL:-https://git.finalfactory.de/FinalFactory/ShellBook/archive/${SHELLBOOK_REF:-main}.tar.gz}
work=$(mktemp -d)
trap 'rm -rf -- "$work"' EXIT
curl -fsSL "$archive" | tar -xz -C "$work" --strip-components=1 --no-same-owner
[[ -f $work/deploy/proxmox/create-ct.sh ]] || { echo "No ShellBook deploy scripts in $archive" >&2; exit 1; }
# stdin stays away from pct exec: callers may pipe this script into bash.
bash "$work/deploy/proxmox/create-ct.sh" </dev/null