This commit is contained in:
Christoph K.
2026-03-20 07:08:00 +01:00
parent 8163f906cc
commit b1a576f61e
9 changed files with 851 additions and 17 deletions

View File

@@ -35,9 +35,9 @@ scp_cmd() {
sshpass -p "$DEPLOY_PASS" scp $SSH_OPTS "$@"
}
# sudo ohne TTY: Passwort per stdin mit -S
# sudo ohne TTY: Passwort per stdin (-S), -p '' unterdrückt den Prompt auf stderr
sudo_cmd() {
ssh_cmd "echo '${SUDO_PASS}' | sudo -S $*"
ssh_cmd "echo '${SUDO_PASS}' | sudo -S -p '' $*"
}
# ── Build ────────────────────────────────────────────────────────────────────
@@ -47,11 +47,18 @@ echo "✅ Binary gebaut"
# ── Dateien übertragen ───────────────────────────────────────────────────────
echo "📁 Zielverzeichnis ${DEPLOY_DIR} auf ${DEPLOY_HOST}..."
ssh_cmd "mkdir -p '${DEPLOY_DIR}'"
if ! ssh_cmd "mkdir -p ${DEPLOY_DIR}"; then
echo "❌ Verzeichnis konnte nicht erstellt werden prüfe Rechte auf ${DEPLOY_HOST}"
exit 1
fi
echo "🚀 Übertrage Binary..."
scp_cmd bin/discord-linux "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_DIR}/discord"
ssh_cmd "chmod +x '${DEPLOY_DIR}/discord'"
# Als temporäre Datei hochladen, dann atomar ersetzen (laufendes Binary kann nicht überschrieben werden)
if ! scp_cmd bin/discord-linux "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_DIR}/discord.new"; then
echo "❌ SCP fehlgeschlagen"
exit 1
fi
ssh_cmd "chmod +x '${DEPLOY_DIR}/discord.new' && mv '${DEPLOY_DIR}/discord.new' '${DEPLOY_DIR}/discord'"
if [[ "$DEPLOY_CONFIG" == "true" ]]; then
echo "📋 Übertrage config.yml..."