diff options
| author | onefang | 2025-12-03 04:39:49 +0100 |
|---|---|---|
| committer | onefang | 2025-12-03 04:39:49 +0100 |
| commit | 8d6b6af048d31cac1472692480b882ea8a655820 (patch) | |
| tree | 953a81e339366a6be02fd94fa37929308ea763d4 | |
| parent | Tweak the time tests. (diff) | |
| download | devuan_package_mirror_sync-8d6b6af048d31cac1472692480b882ea8a655820.zip devuan_package_mirror_sync-8d6b6af048d31cac1472692480b882ea8a655820.tar.gz devuan_package_mirror_sync-8d6b6af048d31cac1472692480b882ea8a655820.tar.bz2 devuan_package_mirror_sync-8d6b6af048d31cac1472692480b882ea8a655820.tar.xz | |
More docs.
| -rwxr-xr-x | devuan_package_mirror_sync.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/devuan_package_mirror_sync.sh b/devuan_package_mirror_sync.sh index 0f6ff3e..2e88782 100755 --- a/devuan_package_mirror_sync.sh +++ b/devuan_package_mirror_sync.sh | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | #!/usr/bin/env bash | 1 | #!/usr/bin/env bash |
| 2 | 2 | ||
| 3 | # This script syncs a Devuan Linux package mirror. | ||
| 4 | |||
| 3 | # I've not found a way to do this in one rsync call, so here's two. | 5 | # I've not found a way to do this in one rsync call, so here's two. |
| 4 | # | 6 | # |
| 5 | # The first one adds any new actual package files, including source and such. | 7 | # The first one adds any new actual package files, including source and such. |
| @@ -7,7 +9,7 @@ | |||
| 7 | # | 9 | # |
| 8 | # The second one doesn't exclude anything, which will pick up the | 10 | # The second one doesn't exclude anything, which will pick up the |
| 9 | # metadata files excluded the first time, then delete anything that should | 11 | # metadata files excluded the first time, then delete anything that should |
| 10 | # be deleted. | 12 | # be deleted at the end. |
| 11 | # | 13 | # |
| 12 | # In this way the amount of time where your mirror isn't fully valid is minimised. | 14 | # In this way the amount of time where your mirror isn't fully valid is minimised. |
| 13 | 15 | ||
| @@ -15,7 +17,14 @@ | |||
| 15 | # to your mirror, BEHAVE is limits on the rsync commands, OPTIONS | 17 | # to your mirror, BEHAVE is limits on the rsync commands, OPTIONS |
| 16 | # includes "--chown mirrors:www-data" change that to the user and group | 18 | # includes "--chown mirrors:www-data" change that to the user and group |
| 17 | # you want your files to be. --exclude "/devuan-cd/" may need to be | 19 | # you want your files to be. --exclude "/devuan-cd/" may need to be |
| 18 | # changed or removed if you run a file / ISO mirror. | 20 | # changed or removed if you run a file / ISO mirror or not. The numbers used for |
| 21 | # deciding to print stuff is just a rough guess to try to keep the emails down, | ||
| 22 | # adjust to suit. | ||
| 23 | # | ||
| 24 | # In general the last section could be tweaked or modified to suit the sorts of | ||
| 25 | # reports you need. For me reporting which Devuan packages got updated could be | ||
| 26 | # done simply, and I'm trying to keep this simple. Reporting which Debian packages | ||
| 27 | # changed is too complex, and I don't need it. | ||
| 19 | 28 | ||
| 20 | # Stop on errors, and don't expand * | 29 | # Stop on errors, and don't expand * |
| 21 | set -ef | 30 | set -ef |
| @@ -81,6 +90,7 @@ OPTIONS="--delay-updates -rptSzhhv --no-motd --chown mirrors:www-data -M- | |||
| 81 | 90 | ||
| 82 | mkdir -p ${MIRROR_PATH} | 91 | mkdir -p ${MIRROR_PATH} |
| 83 | 92 | ||
| 93 | |||
| 84 | # The --exclude "/devuan-cd/" is so we don't wipe out the ISO mirror. | 94 | # The --exclude "/devuan-cd/" is so we don't wipe out the ISO mirror. |
| 85 | start_time=$(date +%s%3N) | 95 | start_time=$(date +%s%3N) |
| 86 | rsltM=$( ${BEHAVE} rsync ${OPTIONS} vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" \ | 96 | rsltM=$( ${BEHAVE} rsync ${OPTIONS} vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" \ |
| @@ -91,6 +101,8 @@ start_time=$(date +%s%3N) | |||
| 91 | rsltC=$( ${BEHAVE} rsync ${OPTIONS} -l --delete-delay vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" ) | 101 | rsltC=$( ${BEHAVE} rsync ${OPTIONS} -l --delete-delay vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" ) |
| 92 | end_time=$(date +%s%3N) ; durationC=$((end_time - start_time)) | 102 | end_time=$(date +%s%3N) ; durationC=$((end_time - start_time)) |
| 93 | 103 | ||
| 104 | |||
| 105 | # Report the results. | ||
| 94 | rsltM=$( echo "$rsltM" | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|/by-hash/|skipping non-regular file' | head -n -4 | tail -n +2 ) | 106 | rsltM=$( echo "$rsltM" | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|/by-hash/|skipping non-regular file' | head -n -4 | tail -n +2 ) |
| 95 | rsltC=$( echo "$rsltC" | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|/by-hash/' | head -n -3 | tail -n +2 ) | 107 | rsltC=$( echo "$rsltC" | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|/by-hash/' | head -n -3 | tail -n +2 ) |
| 96 | if [ -n "$rsltM" ] ; then echo -e "$rsltM\n"; fi | 108 | if [ -n "$rsltM" ] ; then echo -e "$rsltM\n"; fi |
