V2.0.1 aka it's working now

This commit is contained in:
YuruC3
2025-05-11 19:16:07 +02:00
parent 32052f5cd5
commit f3a28cb10f
7 changed files with 65 additions and 13 deletions

2
docker/.gitignore vendored
View File

@@ -1,3 +1,3 @@
repo
__pycache__
/.env
.env

View File

@@ -2,6 +2,8 @@ FROM alpine:latest
# https://docs.docker.com/reference/dockerfile/#environment-replacement
ENV DEBMIRRORURL="https://www.debian.org/mirror/list"
ENV EXTRAREPOS=True
ENV SECURITYREPOS=True
RUN apk update && \
apk add python3 py3-pip git

View File

@@ -4,9 +4,13 @@ services:
debmirup:
container_name: Debian_Mirrors_Updater
build: ./
image: debmirrorupd:V1.1
image: debmirrorupd:V2.0.1
environment:
- DEBMIRRORURL=https://www.debian.org/mirror/list
- GITEA_TOKEN=<CHANGE_ME>
- GITURLPROTO=https
- GITURL=tea.shupogaki.org
- GITREPOPATH=YuruC3/Debain-repos.git
- GITEA_TOKEN=<CHANGHE_ME>
- EXTRAREPOS=True
- SECURITYREPOS=True
restart: unless-stopped
privileged: false

View File

@@ -3,7 +3,7 @@ set -e
WORKPTH="/etc/debmirror/"
REPO_DIR="$WORKPTH/Debain-repos"
REPO_URL="https://tea.shupogaki.org/YuruC3/Debain-repos.git"
REPO_URL="${GITURLPROTO}://${GITURL}/${GITREPOPATH}"
# Clone repo only if it doesn't already exist
@@ -15,13 +15,19 @@ fi
cd "$REPO_DIR"
git remote set-url origin "https://${GITEA_TOKEN}@tea.shupogaki.org/YuruC3/Debain-repos.git"
git remote set-url origin "https://${GITEA_TOKEN}@${GITURL}/${GITREPOPATH}"
git config user.name "UpdateBot"
git config user.email "UpdateBot@localhost.local"
# pull changes
git pull
# If anything to commit locally, commit it now
if ! git diff --cached --quiet; then
echo "[$(date)] Committing local changes before pulling"
git commit -m "Auto-commit before pull on $(date -Iseconds)"
fi
# Now pull the latest
git pull --rebase --autostash
# stage files
git add MirrorListV4 MirrorListV6

View File

@@ -9,6 +9,15 @@ else:
DEBMIRRORURL = "https://www.debian.org/mirror/list"
DEBSECURITYURL = ["https://security.debian.org/debian-security/"]
EXTRASURL = ["https://download.docker.com/linux/debian/",
# Double just to be sure. Even though they point to the same IP
"http://download.proxmox.com/debian/",
"https://enterprise.proxmox.com/debian/pve/",
# That's for nvidia docker toolkit something something
# stuff that makes containers use nvenc and shit
"https://nvidia.github.io/libnvidia-container/stable/deb/",
"https://nvidia.github.io/libnvidia-container/experimental/deb/"]
IPv4FILE = "/etc/debmirror/MirrorListV4"
IPv6FILE = "/etc/debmirror/MirrorListV6"
@@ -25,7 +34,7 @@ target_countries = set([
"Argentina", "Brazil", "Canada", "Chile", "Colombia", "Costa Rica", "Ecuador",
"Mexico", "Peru", "United States", "Uruguay", "Venezuela",
# Others
"Security"
"Security", "Extras"
])
@@ -87,7 +96,10 @@ def sanitizeUrlsGodWhatTheFuckIsThis(SoupInput: BeautifulSoup):
outMirrorDict[current_country] = []
outMirrorDict[current_country].append(url)
outMirrorDict.update({"Security": DEBSECURITYURL})
if os.environ["SECURITYREPOS"]:
outMirrorDict.update({"Security": DEBSECURITYURL})
if os.environ["EXTRAREPOS"]:
outMirrorDict.update({"Extras": EXTRASURL})
return outMirrorDict