From 09e4274f8e111062b4b6cd24fb4dfb08c01bfd55 Mon Sep 17 00:00:00 2001 From: andre Date: Sat, 29 Nov 2025 23:42:42 +0100 Subject: [PATCH] =?UTF-8?q?rootfs/usr/local/bin/git-sync.sh=20hinzugef?= =?UTF-8?q?=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rootfs/usr/local/bin/git-sync.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 rootfs/usr/local/bin/git-sync.sh 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