#!/bin/bash REPO="/opt/git-sync/" TARGET="/" # sicherstellen dass Repo existiert if [ ! -d "$REPO/.git" ]; then echo "Git-Repo nicht gefunden: $REPO" mkdir -p /opt/ cd /opt echo "Klone Git-Repo nach /opt" git clone http://vpnafgeissler.selfhost.co:8418/andre/git-sync.git exit 1 fi echo "Aktualisiere Git-Repo" # Aktualisieren cd "$REPO" || exit 1 git stash push -m "auto-sync" git pull --rebase git stash pop echo "Verteile Dateien" # Dateien verteilen (rootfs → /) #sudo rsync --no-o --no-g -a rootfs/ "$TARGET" rsync -rltpD rootfs/ "$TARGET" echo "Setze Besitz und Berechtigungen" chmod +x /usr/local/bin/*.sh chown andre:andre /home/andre/ chown andre:andre /home/andre/* -R chown andre:andre /home/andre/.* -R chmod +x /home/andre/*.sh chmod 600 /home/andre/.ssh/* echo "Systemd Daemon Reload" systemctl daemon-reload echo "Services aktivieren und starten" systemctl enable git-sync.timer systemctl start git-sync.timer systemctl enable git-sync systemctl start git-sync systemctl restart git-sync systemctl enable home-sync.timer systemctl start home-sync.timer systemctl enable home-sync systemctl start home-sync systemctl restart home-sync echo "Fertig" exit 0