aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-12-13 20:09:39 +0000
committerNicolas Vigier <boklm@mageia.org>2011-12-13 20:09:39 +0000
commited096ce513bebeda238d45567edc22904a841c76 (patch)
treef9825e82db9801d9ebb44f8bbd2b5a640a46f998 /functions
parentd191623593fc46509363d732c93b2a745a96cc0e (diff)
downloadrepoctl-ed096ce513bebeda238d45567edc22904a841c76.tar
repoctl-ed096ce513bebeda238d45567edc22904a841c76.tar.gz
repoctl-ed096ce513bebeda238d45567edc22904a841c76.tar.bz2
repoctl-ed096ce513bebeda238d45567edc22904a841c76.tar.xz
repoctl-ed096ce513bebeda238d45567edc22904a841c76.zip
- update timestamp file at the root of the mirror tree, when mirroring
a distribution - generate a signed file at the root of the mirror tree containing : * sha1sum of timestamp file * sha1sum of MD5SUM files of all repositories * sha1sum of pubkey files of all repositories This file can be used to check that a mirror tree has not been modified.
Diffstat (limited to 'functions')
-rw-r--r--functions62
1 files changed, 62 insertions, 0 deletions
diff --git a/functions b/functions
index 5868945..b765862 100644
--- a/functions
+++ b/functions
@@ -206,6 +206,26 @@ function rm_distro_lock()
rm_lock "$distrolock"
}
+function get_mirror_lock()
+{
+ local mirrorlock="$lockdir/mirror.lock"
+ get_lock "$mirrorlock"
+ for release in $distroreleases
+ do
+ get_distro_lock $release
+ done
+}
+
+function rm_mirror_lock()
+{
+ local mirrorlock="$lockdir/mirror.lock"
+ for release in $distroreleases
+ do
+ rm_distro_lock $release
+ done
+ rm_lock "$mirrorlock"
+}
+
function update_common_MD5SUM()
{
local distrorelease="$1"
@@ -220,6 +240,37 @@ function update_common_MD5SUM()
done
}
+function update_mirror_timestamp()
+{
+ date +%s%n%c > "$rootdir/$timestampfile"
+}
+
+function update_mirror_sha1sum()
+{
+ pushd "$rootdir"
+ sha1sum "$timestampfile" > "$sha1sumfile"
+ for distrorelease in $distroreleases
+ do
+ for section in $distrosections
+ do
+ for sectionrepo in $sectionsrepos
+ do
+ for arch in $arches
+ do
+ sha1sum "distrib/$distrorelease/$arch/media/$section/$sectionrepo/media_info/MD5SUM" >> "$sha1sumfile"
+ sha1sum "distrib/$distrorelease/$arch/media/$section/$sectionrepo/media_info/pubkey" >> "$sha1sumfile"
+ sha1sum "distrib/$distrorelease/$arch/media/debug/$section/$sectionrepo/media_info/MD5SUM" >> "$sha1sumfile"
+ sha1sum "distrib/$distrorelease/$arch/media/debug/$section/$sectionrepo/media_info/pubkey" >> "$sha1sumfile"
+ done
+ sha1sum "distrib/$distrorelease/SRPMS/$section/$sectionrepo/media_info/MD5SUM" >> "$sha1sumfile"
+ sha1sum "distrib/$distrorelease/SRPMS/$section/$sectionrepo/media_info/pubkey" >> "$sha1sumfile"
+ done
+ done
+ done
+ $dryrun $sign_mirror_sha1sum > "$sha1sumsigfile"
+ popd
+}
+
function mirror_repository()
{
local distrorelease="$1"
@@ -232,6 +283,17 @@ function mirror_repository()
update_common_MD5SUM "$distrorelease"
$dryrun /usr/bin/rsync $mirror_rsync_options "$distribdir/$distrorelease/" "$finaldistribdir/$distrorelease/"
rm_distro_lock "$distrorelease"
+ get_mirror_lock
+ if [ -z $dryrun ]
+ then
+ update_mirror_timestamp
+ update_mirror_sha1sum
+ fi
+ for file in "$timestampfile" "$sha1sumfile" "$sha1sumsigfile"
+ do
+ $dryrun /usr/bin/rsync $mirror_rsync_options "$rootdir/$file" "$finalrootdir/$file"
+ done
+ rm_mirror_lock
}
function check_distro_section()