Files
workstation-config/temp-cleanup/install.sh
T
kai 5d3f68e41f Clean Up wird erweitert
Clean Up wird erweitert
2026-04-24 11:45:04 +00:00

50 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..."
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TARGET_BASE="$HOME/workstation-config"
TARGET_DIR="$TARGET_BASE/temp-cleanup"
SYSTEMD_USER_DIR="$HOME/.config/systemd/user"
SERVICE_NAME="cleanup-temp.service"
TIMER_NAME="cleanup-temp.timer"
SCRIPT_NAME="cleanup_temp.sh"
TARGET_SERVICE="$SYSTEMD_USER_DIR/$SERVICE_NAME"
TARGET_TIMER="$SYSTEMD_USER_DIR/$TIMER_NAME"
echo "📁 Quelle: $SOURCE_DIR"
echo "📁 Ziel: $TARGET_DIR"
# 🧱 Struktur
mkdir -p "$TARGET_DIR"
mkdir -p "$SYSTEMD_USER_DIR"
# 📄 Dateien kopieren
cp "$SOURCE_DIR/cleanup_temp.sh" "$TARGET_DIR/"
cp "$SOURCE_DIR/systemd/$SERVICE_NAME" "$TARGET_DIR/"
cp "$SOURCE_DIR/systemd/$TIMER_NAME" "$TARGET_DIR/"
chmod +x "$TARGET_DIR/$SCRIPT_NAME"
# 🔧 Service dynamisch anpassen
sed "s|ExecStart=.*|ExecStart=$TARGET_DIR/$SCRIPT_NAME|" \
"$TARGET_DIR/$SERVICE_NAME" > "$TARGET_SERVICE"
# 📄 Timer kopieren
cp "$TARGET_DIR/$TIMER_NAME" "$TARGET_TIMER"
# 🔄 systemd reload
systemctl --user daemon-reload
# ▶️ Timer aktivieren (wichtig!)
systemctl --user enable "$TIMER_NAME"
systemctl --user start "$TIMER_NAME"
echo "✅ Timer aktiv Cleanup läuft automatisch täglich"