From a2586c923d0307ac3a5bb4803740991cad3dd2e5 Mon Sep 17 00:00:00 2001
From: Andreas Kempe <kempe@lysator.liu.se>
Date: Sat, 19 Dec 2020 01:27:47 +0100
Subject: [PATCH] hina: ftprsync: change fedora to default rsync script

There is no point in having a non-standard rsync script for Fedora since
they removed their mirror reporting function and scan us instead.
---
 files/hina/ftp-sync                    |   3 +-
 files/hina/ftprsync-config/epel.conf   |   1 +
 files/hina/ftprsync-config/fedora.conf |   1 +
 files/hina/ftprsync/ftprsync-fedora.sh | 135 -------------------------
 4 files changed, 4 insertions(+), 136 deletions(-)
 create mode 120000 files/hina/ftprsync-config/epel.conf
 create mode 100644 files/hina/ftprsync-config/fedora.conf
 delete mode 100755 files/hina/ftprsync/ftprsync-fedora.sh

diff --git a/files/hina/ftp-sync b/files/hina/ftp-sync
index 7f738b0..8f761e8 100644
--- a/files/hina/ftp-sync
+++ b/files/hina/ftp-sync
@@ -4,7 +4,8 @@ MAILTO=kempe@lysator.liu.se
 3	*/8	*	*	*	ftpowner	/usr/local/bin/ftprsync.sh rsync.monitoring-plugins.org plugins monitoring-plugins monitoring-plugins.rsync.lock monitoring-plugins
 5	*/2	*	*	*	ftpowner	/usr/local/bin/ftprsync.sh repo.manjaro.org repos manjaro manjaro.rsync.lock manjaro
 10	*/8	*	*	*	ftpowner	/usr/local/bin/ftprsync.sh ftp.eu.openbsd.org OpenBSD OpenBSD openbsd.rsync.lock openbsd
-15	*/4	*	*	*	ftpowner	/usr/local/bin/ftprsync-fedora.sh ftp-stud.hs-esslingen.de epel ftp-stud.hs-esslingen.de fedora
+15	*/4	*	*	*	ftpowner	/usr/local/bin/ftprsync.sh ftp-stud.hs-esslingen.de fedora fedora fedora.rsync.lock fedora
+15	*/4	*	*	*	ftpowner	/usr/local/bin/ftprsync.sh ftp-stud.hs-esslingen.de epel epel epel.rsync.lock epel
 20	*/4	*	*	*	ftpowner	/usr/local/bin/ftprsync-twostage.sh ftp.de.debian.org debian debian debian.rsync.lock debian
 23	*/4	*	*	*	ftpowner	/usr/local/bin/ftprsync-twostage.sh ftp.de.debian.org debian-backports debian-backports debian-backports.rsync.lock debian-backports
 35	*/8	*	*	*	ftpowner	/usr/local/bin/ftprsync.sh ftp.de.debian.org debian-cd debian-cd debian-cd.rsync.lock debian-cd
