Compare commits
	
		
			2 Commits
		
	
	
		
			a945c3c78b
			...
			a97da67111
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | a97da67111 | ||
|   | 4dcc7cc640 | 
| @ -1,3 +1,4 @@ | ||||
| beautifulsoup4==4.13.4 | ||||
| requests==2.32.3 | ||||
| schedule==1.2.2 | ||||
| nslookup==1.8.1 | ||||
							
								
								
									
										2
									
								
								docker/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								docker/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,3 +1,3 @@ | ||||
| repo | ||||
| __pycache__ | ||||
| .env | ||||
| /.env | ||||
| @ -7,11 +7,15 @@ RUN apk update && \ | ||||
|     apk add python3 py3-pip git   | ||||
| # inotify-tools | ||||
| 
 | ||||
| RUN mkdir /etc/debmirror && \ | ||||
|     touch /etc/debmirror/MirrorListV6 && \ | ||||
|     touch /etc/debmirror/MirrorListV4 | ||||
| RUN mkdir /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 whatDomain.py /etc/debmirror/ | ||||
| COPY requirements.txt /etc/debmirror/ | ||||
| @ -21,8 +25,11 @@ RUN python3 -m venv venv && \ | ||||
|     venv/bin/pip3 install -r requirements.txt | ||||
| 
 | ||||
| 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 | ||||
| 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  | ||||
| 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: | ||||
|     container_name: Debian_Mirrors_Updater | ||||
|     build: ./ | ||||
|     image: DebMirrorLists:V1 | ||||
|     image: debmirrorupd:V1 | ||||
|     environment: | ||||
|       - DEBMIRRORURL=https://www.debian.org/mirror/list | ||||
|       - GITEA_TOKEN=<CHANGE_ME> | ||||
|     restart: unless-stopped | ||||
|     privileged: false | ||||
|  | ||||
| @ -3,7 +3,8 @@ set -e | ||||
| 
 | ||||
| WORKPTH="/etc/debmirror/" | ||||
| 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 | ||||
| if [ ! -d "$REPO_DIR/.git" ]; then | ||||
| @ -14,6 +15,7 @@ fi | ||||
| 
 | ||||
| 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.email "UpdateBot@localhost.local" | ||||
| @ -21,14 +23,15 @@ 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 | ||||
| # stage files | ||||
| git add MirrorListV4 MirrorListV6 | ||||
| 
 | ||||
| # Commit and push only if there's anything new staged | ||||
| if git diff --cached --quiet; then | ||||
|     echo "[$(date)] No changes to commit." | ||||
| else | ||||
|     git add MirrorsV4 MirrorsV6 | ||||
|     git commit -m "Auto-update mirror list on $(date -Iseconds)" | ||||
|     git push | ||||
|     echo "Changes pushed successfully." | ||||
|     echo "[$(date)] Changes pushed successfully." | ||||
| fi | ||||
| 
 | ||||
|  | ||||
| @ -8,8 +8,8 @@ if os.environ["DEBMIRRORURL"]: | ||||
| else: | ||||
|     DEBMIRRORURL = "https://www.debian.org/mirror/list" | ||||
| 
 | ||||
| IPv4FILE = "./MirrorListV4" | ||||
| IPv6FILE = "./MirrorListV6" | ||||
| IPv4FILE = "/etc/debmirror/MirrorListV4" | ||||
| IPv6FILE = "/etc/debmirror/MirrorListV6" | ||||
| 
 | ||||
| 
 | ||||
| # Define EU and American countries | ||||
| @ -146,3 +146,5 @@ def LeJob(): | ||||
| 
 | ||||
| 
 | ||||
| LeJob() | ||||
| 
 | ||||
| print("Done") | ||||
| @ -1,3 +1,4 @@ | ||||
| beautifulsoup4==4.13.4 | ||||
| requests==2.32.3 | ||||
| schedule==1.2.2 | ||||
| nslookup==1.8.1 | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user