Files
d4nn13 5b9abdae08 port LXC side to Alpine/OpenRC, add Proxmox host-side creator
- Replace systemd units with OpenRC init scripts (supervise-daemon)
- Add wirecon-watchdog-loop.sh since OpenRC has no timers
- Switch install.sh to apk + rc-update
- Update bootstrap.sh to install git/bash via apk
- New proxmox/create-lxc.sh: picks next VMID, downloads Alpine template,
  creates unprivileged LXC with tun passthrough, chains bootstrap
- Rewrite README around the Proxmox one-liner flow
2026-04-19 18:40:55 +02:00

59 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Bootstrap the wirecon LXC side from a fresh unprivileged LXC.
#
# One-liner:
# curl -fsSL https://git.d4nn13.de/d4nn13/wirecon/raw/branch/main/lxc/bootstrap.sh | sudo bash
# or with a specific ref / fork:
# curl -fsSL .../bootstrap.sh | sudo WIRECON_REPO=https://git.d4nn13.de/me/wirecon.git WIRECON_REF=main bash
#
# What it does:
# 1. installs git if missing
# 2. clones (or fast-forwards) the repo into /opt/wirecon
# 3. runs lxc/install.sh from that checkout
set -euo pipefail
REPO="${WIRECON_REPO:-https://git.d4nn13.de/d4nn13/wirecon.git}"
REF="${WIRECON_REF:-main}"
DEST="${WIRECON_DEST:-/opt/wirecon}"
log() { printf '[bootstrap] %s\n' "$*"; }
if [[ $EUID -ne 0 ]]; then
echo "must run as root (sudo)" >&2
exit 1
fi
# --- prereqs ---------------------------------------------------------------
if ! command -v git >/dev/null || ! command -v bash >/dev/null; then
log "installing git + bash"
if command -v apk >/dev/null; then
apk add --no-cache git bash ca-certificates
elif command -v apt-get >/dev/null; then
DEBIAN_FRONTEND=noninteractive apt-get update -q
DEBIAN_FRONTEND=noninteractive apt-get install -yq git bash ca-certificates
elif command -v dnf >/dev/null; then
dnf install -y git bash ca-certificates
else
echo "unsupported distro: need apk, apt-get, or dnf" >&2
exit 1
fi
fi
# --- clone or update -------------------------------------------------------
if [[ -d "$DEST/.git" ]]; then
log "updating existing checkout at $DEST"
git -C "$DEST" fetch --depth 1 origin "$REF"
git -C "$DEST" checkout -f "$REF"
git -C "$DEST" reset --hard "origin/$REF"
else
log "cloning $REPO@$REF → $DEST"
install -d -m 0755 "$(dirname "$DEST")"
git clone --depth 1 --branch "$REF" "$REPO" "$DEST"
fi
# --- run installer ---------------------------------------------------------
log "running lxc/install.sh"
cd "$DEST"
exec bash lxc/install.sh