diff --git a/files/hina/ftprsync-config/epel.conf b/files/hina/ftprsync-config/epel.conf
new file mode 120000
index 0000000..669c7ab
--- /dev/null
+++ b/files/hina/ftprsync-config/epel.conf
@@ -0,0 +1 @@
+fedora.conf
\ No newline at end of file
diff --git a/files/hina/ftprsync-config/fedora.conf b/files/hina/ftprsync-config/fedora.conf
new file mode 100644
index 0000000..2a97182
--- /dev/null
+++ b/files/hina/ftprsync-config/fedora.conf
@@ -0,0 +1 @@
+RSYNC_FLAGS="-vaH --numeric-ids --delete --delete-delay --delay-updates"
diff --git a/files/hina/ftprsync/ftprsync-fedora.sh b/files/hina/ftprsync/ftprsync-fedora.sh
deleted file mode 100755
index f0323ea..0000000
--- a/files/hina/ftprsync/ftprsync-fedora.sh
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/bin/sh
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export PATH
-
-LOCKFILEDIR=/var/run/ftprsync/
-LOCALREPODIR=/var/ftp/pub/
-LOGFILEDIR=/var/log/ftprsync/
-LOGFILEPREFIX=
-LOCKFILE=
-RSYNCPROG=/usr/local/bin/rsync
-RSYNCCMD="-vaH --numeric-ids --delete --delete-delay --delay-updates"
-RSYNCSERV=
-RSYNCREPO=
-LOCALREPO=
-LOGFILE=
-RSYNCEXIT=
-EXTRAARGS=
-REPORTAPP=/usr/local/bin/report_mirror
-REPORTCONF=/usr/local/etc/report_mirror.conf
-LOGFILESUFFIX=`date +%Y-%m-%d_%H:%M:%S`.out
-
-
-if [ $# != 4 ]
-then
-    echo "usage: $0 epel-server epel-repo fedora-server fedora-repo" >&2
-    exit 1
-fi
-
-EPELSERV=$1
-EPELREPO=$2
-FEDORASERV=$3
-FEDORAREPO=$4
-
-create_lock () {
-	if [ -e $LOCKLFILEDIR/$1 ]
-	then
-		echo "lockfile exists, rsync already running (syncing $1)" >&2
-		return 1
-	fi
-	cp /dev/null $LOCKFILEDIR/$1
-	ret=$?
-	if [ $ret != 0 ]
-	then
-		echo "cannot create lockfile, check permissions (syncing $1)" >&2
-		return 1
-	fi
-	return 0
-}
-
-remove_lock () {
-	if [ -e $LOCKFILEDIR/$1 ]
-	then
-		rm $LOCKFILEDIR/$1
-		ret=$?
-		if [ $ret != 0 ]
-		then
-			echo "cannot remove lockfile, remove it by hand (synching $1)" >&2
-		fi
-	fi
-}
-
-create_log () {
-	cp /dev/null $LOGFILEDIR/$1.$LOGFILESUFFIX
-	ret=$?
-	if [ $ret != 0 ]
-	then
-		echo "cannot create logfile, check permissions (syncing $1)" >&2
-		return 1
-	fi
-	for file in `find $LOGFILEDIR -name "$1.*" | sort -n -r | tail +9`
-	do
-		rm $file
-	done
-	return 0
-}
-
-do_rsync () {
-	serv=$1
-	remote=$2
-	local=$3
-	logfile=$4
-	echo "$RSYNCPROG --log-file=$logfile $RSYNCCMD $serv::$remote $local/" > $logfile
-	for i in 1 2 3
-	do
-		$RSYNCPROG --log-file=$logfile $RSYNCCMD $serv::$remote $local/ > /dev/null 2>&1
-		ret=$?
-
-		/usr/local/bin/cache-flush.py $logfile $local
-
-		if [ $ret -eq 0 ]
-		then
-			return 0
-		else
-			echo "rsync of $local failed, exit code was $ret (attempt $i)" >&2
-			echo "last lines of $logfile is" >&2
-			echo "======================================="
-			tail -n 16 $logfile >&2
-			echo "======================================="
-			echo ""
-			echo "rsync failed, exit code was $ret (attempt $i)" >> $logfile
-		fi
-	done
-	echo "rsync of $local failed after three attempts" >&2
-	return 1
-}
-
-
-create_lock "epel.rsync.lock"
-ret=$?
-if [ $ret -eq 0 ]
-then
-	create_log "epel"
-	ret=$?
-	if [ $ret -eq 0 ]
-	then
-		do_rsync $EPELSERV $EPELREPO $LOCALREPODIR/epel $LOGFILEDIR/epel.$LOGFILESUFFIX
-	fi
-	remove_lock "epel.rsync.lock"
-fi
-
-create_lock "fedora.rsync.lock"
-ret=$?
-if [ $ret -eq 0 ]
-then
-	create_log "fedora"
-	ret=$?
-	if [ $ret -eq 0 ]
-	then
-		do_rsync $FEDORASERV $FEDORAREPO $LOCALREPODIR/fedora $LOGFILEDIR/fedora.$LOGFILESUFFIX
-	fi
-	remove_lock "fedora.rsync.lock"
-fi
-
-$REPORTAPP -c $REPORTCONF > /dev/null
-- 
GitLab