Propably working Dockerfile.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user