fix(installer): auto-clone repo when running standalone from curl|bash

This commit is contained in:
Claus Lohmar 2026-06-14 15:54:44 +00:00
parent 631780cdf6
commit 0211244076

View file

@ -46,6 +46,24 @@ NEXTWKS_URL_DEFAULT="https://wks.lohmar.co.uk"
AUTH_URL_DEFAULT="https://auth.lohmar.co.uk"
PROXY_IP_DEFAULT="172.16.0.10"
# ============================================================
# AUTO-CLONE: if running standalone (not from repo), clone first
# ============================================================
REPO_URL="https://git.lohmar.co.uk/lexton-it/NextWks.git"
if [ ! -f "$REPO_DIR/src/main.go" ]; then
info "Cloning NextWks repository..."
if ! command -v git &>/dev/null; then
error "git is required. Install it first: apt install git"
exit 1
fi
CLONE_DIR="/tmp/nextwks-install"
rm -rf "$CLONE_DIR" 2>/dev/null
git clone --depth 1 "$REPO_URL" "$CLONE_DIR"
REPO_DIR="$CLONE_DIR"
success "Cloned to $REPO_DIR"
fi
# ============================================================
# PARSE FLAGS
# ============================================================
@ -57,7 +75,7 @@ for arg in "$@"; do
--status) MODE="status" ;;
--uninstall) MODE="uninstall" ;;
--help)
head -20 "$0" | grep "^#" | sed 's/^# //; 1s/.*/NextWks Installer v2026.6.0001/'
head -20 "$0" | grep "^#" | sed 's/^# //; 1s/.*/NextWks Installer/'
exit 0 ;;
*) error "Unknown: $arg (use --help)"; exit 1 ;;
esac