diff --git a/update.sh b/update.sh index 13fd96f..bedb8fc 100755 --- a/update.sh +++ b/update.sh @@ -39,29 +39,58 @@ if [[ -f "$SELF" ]] && command -v curl >/dev/null; then && info "Script aktualisiert" || rm -f "$SELF.new" fi -# ── Voraussetzungen prüfen ──────────────────────────────────────────────── +# ── Go: Version sicherstellen (OS-versions-agnostisch) ─────────────────── +# Go wird unter /usr/local/go installiert — unabhängig von apt und Debian-Version. +# Das gilt nach einem OS-Upgrade auf Debian 14+ genauso wie auf trixie. -# Debian legt go nicht immer in /usr/bin — bekannte Pfade ergänzen -export PATH="$PATH:/usr/local/go/bin:/usr/lib/go/bin" -for d in /usr/lib/go-*/bin; do export PATH="$PATH:$d"; done +GO_REQUIRED="1.24.4" +export PATH="$PATH:/usr/local/go/bin" -command -v git >/dev/null || die "git nicht gefunden" -command -v node >/dev/null || die "node nicht gefunden" -command -v npm >/dev/null || die "npm nicht gefunden" -command -v go >/dev/null || die "go nicht gefunden — apt-get install golang-go" +_go_ok=0 +if command -v go >/dev/null 2>&1; then + _go_installed=$(go version 2>/dev/null | grep -oP 'go\K[0-9]+\.[0-9]+' | head -1) + _go_major=${_go_installed%%.*} + _go_minor=${_go_installed#*.} + # >= 1.24 gilt als ausreichend + if [[ "$_go_major" -gt 1 ]] || [[ "$_go_major" -eq 1 && "$_go_minor" -ge 24 ]]; then + _go_ok=1 + fi +fi + +if [[ $_go_ok -eq 0 ]]; then + info "Go < 1.24 oder nicht gefunden — installiere Go ${GO_REQUIRED} von upstream..." + _go_arch="amd64" + [[ "$(uname -m)" == "aarch64" ]] && _go_arch="arm64" + curl -fsSL "https://dl.google.com/go/go${GO_REQUIRED}.linux-${_go_arch}.tar.gz" \ + | tar -C /usr/local -xz + ln -sf /usr/local/go/bin/go /usr/local/bin/go + ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt + log "Go $(go version | awk '{print $3}') installiert" +else + log "Go $(go version | awk '{print $3}') OK" +fi + +# ── Sonstige Voraussetzungen ────────────────────────────────────────────── + +command -v git >/dev/null || die "git nicht gefunden — apt-get install git" +command -v node >/dev/null || die "node nicht gefunden — apt-get install nodejs" +command -v npm >/dev/null || die "npm nicht gefunden — apt-get install npm" # ── Manticore Search prüfen / installieren ──────────────────────────────── +# Paket ist an bookworm gebunden — funktioniert auch auf trixie und Debian 14+, +# da Manticore kein OS-spezifisches ABI nutzt. if ! command -v searchd >/dev/null 2>&1 && ! systemctl is-active --quiet manticore 2>/dev/null; then info "Manticore Search nicht gefunden — installiere..." - # bookworm-Paket auf trixie verwenden (kein natives trixie-Paket verfügbar) + _mc_arch="amd64" + [[ "$(uname -m)" == "aarch64" ]] && _mc_arch="arm64" wget -q -O /tmp/manticore.deb \ - "https://repo.manticoresearch.com/repository/manticoresearch_bookworm/pool/main/m/manticoresearch/manticoresearch_6.3.6_amd64.deb" 2>/dev/null \ + "https://repo.manticoresearch.com/repository/manticoresearch_bookworm/pool/main/m/manticoresearch/manticoresearch_6.3.6_${_mc_arch}.deb" 2>/dev/null \ || wget -q -O /tmp/manticore.deb \ - "https://github.com/manticoresoftware/manticoresearch/releases/download/6.3.6/manticoresearch_6.3.6.202408011246.4c39781ba-1+bookworm_amd64.deb" 2>/dev/null \ + "https://github.com/manticoresoftware/manticoresearch/releases/download/6.3.6/manticoresearch_6.3.6.202408011246.4c39781ba-1+bookworm_${_mc_arch}.deb" 2>/dev/null \ || true if [[ -f /tmp/manticore.deb ]]; then - dpkg -i /tmp/manticore.deb 2>/dev/null || apt-get install -f -y 2>/dev/null || true + dpkg -i /tmp/manticore.deb 2>/dev/null || apt-get install -f -y -qq 2>/dev/null || true rm -f /tmp/manticore.deb log "Manticore Search installiert" else