Propably working Dockerfile.

This commit is contained in:
YuruC3
2025-05-11 15:08:26 +02:00
parent 62562b6060
commit 1026bd59d4
11 changed files with 134 additions and 97 deletions

View File

@@ -1,12 +1,34 @@
#!/bin/sh
GITPATH="/etc/debmirror/"
set -e
# https://github.com/mujtaba1747/git-autocommit/tree/master
WORKPTH="/etc/debmirror/"
REPO_DIR="$WORKPTH/Debain-repos"
REPO_URL="https://$GITEA_TOKEN@tea.shupogaki.org/YuruC3/Debain-repos.git"
# Clone repo only if it doesn't already exist
if [ ! -d "$REPO_DIR/.git" ]; then
echo "[$(date)] Cloning repository..."
git clone "$REPO_URL" "$REPO_DIR"
fi
cd "$REPO_DIR"
git config user.name "UpdateBot"
git config user.email "UpdateBot@localhost.local"
# pull changes
git pull
# check if modified
if git diff --quiet && git diff --cached --quiet; then
echo "No changes to commit."
# if yes, push
else
git add MirrorsV4 MirrorsV6
git commit -m "Auto-update mirror list on $(date -Iseconds)"
git push
echo "Changes pushed successfully."
fi
inotifywait --recursive -qq -e modify,close_write $GITPATH
cd $GITPATH &> /dev/null
git pull &> /dev/null
git add --all &> /dev/null
now=$(date) &> /dev/null
git commit -m "Auto-Commit at: $now" &> /dev/null
git push -u origin main &> /dev/null