diff --git a/rootfs/usr/local/bin/git-sync.sh b/rootfs/usr/local/bin/git-sync.sh new file mode 100644 index 0000000..87ac4f1 --- /dev/null +++ b/rootfs/usr/local/bin/git-sync.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +REPO="/opt/git-sync/" +TARGET="/" + +# sicherstellen dass Repo existiert +if [ ! -d "$REPO/.git" ]; then + echo "Git-Repo nicht gefunden: $REPO" + exit 1 +fi + +# Aktualisieren +cd "$REPO" || exit 1 +git stash push -m "auto-sync" +git pull --rebase +git stash pop + + +# Dateien verteilen (rootfs → /) +sudo rsync -a rootfs/ "$TARGET" + +chmod 600 /home/$USER/.ssh/* + +exit 0 \ No newline at end of file