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.
This commit is contained in:
pyr0ball 2026-02-26 20:51:34 -08:00
parent a8bee0dc0c
commit 9719de5c43
2 changed files with 25 additions and 2 deletions

View file

@ -66,6 +66,13 @@ done
SERVICE="${1:-app}" # used by `logs` command 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 ───────────────────────────────────────────────────────────────── # ── Commands ─────────────────────────────────────────────────────────────────
case "$CMD" in case "$CMD" in

View file

@ -49,6 +49,21 @@ SUDO="$(need_sudo)"
cmd_exists() { command -v "$1" &>/dev/null; } 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 ──────────────────────────────────────────────────────────────────────── # ── Git ────────────────────────────────────────────────────────────────────────
install_git() { install_git() {
if cmd_exists git; then success "git already installed: $(git --version)"; return; fi if cmd_exists git; then success "git already installed: $(git --version)"; return; fi
@ -300,6 +315,7 @@ main() {
echo -e "${BLUE}╚══════════════════════════════════════════════════════╝${NC}" echo -e "${BLUE}╚══════════════════════════════════════════════════════╝${NC}"
echo "" echo ""
install_build_tools
install_git install_git
# Podman takes precedence if already installed; otherwise install Docker # Podman takes precedence if already installed; otherwise install Docker
if ! check_podman; then if ! check_podman; then
@ -316,8 +332,8 @@ main() {
echo "" echo ""
echo -e " ${GREEN}Next steps:${NC}" echo -e " ${GREEN}Next steps:${NC}"
echo -e " 1. Start Peregrine:" echo -e " 1. Start Peregrine:"
echo -e " ${YELLOW}make start${NC} # remote/API-only (no local GPU)" echo -e " ${YELLOW}./manage.sh 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 --profile cpu${NC} # local Ollama inference (CPU)"
echo -e " 2. Open ${YELLOW}http://localhost:8501${NC} — the setup wizard will guide you" 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 -e " (Tip: edit ${YELLOW}.env${NC} any time to adjust ports or model paths)"
echo "" echo ""