From 9719de5c436dabfad8772af3622b28e43d740e85 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Thu, 26 Feb 2026 20:51:34 -0800 Subject: [PATCH] fix: install make in setup.sh; guard manage.sh against missing make setup.sh now installs make (via apt/dnf/pacman/brew) before git and Docker so that manage.sh commands work out of the box on minimal server installs. manage.sh adds a preflight guard that catches a missing make early and redirects the user to ./manage.sh setup. Also fixes the post-setup next-steps hint to use ./manage.sh instead of bare make. --- manage.sh | 7 +++++++ setup.sh | 20 ++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/manage.sh b/manage.sh index 57665a0..1d2ee5e 100755 --- a/manage.sh +++ b/manage.sh @@ -66,6 +66,13 @@ done SERVICE="${1:-app}" # used by `logs` command +# ── Dependency guard ────────────────────────────────────────────────────────── +# Commands that delegate to make; others (status, logs, update, open, setup) run fine without it. +_MAKE_CMDS="start stop restart preflight test prepare-training finetune clean" +if [[ " $_MAKE_CMDS " == *" $CMD "* ]] && ! command -v make &>/dev/null; then + error "'make' is not installed. Run: ./manage.sh setup then retry: ./manage.sh ${CMD}" +fi + # ── Commands ───────────────────────────────────────────────────────────────── case "$CMD" in diff --git a/setup.sh b/setup.sh index 9316355..0adcd1d 100755 --- a/setup.sh +++ b/setup.sh @@ -49,6 +49,21 @@ SUDO="$(need_sudo)" cmd_exists() { command -v "$1" &>/dev/null; } +# ── Build tools (make, etc.) ─────────────────────────────────────────────────── +install_build_tools() { + if cmd_exists make; then success "make already installed: $(make --version | head -1)"; return; fi + info "Installing build tools (make)…" + case "$DISTRO_FAMILY" in + debian) $SUDO apt-get update -q && $SUDO apt-get install -y make ;; + fedora) $SUDO dnf install -y make ;; + arch) $SUDO pacman -Sy --noconfirm make ;; + macos) + if cmd_exists brew; then brew install make + else error "Homebrew not found. Install it from https://brew.sh then re-run this script."; fi ;; + esac + success "make installed." +} + # ── Git ──────────────────────────────────────────────────────────────────────── install_git() { if cmd_exists git; then success "git already installed: $(git --version)"; return; fi @@ -300,6 +315,7 @@ main() { echo -e "${BLUE}╚══════════════════════════════════════════════════════╝${NC}" echo "" + install_build_tools install_git # Podman takes precedence if already installed; otherwise install Docker if ! check_podman; then @@ -316,8 +332,8 @@ main() { echo "" echo -e " ${GREEN}Next steps:${NC}" echo -e " 1. Start Peregrine:" - echo -e " ${YELLOW}make start${NC} # remote/API-only (no local GPU)" - echo -e " ${YELLOW}make start PROFILE=cpu${NC} # local Ollama inference (CPU)" + echo -e " ${YELLOW}./manage.sh start${NC} # remote/API-only (no local GPU)" + echo -e " ${YELLOW}./manage.sh start --profile cpu${NC} # local Ollama inference (CPU)" echo -e " 2. Open ${YELLOW}http://localhost:8501${NC} — the setup wizard will guide you" echo -e " (Tip: edit ${YELLOW}.env${NC} any time to adjust ports or model paths)" echo ""