install.sh aktualisiert

This commit is contained in:
kai
2026-04-24 12:16:47 +00:00
parent a9a93d5b89
commit 283e8bf6b2
+37 -19
View File
@@ -4,33 +4,51 @@ set -e
echo "🚀 Starte Bootstrap Installation..." echo "🚀 Starte Bootstrap Installation..."
# 🧠 Konfiguration
GIT_REPO_SSH="ssh://git@192.168.178.5:2222/kai/workstation-config.git" GIT_REPO_SSH="ssh://git@192.168.178.5:2222/kai/workstation-config.git"
GIT_REPO_HTTP="http://192.168.178.5:3000/kai/workstation-config.git" GIT_REPO_HTTP="http://192.168.178.5:3000/kai/workstation-config.git"
TARGET_DIR="$HOME/workstation-config" TARGET_DIR="$HOME/workstation-config"
# 🔍 Prüfen ob gültiges Repo # 📥 Repo sicherstellen
if git -C "$TARGET_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then if ! git -C "$TARGET_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "🔄 Gültiges Repo gefunden update..."
git -C "$TARGET_DIR" pull
else
echo "⚠️ Kein gültiges Repo gefunden"
if [ -d "$TARGET_DIR" ]; then echo "📥 Klone Repo..."
echo "🧹 Entferne alten Ordner..."
rm -rf "$TARGET_DIR"
fi
echo "📥 Versuche SSH Clone..." if ! git clone "$GIT_REPO_SSH" "$TARGET_DIR"; then
echo "⚠️ SSH failed → HTTP fallback"
if git clone "$GIT_REPO_SSH" "$TARGET_DIR"; then
echo "✅ SSH Clone erfolgreich"
else
echo "⚠️ SSH fehlgeschlagen fallback auf HTTP"
git clone "$GIT_REPO_HTTP" "$TARGET_DIR" git clone "$GIT_REPO_HTTP" "$TARGET_DIR"
fi fi
else
echo "🔄 Repo vorhanden → update"
git -C "$TARGET_DIR" pull
fi fi
echo "⚙️ Starte Installation..." cd "$TARGET_DIR/temp-cleanup"
bash "$TARGET_DIR/temp-cleanup/install.sh"
echo "📦 Installiere Temp Cleanup System..."
SYSTEMD_USER_DIR="$HOME/.config/systemd/user"
mkdir -p "$SYSTEMD_USER_DIR"
SERVICE_FILE="systemd/cleanup-temp.service"
TIMER_FILE="systemd/cleanup-temp.timer"
SCRIPT_FILE="cleanup_temp.sh"
# 🔐 immer kopieren (kein Skip mehr!)
cp "$TARGET_DIR/temp-cleanup/$SCRIPT_FILE" "$TARGET_DIR/temp-cleanup/"
cp "$TARGET_DIR/temp-cleanup/$SERVICE_FILE" "$TARGET_DIR/temp-cleanup/"
cp "$TARGET_DIR/temp-cleanup/$TIMER_FILE" "$TARGET_DIR/temp-cleanup/" 2>/dev/null || true
chmod +x "$TARGET_DIR/temp-cleanup/$SCRIPT_FILE"
# 🔧 Service fixen
sed "s|ExecStart=.*|ExecStart=$TARGET_DIR/temp-cleanup/$SCRIPT_FILE|" \
"$TARGET_DIR/temp-cleanup/$SERVICE_FILE" > "$SYSTEMD_USER_DIR/cleanup-temp.service"
cp "$TARGET_DIR/temp-cleanup/$TIMER_FILE" "$SYSTEMD_USER_DIR/" 2>/dev/null || true
systemctl --user daemon-reload
systemctl --user enable cleanup-temp.timer 2>/dev/null || true
systemctl --user restart cleanup-temp.timer 2>/dev/null || true
echo "✅ Installation abgeschlossen!"