Compare commits
No commits in common. "a97da6711178a9bd49e711c3119ed256cb241e42" and "a945c3c78b803e9ce2e897fbefbf0b016b119149" have entirely different histories.
a97da67111
...
a945c3c78b
@ -1,4 +1,3 @@
|
|||||||
beautifulsoup4==4.13.4
|
beautifulsoup4==4.13.4
|
||||||
requests==2.32.3
|
requests==2.32.3
|
||||||
schedule==1.2.2
|
schedule==1.2.2
|
||||||
nslookup==1.8.1
|
|
2
docker/.gitignore
vendored
2
docker/.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
repo
|
repo
|
||||||
__pycache__
|
__pycache__
|
||||||
/.env
|
.env
|
@ -7,15 +7,11 @@ RUN apk update && \
|
|||||||
apk add python3 py3-pip git
|
apk add python3 py3-pip git
|
||||||
# inotify-tools
|
# inotify-tools
|
||||||
|
|
||||||
RUN mkdir /etc/debmirror
|
RUN mkdir /etc/debmirror && \
|
||||||
|
touch /etc/debmirror/MirrorListV6 && \
|
||||||
|
touch /etc/debmirror/MirrorListV4
|
||||||
WORKDIR /etc/debmirror/
|
WORKDIR /etc/debmirror/
|
||||||
|
|
||||||
RUN git clone https://tea.shupogaki.org/YuruC3/Debain-repos && \
|
|
||||||
ln -s /etc/debmirror/Debain-repos/MirrorListV4 /etc/debmirror/MirrorListV4 && \
|
|
||||||
ln -s /etc/debmirror/Debain-repos/MirrorListV6 /etc/debmirror/MirrorListV6
|
|
||||||
# RUN touch /etc/debmirror/MirrorListV6 && \
|
|
||||||
# touch /etc/debmirror/MirrorListV4
|
|
||||||
|
|
||||||
COPY mainDocker.py /etc/debmirror/
|
COPY mainDocker.py /etc/debmirror/
|
||||||
COPY whatDomain.py /etc/debmirror/
|
COPY whatDomain.py /etc/debmirror/
|
||||||
COPY requirements.txt /etc/debmirror/
|
COPY requirements.txt /etc/debmirror/
|
||||||
@ -25,11 +21,8 @@ RUN python3 -m venv venv && \
|
|||||||
venv/bin/pip3 install -r requirements.txt
|
venv/bin/pip3 install -r requirements.txt
|
||||||
|
|
||||||
COPY cron-jobs /etc/crontabs/
|
COPY cron-jobs /etc/crontabs/
|
||||||
RUN chmod 0644 /etc/crontabs/cron-jobs && \
|
COPY gitPush.sh /etc/crontabs/
|
||||||
crontab /etc/crontabs/cron-jobs
|
|
||||||
|
|
||||||
COPY gitPush.sh /etc/debmirror/
|
RUN chmod +x /etc/crontabs/gitPush.sh
|
||||||
|
|
||||||
RUN chmod +x /etc/debmirror/gitPush.sh
|
CMD ["/usr/sbin/crond"]
|
||||||
|
|
||||||
CMD ["/usr/sbin/crond", "-f"]
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
# python
|
# python
|
||||||
# 25 19 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainDocker.py
|
25 19 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainDocker.py
|
||||||
*/3 * * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainDocker.py
|
|
||||||
|
|
||||||
# git push
|
# git push
|
||||||
# 30 19 * * * /bin/sh /etc/debmirror/gitPush.sh
|
30 19 * * * /bin/sh /etc/debmirror/gitPush.sh
|
||||||
*/1 * * * * /bin/sh /etc/debmirror/gitPush.sh
|
|
@ -4,9 +4,8 @@ services:
|
|||||||
debmirup:
|
debmirup:
|
||||||
container_name: Debian_Mirrors_Updater
|
container_name: Debian_Mirrors_Updater
|
||||||
build: ./
|
build: ./
|
||||||
image: debmirrorupd:V1
|
image: DebMirrorLists:V1
|
||||||
environment:
|
environment:
|
||||||
- DEBMIRRORURL=https://www.debian.org/mirror/list
|
- DEBMIRRORURL=https://www.debian.org/mirror/list
|
||||||
- GITEA_TOKEN=<CHANGE_ME>
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
privileged: false
|
privileged: false
|
||||||
|
@ -3,8 +3,7 @@ set -e
|
|||||||
|
|
||||||
WORKPTH="/etc/debmirror/"
|
WORKPTH="/etc/debmirror/"
|
||||||
REPO_DIR="$WORKPTH/Debain-repos"
|
REPO_DIR="$WORKPTH/Debain-repos"
|
||||||
REPO_URL="https://tea.shupogaki.org/YuruC3/Debain-repos.git"
|
REPO_URL="https://$GITEA_TOKEN@tea.shupogaki.org/YuruC3/Debain-repos.git"
|
||||||
|
|
||||||
|
|
||||||
# Clone repo only if it doesn't already exist
|
# Clone repo only if it doesn't already exist
|
||||||
if [ ! -d "$REPO_DIR/.git" ]; then
|
if [ ! -d "$REPO_DIR/.git" ]; then
|
||||||
@ -15,7 +14,6 @@ fi
|
|||||||
|
|
||||||
cd "$REPO_DIR"
|
cd "$REPO_DIR"
|
||||||
|
|
||||||
git remote set-url origin "https://${GITEA_TOKEN}@tea.shupogaki.org/YuruC3/Debain-repos.git"
|
|
||||||
|
|
||||||
git config user.name "UpdateBot"
|
git config user.name "UpdateBot"
|
||||||
git config user.email "UpdateBot@localhost.local"
|
git config user.email "UpdateBot@localhost.local"
|
||||||
@ -23,15 +21,14 @@ git config user.email "UpdateBot@localhost.local"
|
|||||||
# pull changes
|
# pull changes
|
||||||
git pull
|
git pull
|
||||||
|
|
||||||
# stage files
|
# check if modified
|
||||||
git add MirrorListV4 MirrorListV6
|
if git diff --quiet && git diff --cached --quiet; then
|
||||||
|
echo "No changes to commit."
|
||||||
# Commit and push only if there's anything new staged
|
# if yes, push
|
||||||
if git diff --cached --quiet; then
|
|
||||||
echo "[$(date)] No changes to commit."
|
|
||||||
else
|
else
|
||||||
|
git add MirrorsV4 MirrorsV6
|
||||||
git commit -m "Auto-update mirror list on $(date -Iseconds)"
|
git commit -m "Auto-update mirror list on $(date -Iseconds)"
|
||||||
git push
|
git push
|
||||||
echo "[$(date)] Changes pushed successfully."
|
echo "Changes pushed successfully."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ if os.environ["DEBMIRRORURL"]:
|
|||||||
else:
|
else:
|
||||||
DEBMIRRORURL = "https://www.debian.org/mirror/list"
|
DEBMIRRORURL = "https://www.debian.org/mirror/list"
|
||||||
|
|
||||||
IPv4FILE = "/etc/debmirror/MirrorListV4"
|
IPv4FILE = "./MirrorListV4"
|
||||||
IPv6FILE = "/etc/debmirror/MirrorListV6"
|
IPv6FILE = "./MirrorListV6"
|
||||||
|
|
||||||
|
|
||||||
# Define EU and American countries
|
# Define EU and American countries
|
||||||
@ -146,5 +146,3 @@ def LeJob():
|
|||||||
|
|
||||||
|
|
||||||
LeJob()
|
LeJob()
|
||||||
|
|
||||||
print("Done")
|
|
@ -1,4 +1,3 @@
|
|||||||
beautifulsoup4==4.13.4
|
beautifulsoup4==4.13.4
|
||||||
requests==2.32.3
|
requests==2.32.3
|
||||||
schedule==1.2.2
|
schedule==1.2.2
|
||||||
nslookup==1.8.1
|
|
Loading…
x
Reference in New Issue
Block a user