summaryrefslogtreecommitdiff
path: root/app-admin/gentoo-rsync-mirror
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-admin/gentoo-rsync-mirror
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-admin/gentoo-rsync-mirror')
-rw-r--r--app-admin/gentoo-rsync-mirror/Manifest7
-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.xml12
8 files changed, 246 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..a57febeafe89
--- /dev/null
+++ b/app-admin/gentoo-rsync-mirror/Manifest
@@ -0,0 +1,7 @@
+AUX gentoo-mirror.conf 467 BLAKE2B 7648f30259d97cc86297952bb63b445e3a1092e61aedf8ad44a6ec330c5ec81d544501f3e4e2c7adc71de8f5a1527813408a1c679710c5313c8f6eb68415c020 SHA512 9850e862b1795644bc376eef485bcfde8d72e06f40e587cf373e257a95383b95b64217263de62a92a8bc5b2b55adaea108d609803f71d708591b0d4ecdfed6ae
+AUX rsync-gentoo-portage.sh 332 BLAKE2B 1f060ffdb7b7a1116875804053e80896d36dad311c62b35c4d21023e79e46fe840dbac934692f1e549d81353cbc9319b15c9f971a44f31a8818e695c6dbb4da3 SHA512 588ea9757167ae5baa72a0542d723be8ae574e3ad487f1ab260de2a419f0d36d29fa2a0c80924292a81f2a69e325fa08729008964de24e0b01189b1e9a04618b
+AUX rsyncd.conf 611 BLAKE2B 2842f2fe86d3d84e6385d979337a523db12fa8f39316652d2cc0151431e033d7832d5299ec49e0fedd4d55e9faf67014ca32cf020f13adda5143b340f5f8988b SHA512 11af716d1741d482f11ec9a9a2d5edbf4c3c0bacd7ed357588f2a8398d313d47de880ae5c38f40ce940259cb741cd7695eab42249ca10e05c3f2654581ffc791
+AUX rsyncd.motd 44 BLAKE2B 764e92b05ece7c7c114106e3cb634cce9383b96b7e076b2cc95217aba5eff6a849e32da1acd2d1cb34316b81701ecf4c7b09bc304e43eff992014128048170bf SHA512 812c0e738274222e65e5bc57379ebc6150c232cd8bf98e72b500763828bfcfa45fb8e89c7cccd5e34685f4e5d4787d9cd2ab03ace64bc76f5c5416deb03c17f3
+AUX rsynclogparse-extended.pl 3476 BLAKE2B 230fc0a15cb5341f3bbf1455b86e5bd0a92bd12eaf5d8ece373bfcac0d1b45b310b0a3194d2200676b351e5b5931be51319801b1e5df87cb7d41c799447dca8a SHA512 60656deb0e501c51c4a37d2f9cce2829faea830ae42d1f33db52f37b337b71a125b7d350e893fb6098b405e1439cbde160d9e7ecda3ebd8a8f8c34b84acf80b3
+EBUILD gentoo-rsync-mirror-1.0-r5.ebuild 1980 BLAKE2B dcf660571e295a379908b47c50fc8a171035e01435456669796ef5ccf159ff165e10c692b4018dc3582d2123651a633b7abd394df5afac83f3621004ef778e0d SHA512 b4ac3ad7600cd26c68cea2952991b7b07d39e4361b34bcd7e676a4f4e9ac3d1a8f2ec190fee8d1966b6400858b4bbea83c386a38a84489f9231cb2118334ba58
+MISC metadata.xml 365 BLAKE2B e228fe06455e1d2619852d44b50a114e425c0cd1027877b01a4920186d50a6ee1ca39742f75d33cc3ea6fc7bc45744c9c0667582881534793090c974cfa8be72 SHA512 7fce97c62f40d7472b6fedb12be020aa53037a4049885c1ec6c2735b419b3f40462a848360fb33db65aedf2b829d491f2fa521b82ac158b1d15cec115b524115
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..45969df9b143
--- /dev/null
+++ b/app-admin/gentoo-rsync-mirror/metadata.xml
@@ -0,0 +1,12 @@
+<?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>
+ </maintainer>
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+</pkgmetadata>