sync: 2026-09-28 19:29

This commit is contained in:
benji.benji committed 2026-09-28 19:29:26 +02:00
1 parent 0751ca592d
commit 9c13ae7a65
3 files changed
+26 -8

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
[submodule "DEV1.1/TP"] [submodule "DEV1.1/TP"]
path = DEV1.1/TP path = DEV1.1/TP
url = gitea@grond.iut-fbleau.fr:vincentg/DEV.git url = gitea@grond.iut-fbleau.fr:vincentg/DEV.git
branch = main
+24 -7
View File
@@ -1,33 +1,50 @@
#!/bin/sh #!/bin/sh
# Set PATH so cron can find git, date, ssh, etc. # Set PATH so cron can find git, date, ssh, etc.
export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" export PATH="/usr/local/bin:/usr/bin:/bin"
# Explicitly set target directory (don't rely on $HOME in cron) # Explicitly set target directory (don't rely on $HOME in cron)
TARGET_DIR="/home/benji/Documents/COURS" TARGET_DIR="/home/benji/Documents/COURS"
# SSH key pour Git (appliquée à la fois à Homelab et IUT)
export GIT_SSH_COMMAND="ssh -i /home/benji/.ssh/git -o IdentitiesOnly=yes"
# Navigate to target directory # Navigate to target directory
cd "$TARGET_DIR" || { cd "$TARGET_DIR" || {
echo "Directory not found" echo "Directory not found"
exit 1 exit 1
} }
# Pull remote changes rebase-style # 1. Pull remote changes (repo principal + sous-modules)
git pull --rebase --autostash || { git pull --rebase --autostash || {
echo "Git pull failed" echo "Git pull failed on COURS"
exit 1
}
git submodule update --remote --merge || {
echo "Git submodule update failed"
exit 1 exit 1
} }
# Stage all files # 2. Traitement du sous-module TP (Gitea IUT)
if [ -d "DEV1.1/TP" ]; then
cd DEV1.1/TP
git add -A
if ! git diff-index --quiet HEAD --; then
git commit -m "sync: $(date +'%Y-%m-%d %H:%M')"
git push || echo "Avertissement : Git push à échoué sur le sous-module TP"
fi
cd "$TARGET_DIR" || exit 1
fi
# 3. Traitement du dépôt principal COURS (Gitea Homelab)
git add -A git add -A
# Commit only if there are actual changes staged
if ! git diff-index --quiet HEAD --; then if ! git diff-index --quiet HEAD --; then
git commit -m "sync: $(date +'%Y-%m-%d %H:%M')" git commit -m "sync: $(date +'%Y-%m-%d %H:%M')"
git push || { git push || {
echo "Git push failed" echo "Git push failed on COURS"
exit 1 exit 1
} }
else else
echo "No changes to commit." echo "No changes to commit in COURS."
fi fi