rootfs/usr/local/bin/git-sync.sh aktualisiert

This commit is contained in:
2026-02-28 18:38:20 +01:00
parent 4b36911408
commit 09d812bfd0

View File

@@ -6,9 +6,14 @@ TARGET="/"
# sicherstellen dass Repo existiert # sicherstellen dass Repo existiert
if [ ! -d "$REPO/.git" ]; then if [ ! -d "$REPO/.git" ]; then
echo "Git-Repo nicht gefunden: $REPO" 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 exit 1
fi fi
echo "Aktualisiere Git-Repo"
# Aktualisieren # Aktualisieren
cd "$REPO" || exit 1 cd "$REPO" || exit 1
git stash push -m "auto-sync" git stash push -m "auto-sync"
@@ -16,10 +21,12 @@ git pull --rebase
git stash pop git stash pop
echo "Verteile Dateien"
# Dateien verteilen (rootfs → /) # Dateien verteilen (rootfs → /)
#sudo rsync --no-o --no-g -a rootfs/ "$TARGET" #sudo rsync --no-o --no-g -a rootfs/ "$TARGET"
rsync -rltpD rootfs/ "$TARGET" rsync -rltpD rootfs/ "$TARGET"
echo "Setze Besitz und Berechtigungen"
chmod +x /usr/local/bin/*.sh chmod +x /usr/local/bin/*.sh
chown andre:andre /home/andre/ chown andre:andre /home/andre/
@@ -28,10 +35,14 @@ chown andre:andre /home/andre/.* -R
chmod +x /home/andre/*.sh chmod +x /home/andre/*.sh
chmod 600 /home/andre/.ssh/* chmod 600 /home/andre/.ssh/*
echo "Systemd Daemon Reload"
systemctl daemon-reload systemctl daemon-reload
echo "Services aktivieren und starten"
systemctl enable git-sync.timer systemctl enable git-sync.timer
systemctl start git-sync.timer systemctl start git-sync.timer
systemctl enable home-sync.timer systemctl enable home-sync.timer
systemctl start home-sync.timer systemctl start home-sync.timer
echo "Fertig"
exit 0 exit 0