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

32 lines
571 B
Bash

#!/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 --no-o --no-g -a rootfs/ "$TARGET"
rsync -rltpD rootfs/ "$TARGET"
chmod +x /usr/local/bin/*.sh
chown andre:andre /home/andre/
chown andre:andre /home/andre/* -R
chmod +x /home/andre/*.sh
chmod 600 /home/andre/.ssh/*
systemctl daemon-reload
exit 0