Files
workstation-config/temp-cleanup/install.sh
T

43 lines
1.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -e
echo "📦 Installiere Temp Cleanup System..."
# 🧠 Pfade bestimmen
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TARGET_DIR="$HOME/workstation-config/temp-cleanup"
SYSTEMD_USER_DIR="$HOME/.config/systemd/user"
SERVICE_NAME="cleanup-temp.service"
TIMER_NAME="cleanup-temp.timer"
SCRIPT_NAME="cleanup_temp.sh"
echo "📁 Current: $CURRENT_DIR"
echo "📁 Target: $TARGET_DIR"
# 🧱 Zielstruktur sicherstellen
mkdir -p "$SYSTEMD_USER_DIR"
# 🚨 WICHTIG: KEIN COPY mehr (nur Setup!)
# Grund: Repo ist bereits die Quelle kein Deployment in sich selbst
echo "⚙️ Installiere systemd Konfiguration..."
# 🔧 Service schreiben (Pfad fix auf Ziel)
sed "s|ExecStart=.*|ExecStart=$TARGET_DIR/$SCRIPT_NAME|" \
"$CURRENT_DIR/systemd/$SERVICE_NAME" > "$SYSTEMD_USER_DIR/$SERVICE_NAME"
# ⏱ Timer installieren
cp "$CURRENT_DIR/systemd/$TIMER_NAME" "$SYSTEMD_USER_DIR/$TIMER_NAME"
# 🔄 systemd reload
echo "🔄 Reload systemd..."
systemctl --user daemon-reload
# 🚀 Aktivieren & starten
systemctl --user enable "$TIMER_NAME" >/dev/null 2>&1 || true
systemctl --user start "$TIMER_NAME" >/dev/null 2>&1 || true
echo "✅ Installation abgeschlossen!"
echo "🧹 Temp Cleanup ist aktiv"