From 02112440767ac28c65633a09108841852c761359 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Sun, 14 Jun 2026 15:54:44 +0000 Subject: [PATCH] fix(installer): auto-clone repo when running standalone from curl|bash --- install.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index adf9235..d1047d1 100755 --- a/install.sh +++ b/install.sh @@ -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