Compare commits
	
		
			2 Commits
		
	
	
		
			a945c3c78b
			...
			a97da67111
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | a97da67111 | ||
|   | 4dcc7cc640 | 
| @ -1,3 +1,4 @@ | |||||||
| 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,11 +7,15 @@ 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/ | ||||||
| @ -21,8 +25,11 @@ 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/ | ||||||
| COPY gitPush.sh /etc/crontabs/ | RUN chmod 0644 /etc/crontabs/cron-jobs && \ | ||||||
|  |     crontab /etc/crontabs/cron-jobs | ||||||
| 
 | 
 | ||||||
| RUN chmod +x /etc/crontabs/gitPush.sh | COPY gitPush.sh /etc/debmirror/ | ||||||
| 
 | 
 | ||||||
| CMD ["/usr/sbin/crond"] | RUN chmod +x /etc/debmirror/gitPush.sh | ||||||
|  | 
 | ||||||
|  | CMD ["/usr/sbin/crond", "-f"] | ||||||
|  | |||||||
| @ -1,5 +1,7 @@ | |||||||
| # 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,8 +4,9 @@ services: | |||||||
|   debmirup: |   debmirup: | ||||||
|     container_name: Debian_Mirrors_Updater |     container_name: Debian_Mirrors_Updater | ||||||
|     build: ./ |     build: ./ | ||||||
|     image: DebMirrorLists:V1 |     image: debmirrorupd: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,7 +3,8 @@ set -e | |||||||
| 
 | 
 | ||||||
| WORKPTH="/etc/debmirror/" | WORKPTH="/etc/debmirror/" | ||||||
| REPO_DIR="$WORKPTH/Debain-repos" | REPO_DIR="$WORKPTH/Debain-repos" | ||||||
| REPO_URL="https://$GITEA_TOKEN@tea.shupogaki.org/YuruC3/Debain-repos.git" | REPO_URL="https://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 | ||||||
| @ -14,6 +15,7 @@ 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" | ||||||
| @ -21,14 +23,15 @@ git config user.email "UpdateBot@localhost.local" | |||||||
| # pull changes | # pull changes | ||||||
| git pull  | git pull  | ||||||
| 
 | 
 | ||||||
| # check if modified | # stage files | ||||||
| if git diff --quiet && git diff --cached --quiet; then | git add MirrorListV4 MirrorListV6 | ||||||
|     echo "No changes to commit." | 
 | ||||||
| # if yes, push | # Commit and push only if there's anything new staged | ||||||
|  | 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 "Changes pushed successfully." |     echo "[$(date)] 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 = "./MirrorListV4" | IPv4FILE = "/etc/debmirror/MirrorListV4" | ||||||
| IPv6FILE = "./MirrorListV6" | IPv6FILE = "/etc/debmirror/MirrorListV6" | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Define EU and American countries | # Define EU and American countries | ||||||
| @ -146,3 +146,5 @@ def LeJob(): | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| LeJob() | LeJob() | ||||||
|  | 
 | ||||||
|  | print("Done") | ||||||
| @ -1,3 +1,4 @@ | |||||||
| 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