summaryrefslogtreecommitdiff
path: root/app-admin/gentoo-rsync-mirror
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /app-admin/gentoo-rsync-mirror
reinit the tree, so we can have metadata
Diffstat (limited to 'app-admin/gentoo-rsync-mirror')
-rw-r--r--app-admin/gentoo-rsync-mirror/Manifest9
-rw-r--r--app-admin/gentoo-rsync-mirror/files/gentoo-mirror.conf9
-rw-r--r--app-admin/gentoo-rsync-mirror/files/rsync-gentoo-portage.sh11
-rw-r--r--app-admin/gentoo-rsync-mirror/files/rsyncd.conf25
-rw-r--r--app-admin/gentoo-rsync-mirror/files/rsyncd.motd1
-rw-r--r--app-admin/gentoo-rsync-mirror/files/rsynclogparse-extended.pl128
-rw-r--r--app-admin/gentoo-rsync-mirror/gentoo-rsync-mirror-1.0-r5.ebuild53
-rw-r--r--app-admin/gentoo-rsync-mirror/metadata.xml13
8 files changed, 249 insertions, 0 deletions
diff --git a/app-admin/gentoo-rsync-mirror/Manifest b/app-admin/gentoo-rsync-mirror/Manifest
new file mode 100644
index 000000000000..55bdffbe4e6a
--- /dev/null
+++ b/app-admin/gentoo-rsync-mirror/Manifest
@@ -0,0 +1,9 @@
+AUX gentoo-mirror.conf 467 SHA256 c8c3cf072749e12da77bf13f156ce24185227b0b637e566c170a0f6d29a3769d SHA512 9850e862b1795644bc376eef485bcfde8d72e06f40e587cf373e257a95383b95b64217263de62a92a8bc5b2b55adaea108d609803f71d708591b0d4ecdfed6ae WHIRLPOOL 3ebd112a622451b70d14b86355fe8e22a2bfd6cde10f647424581b505308a678a6ac5eb1725b6214d0db3b8e14f6e7702b48b1d043e291d15b2748ea9eff5337
+AUX rsync-gentoo-portage.sh 332 SHA256 cbae155745aa8c857985729c2a0d35ed515eb039a90a2a50488997c96158df67 SHA512 588ea9757167ae5baa72a0542d723be8ae574e3ad487f1ab260de2a419f0d36d29fa2a0c80924292a81f2a69e325fa08729008964de24e0b01189b1e9a04618b WHIRLPOOL fec8e9d32ccac704a7036b42caa550281d4032318982c8e40a13724c78e4c6019ff470ceb9bf5d0849cc9cd95c4198135e38e2ca34b67fad25100b6c98f9b1f4
+AUX rsyncd.conf 611 SHA256 bd96c615e607bf20205dc8300920176de5d8f52a9028505fbf566d1a3f266f79 SHA512 11af716d1741d482f11ec9a9a2d5edbf4c3c0bacd7ed357588f2a8398d313d47de880ae5c38f40ce940259cb741cd7695eab42249ca10e05c3f2654581ffc791 WHIRLPOOL 15bb97a0387df24d5f4049a7d093664a0ff95f7df248459f8ab43db20abc3555e67e6743b84c6f2a20bc3983a824ff013989395ca34308d55ba157a28a0ef292
+AUX rsyncd.motd 44 SHA256 38c8ed04808ce0f5c0deba00be8f14412de3b76e34ff5c0f5bf01d217f0dbc76 SHA512 812c0e738274222e65e5bc57379ebc6150c232cd8bf98e72b500763828bfcfa45fb8e89c7cccd5e34685f4e5d4787d9cd2ab03ace64bc76f5c5416deb03c17f3 WHIRLPOOL fff28789a60ca80a6008d9eba32a47416826962b61e04132b244417d3113136092723c25e02260c93e12ad322f299528acfaa390fbafe41e6db14cf2a81b84fb
+AUX rsynclogparse-extended.pl 3476 SHA256 9b496670cc75f9fdd99c29fd3ff88627a4d145f2cdfdb3457b9524d66a702418 SHA512 60656deb0e501c51c4a37d2f9cce2829faea830ae42d1f33db52f37b337b71a125b7d350e893fb6098b405e1439cbde160d9e7ecda3ebd8a8f8c34b84acf80b3 WHIRLPOOL 4d3f06b557cf6d3f0bfa4f76e1a00f427dff336319b405b702edf94aace60c4a31a43dd1b217af3dde7fba84b11742a8449beb417ec9b067ae925bbd9bafef25
+EBUILD gentoo-rsync-mirror-1.0-r5.ebuild 1980 SHA256 b1b9d9b6f3be38ae9c3800e4c4c019cb34c19eafb4fda4e9a950cbbc42325824 SHA512 b4ac3ad7600cd26c68cea2952991b7b07d39e4361b34bcd7e676a4f4e9ac3d1a8f2ec190fee8d1966b6400858b4bbea83c386a38a84489f9231cb2118334ba58 WHIRLPOOL b67e9ff80f3041e38178eb86143820ae1e068dc10e0124c219718f1f0e36e220ed2d74994ffb25979775b46438cd1ccdea9c74bd6557dcccc1cd63f83735c64b
+MISC ChangeLog 2835 SHA256 dffe7e8e1d3b5b20fea38572dbd96da5d498a2365195557664589813e9a68d3d SHA512 78e1c5a3972a1680c8be2242ceb33ce0e61cef75c42ad6d41bd7dc53f092ab8414fb7f2abaf937d8889ba1e766c8c5977de7708849cb0b547a14b2847bf9e445 WHIRLPOOL cc201c4c75185cdc91691f4a8759d70946563886277df72c670ae749b4a1bd224ae11e78d58038383c9c9b024054f6e3d12f4ef15235f6e19bb1f9e14c0c45af
+MISC ChangeLog-2015 5161 SHA256 a38c2d4354e266ab2b3bf0b038a87886adf07ccb6486a97703beeba16ac33d94 SHA512 70b1deadcecebd31d885657b8fe897375dc7fd42e6f02f49622a1a00239d4523b58aa96ad2dbe77b276c960a0b79418471e6ffc1ede8fd3281ca800c03297d94 WHIRLPOOL be6fb2ca3ed28f5d5ec10f3b0dd04e403aeea121e687e3f1a53971b2a252168406dbcce0906b576023d2d6dd2410515b474be4128a6d02f5f0f9217597826e71
+MISC metadata.xml 442 SHA256 f80adf3a53c101e749fecc208752eedae95c5ea377b478a4bb4805d7c88a12ec SHA512 40d1ffdeff3aca5c1aba521d8a5026e72f6d0d743cb98906d59045cc48794320e576703a9997285db151862cbd747d9f2e1c5c851b0d74e28f161e42a8d0d6fd WHIRLPOOL e2d45722c8ca42a056f9c7021b7db26268d8d968fd2256324d9988da2528d1c96ceec55a6124329989a1a24eb67693258b8d6e07dac529f5695822eb603a5ece
diff --git a/app-admin/gentoo-rsync-mirror/files/gentoo-mirror.conf b/app-admin/gentoo-rsync-mirror/files/gentoo-mirror.conf
new file mode 100644
index 000000000000..d1af6ca014b7
--- /dev/null
+++ b/app-admin/gentoo-rsync-mirror/files/gentoo-mirror.conf
@@ -0,0 +1,9 @@
+# Gentoo rsync mirror config
+
+RSYNC="/usr/bin/rsync"
+OPTS="--quiet --recursive --links --perms --times --devices --specials --delete --timeout=300"
+#Uncomment the following line only if you have been granted access to rsync1.us.gentoo.org
+#SRC="rsync://rsync1.us.gentoo.org/gentoo-portage"
+#If you are waiting for access to our master mirror, select one of our mirrors to mirror from:
+SRC="rsync://rsync.de.gentoo.org/gentoo-portage"
+DST="/opt/gentoo-rsync/portage/"
diff --git a/app-admin/gentoo-rsync-mirror/files/rsync-gentoo-portage.sh b/app-admin/gentoo-rsync-mirror/files/rsync-gentoo-portage.sh
new file mode 100644
index 000000000000..e053fadab1ed
--- /dev/null
+++ b/app-admin/gentoo-rsync-mirror/files/rsync-gentoo-portage.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+source /etc/rsync/gentoo-mirror.conf
+
+echo "Started update at" `date` >> $0.log 2>&1
+logger -t rsync "re-rsyncing the gentoo-portage tree"
+${RSYNC} ${OPTS} ${SRC} ${DST} >> $0.log 2>&1
+logger -t rsync "deleting spurious Changelog files"
+find ${DST} -iname ".ChangeLog*" | xargs rm -rf
+
+echo "End: "`date` >> $0.log 2>&1 \ No newline at end of file
diff --git a/app-admin/gentoo-rsync-mirror/files/rsyncd.conf b/app-admin/gentoo-rsync-mirror/files/rsyncd.conf
new file mode 100644
index 000000000000..54cace847488
--- /dev/null
+++ b/app-admin/gentoo-rsync-mirror/files/rsyncd.conf
@@ -0,0 +1,25 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+uid = nobody
+gid = nobody
+use chroot = yes
+max connections = 20
+pid file = /var/run/rsyncd.pid
+motd file = /etc/rsync/rsyncd.motd
+transfer logging = no
+log format = %t %a %m %f %b
+syslog facility = local3
+timeout = 300
+
+[gentoo-x86-portage]
+#this entry is for compatibility
+path = /opt/gentoo-rsync/portage
+comment = Gentoo Linux Portage tree
+
+[gentoo-portage]
+#modern versions of portage use this entry
+path = /opt/gentoo-rsync/portage
+comment = Gentoo Linux Portage tree mirror
+exclude = distfiles
+
diff --git a/app-admin/gentoo-rsync-mirror/files/rsyncd.motd b/app-admin/gentoo-rsync-mirror/files/rsyncd.motd
new file mode 100644
index 000000000000..35950dd898dd
--- /dev/null
+++ b/app-admin/gentoo-rsync-mirror/files/rsyncd.motd
@@ -0,0 +1 @@
+This is rsync[number].[country].gentoo.org.
diff --git a/app-admin/gentoo-rsync-mirror/files/rsynclogparse-extended.pl b/app-admin/gentoo-rsync-mirror/files/rsynclogparse-extended.pl
new file mode 100644
index 000000000000..b0befc31c7ab
--- /dev/null
+++ b/app-admin/gentoo-rsync-mirror/files/rsynclogparse-extended.pl
@@ -0,0 +1,128 @@
+#!/usr/bin/env perl
+
+#
+# rsynclogparse-extended.pl, version 1.0
+# Script for producing daily or hourly stats from an rsync.log, in
+# plain text or XML output formats
+#
+# (C) Tim Haynes <gentoo@stirfried.vegetable.org.uk>, February 2003
+# Redistributable under the terms of the BSD licence
+# <http://www.opensource.org/licenses/bsd-license.php>
+#
+
+$|=1;
+
+#Determine whether we have a commandline option or not
+$arg="";
+$arg=shift
+ if $ARGV[0]=~/^-/;
+
+#Hash of variables to be output and descriptions
+%outputVars=(
+ "mirrorid" => "which mirror name this box is",
+ "contact" => "email address to contact the server administrator",
+ "read" => "total bytes read",
+ "wrote" => "total bytes served",
+ "total" => "total bytes both directions",
+ "count" => "number of connections",
+ "meanxfer" => "mean transfer size",
+ "biggestXfer" => "biggest individual transfer",
+ "speedupavg" => "mean speedup-a-like ratio for all conns",
+ "avgbandwidth" => "mean bandwith reequirement over 1d",
+ "interval" => "most recent n-seconds' worth of data",
+ "maxconns" => "number of times max-conns reached",
+ "percmaxconns" => "percentage of connections rejected",
+ "configmaxconns" => "max concurrent connections configured",
+ "timestamp" => "Current time these stats were generated"
+ );
+
+#Initialise all the above to 0
+map { $$_ =0 ; } keys %outputVars;
+
+#Set fields for this specific server
+$mirrorid="rsync1.uk.gentoo.org";
+$contact="gentoo\@stirfried.vegetable.org.uk";
+$configmaxconns=5;
+
+$timestamp=time();
+
+#Determine if we're doing a daily or hourly thing
+$interval=3600;
+$interval=2600*24
+ if $arg=~/d/;
+
+($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time);
+$now=dateToTstamp(sprintf("%04d/%02d/%02d %02d:%02d:%02d",
+ $year+1900, $mon+1, $mday, $hour, $min, $sec));
+
+
+#Read in all remaining files on commandline and stdin
+while (<>) {
+ chomp;
+
+ if (m#^((\d+)/(\d+)/(\d+) (\d+):(\d+):(\d+))#) {
+ $tstamp=dateToTstamp($1);
+ }
+
+ next # skip too-old log entries
+ if $tstamp < ($now-$interval);
+
+ $maxconns++
+ if /max connections .\d+. reached/oi;
+
+ /wrote (\d+) bytes.*read (\d+) bytes.*size (\d+)/oi
+ or next;
+
+ $wrote+=$1; #running total of outgoing
+ $read+=$2; #running total of incoming
+ $volumesize=$3; #total size of the volume, serversize
+ $localtotal=$1 + $2;
+ $speedupsum+=$volumesize/$localtotal; #running total of "speedup" ratios
+ $count++;
+ $biggestXfer=($localtotal>$biggestXfer)?$localtotal:$biggestXfer;
+}
+
+#Compute a few things
+$total=$read+$wrote;
+$speedupavg=$speedupsum/$count; #average speedup ratio
+$meanxfer=$total/$count; #mean-size xfer per connection
+$avgbandwidth=$total/$interval; #mean bandwith consumed over this interval
+$percmaxconns=100*$maxconns/($count+$maxconns);
+
+#Choice of output format
+$arg =~/xml/ ? &outputXML : &outputText;
+
+1;
+
+################
+
+sub outputText {
+ foreach $i ( keys %outputVars ) {
+ printf("%-20s: $$i\n", $i);
+ }
+}
+
+
+sub outputXML {
+ print "<xml>\n <rsyncstats>\n";
+ foreach $i ( keys %outputVars ) {
+ if ($arg=~/v/o) {
+ print " <$i desc=\"$outputVars{$i}\">$$i</$i>\n";
+ } else {
+ print " <$i>$$i</$i>\n";
+ }
+ }
+ print " </rsyncstats>\n</xml>\n";
+}
+
+
+sub dateToTstamp {
+ my $str=shift;
+
+ $str =~ m#^(\d+)/(\d+)/(\d+) (\d+):(\d+):(\d+)#;
+
+ $tstamp=$6 + 60*$5 + 3600*$4 + 3600*24*$3 +
+ 3600*24*31*$2 + 3600*24*365*($1-1975);
+
+ return $tstamp;
+}
diff --git a/app-admin/gentoo-rsync-mirror/gentoo-rsync-mirror-1.0-r5.ebuild b/app-admin/gentoo-rsync-mirror/gentoo-rsync-mirror-1.0-r5.ebuild
new file mode 100644
index 000000000000..f9643478717d
--- /dev/null
+++ b/app-admin/gentoo-rsync-mirror/gentoo-rsync-mirror-1.0-r5.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+DESCRIPTION="Ebuild for setting up a Gentoo rsync mirror"
+HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Infrastructure/Rsync"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 hppa ppc ppc64 sparc x86"
+IUSE=""
+
+S="${WORKDIR}"
+
+src_install() {
+ exeinto /opt/gentoo-rsync
+ doexe "${FILESDIR}"/rsync-gentoo-portage.sh
+ doexe "${FILESDIR}"/rsynclogparse-extended.pl
+ insinto etc/rsync
+ doins "${FILESDIR}"/rsyncd.conf
+ doins "${FILESDIR}"/rsyncd.motd
+ doins "${FILESDIR}"/gentoo-mirror.conf
+ dodir /opt/gentoo-rsync/portage
+}
+
+pkg_postinst() {
+ elog "The rsync-mirror is now installed into /opt/gentoo-rsync"
+ elog "The local portage copy resides in /opt/gentoo-rsync/portage"
+ elog "Please change /opt/gentoo-rsync/rsync-gentoo-portage.sh for"
+ elog "configuration of your main rsync server and use it to sync."
+ elog "Change /etc/rsync/rsyncd.motd to display your correct alias."
+ elog
+ elog "RSYNC_OPTS="--config=/etc/rsync/rsyncd.conf" needs"
+ elog "to be set in /etc/conf.d/rsyncd to make allow syncing."
+ elog
+ elog "The service can be started using /etc/init.d/rsyncd start"
+ elog "If you are setting up an official mirror, don't forget to add"
+ elog "00,30 * * * * root /opt/gentoo-rsync/rsync-gentoo-portage.sh"
+ elog "to your /etc/crontab to sync your tree every 30 minutes."
+ elog
+ elog "If you are setting up a private (unofficial) mirror, you can add"
+ elog "0 3 * * * root /opt/gentoo-rsync/rsync-gentoo-portage.sh"
+ elog "to your /etc/crontab to sync your tree once per day."
+ elog
+ elog "****IMPORTANT****"
+ elog "If you are setting up a private mirror, DO NOT sync against the"
+ elog "gentoo.org official rotations more than once a day. Doing so puts"
+ elog "you at risk of having your IP address banned from the rotations."
+ elog
+ elog "For more information visit: https://wiki.gentoo.org/wiki/Project:Infrastructure/Rsync"
+}
diff --git a/app-admin/gentoo-rsync-mirror/metadata.xml b/app-admin/gentoo-rsync-mirror/metadata.xml
new file mode 100644
index 000000000000..170d04b64261
--- /dev/null
+++ b/app-admin/gentoo-rsync-mirror/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>rgkmg25@gmail.com</email>
+ <name>Robert Kowalski</name>
+ <description>Proxied maintainer; set to assignee in all bugs</description>
+ </maintainer>
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+</pkgmetadata>