Files
nexus/scripts/deploy-srv04.sh
2026-11-09 17:41:32 +01:00

23 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Baut das musl-Binary und legt es mit dem Installationsskript auf srv04 ab.
# Es verändert auf srv04 nur den Ordner /tmp/nexus-deploy (als Benutzer stephan).
# Die eigentliche Installation (root) startest du danach selbst:
# ssh -t srv04 'sudo VERSION=<version> bash /tmp/nexus-deploy/install.sh'
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
HOST="${HOST:-srv04}"
cargo build --release --target x86_64-unknown-linux-musl -p nexus
BIN=target/x86_64-unknown-linux-musl/release/nexus
VERSION="$("$BIN" version | awk '{print $2}')"
echo "Gebaut: nexus $VERSION ($(stat -c %s "$BIN") Bytes, $(file -b "$BIN" | cut -d, -f1-2,5 | cut -c1-60))"
ssh -o BatchMode=yes "$HOST" 'mkdir -p /tmp/nexus-deploy'
scp -q "$BIN" "$HOST:/tmp/nexus-deploy/nexus"
scp -q scripts/srv04-install.sh "$HOST:/tmp/nexus-deploy/install.sh"
# Läuft das statische Binary dort überhaupt? (Nur Version anzeigen, ändert nichts.)
ssh -o BatchMode=yes "$HOST" 'chmod +x /tmp/nexus-deploy/nexus && /tmp/nexus-deploy/nexus version'
echo
echo "Abgelegt unter $HOST:/tmp/nexus-deploy. Zum Installieren (braucht dein sudo-Passwort):"
echo " ssh -t $HOST 'sudo VERSION=$VERSION bash /tmp/nexus-deploy/install.sh'"