Initial commit

This commit is contained in:
2026-01-09 17:12:49 +01:00
commit b78762155f
4 changed files with 288 additions and 0 deletions

91
install.sh Executable file
View File

@@ -0,0 +1,91 @@
#!/usr/bin/env bash
set -Eeuo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$SCRIPT_DIR/libsupabase.sh"
setup_traps
########################################
# Defaults
########################################
cores=2
memory=4096
swap=512
disk=50
bridge="vmbr0"
storage="local-zfs"
ip="dhcp"
unpriv=1
ctid=""
########################################
# Args
########################################
while [[ $# -gt 0 ]]; do
case "$1" in
--cores) cores="$2"; shift 2 ;;
--memory) memory="$2"; shift 2 ;;
--swap) swap="$2"; shift 2 ;;
--disk) disk="$2"; shift 2 ;;
--bridge) bridge="$2"; shift 2 ;;
--storage) storage="$2"; shift 2 ;;
--ip) ip="$2"; shift 2 ;;
--ctid) ctid="$2"; shift 2 ;;
--help)
echo "Usage: bash install.sh [options]"
exit 0
;;
*)
die "Unknown argument: $1"
;;
esac
done
info "Argument-Parsing OK"
########################################
# Checks
########################################
need_cmd pct pvesm pveam pvesh awk grep sort
pve_bridge_exists "$bridge" || die "Bridge $bridge not found"
pve_storage_exists "$storage" || die "Storage $storage not found"
template="$(pve_template_ensure_debian12 "$storage")"
info "Template OK: $template"
if [[ -z "$ctid" ]]; then
ctid="$(pve_next_free_ctid)"
fi
[[ -n "$ctid" ]] || die "CTID empty"
hostname="sb-$(date +%s)"
info "Using CTID=$ctid Hostname=$hostname"
########################################
# Create CT
########################################
net0="$(pve_build_net0 "$bridge" "$ip")"
rootfs="$storage:$disk"
features="nesting=1,keyctl=1,fuse=1"
info "Creating CT $ctid"
pct create "$ctid" "$template" \
--hostname "$hostname" \
--cores "$cores" \
--memory "$memory" \
--swap "$swap" \
--net0 "$net0" \
--rootfs "$rootfs" \
--unprivileged "$unpriv" \
--features "$features" \
--start 0
info "CT created successfully"