Last active
July 18, 2018 12:55
-
-
Save nanpuyue/9db789a02e5ddfc545abfe50c976cbd8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # file: rsync-repo.sh | |
| # date: 2018-07-18 | |
| # license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
| # author: nanpuyue <[email protected]> https://blog.nanpuyue.com | |
| LOCAL_DIR="/path/ubuntu" | |
| MIRROR_SRC="rsync://archive.ubuntu.com/ubuntu/" | |
| DISTS="bionic bionic-backports bionic-proposed bionic-security bionic-updates" | |
| COMPONENTS="main restricted universe multiverse" | |
| CONTENTS="binary-amd64 binary-i386" | |
| cd "$LOCAL_DIR" | |
| for d in $DISTS; do | |
| echo dists/$d/InRelease | |
| echo dists/$d/Release | |
| for m in $COMPONENTS; do | |
| echo dists/$d/$m/i18n/ | |
| echo dists/$d/$m/dep11/ | |
| for n in $CONTENTS; do | |
| echo dists/$d/$m/$n/ | |
| done; done; done |\ | |
| rsync -av --delete-after --files-from /dev/stdin $MIRROR_SRC .tmp/ | |
| for d in $DISTS; do | |
| for m in $COMPONENTS; do | |
| for n in $CONTENTS; do | |
| xz -dc .tmp/dists/$d/$m/$n/Packages.xz|grep -Po "(?<=^Filename: ).*?$" | |
| done; done; done |\ | |
| rsync -lptv --delete-after --files-from /dev/stdin $MIRROR_SRC ./ | |
| rsync -av --delete-after .tmp/dists/ dists/ | |
| date +"%F %T:%tupdated" >> .update.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment