aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoronefang2025-12-03 04:39:49 +0100
committeronefang2025-12-03 04:39:49 +0100
commit8d6b6af048d31cac1472692480b882ea8a655820 (patch)
tree953a81e339366a6be02fd94fa37929308ea763d4
parentTweak the time tests. (diff)
downloaddevuan_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-xdevuan_package_mirror_sync.sh16
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 *
21set -ef 30set -ef
@@ -81,6 +90,7 @@ OPTIONS="--delay-updates -rptSzhhv --no-motd --chown mirrors:www-data -M-
81 90
82mkdir -p ${MIRROR_PATH} 91mkdir -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.
85start_time=$(date +%s%3N) 95start_time=$(date +%s%3N)
86rsltM=$( ${BEHAVE} rsync ${OPTIONS} vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" \ 96rsltM=$( ${BEHAVE} rsync ${OPTIONS} vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" \
@@ -91,6 +101,8 @@ start_time=$(date +%s%3N)
91rsltC=$( ${BEHAVE} rsync ${OPTIONS} -l --delete-delay vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" ) 101rsltC=$( ${BEHAVE} rsync ${OPTIONS} -l --delete-delay vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" )
92end_time=$(date +%s%3N) ; durationC=$((end_time - start_time)) 102end_time=$(date +%s%3N) ; durationC=$((end_time - start_time))
93 103
104
105# Report the results.
94rsltM=$( 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 ) 106rsltM=$( 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 )
95rsltC=$( echo "$rsltC" | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|/by-hash/' | head -n -3 | tail -n +2 ) 107rsltC=$( echo "$rsltC" | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|/by-hash/' | head -n -3 | tail -n +2 )
96if [ -n "$rsltM" ] ; then echo -e "$rsltM\n"; fi 108if [ -n "$rsltM" ] ; then echo -e "$rsltM\n"; fi