initial commit: wirecon WireGuard stack
Rootless-Docker server (wireguard-go + Caddy sharing netns) and unprivileged-LXC client (kernel WG + systemd watchdog/monitor/MTU-probe) with curl-pipeable bootstrap. Tuned for Telekom DSL/LTE Hybrid uplinks.
This commit is contained in:
commit
49b01dfcd3
19 files changed
+770
No files matched your search
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/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; then
|
||||
log "installing git"
|
||||
if command -v apt-get >/dev/null; then
|
||||
DEBIAN_FRONTEND=noninteractive apt-get update -q
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -yq git ca-certificates
|
||||
elif command -v dnf >/dev/null; then
|
||||
dnf install -y git ca-certificates
|
||||
else
|
||||
echo "unsupported distro: need 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
|
||||
Reference in new issue
Block a user