From cc339d24ae2e4fc5d1b77e2cf4bfde16555eb431 Mon Sep 17 00:00:00 2001 From: "root@saturn" Date: Wed, 9 Dec 2015 21:23:55 +0100 Subject: [PATCH] init --- archlinux.sh | 13 +++++++++++++ ubuntu_archive_two_stage.sh | 36 ++++++++++++++++++++++++++++++++++++ ubuntu_releases.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100755 archlinux.sh create mode 100755 ubuntu_archive_two_stage.sh create mode 100755 ubuntu_releases.sh diff --git a/archlinux.sh b/archlinux.sh new file mode 100755 index 0000000..1ab69df --- /dev/null +++ b/archlinux.sh @@ -0,0 +1,13 @@ +#/bin/bash +#RSYNCSOURCE=rsync://ftp5.gwdg.de/pub/linux/archlinux/ +#RSYNCSOURCE=rsync://mirror.nl.leaseweb.net/archlinux/ +RSYNCSOURCE=rsync://mirror.one.com/archlinux/ + +# Define where you want the mirror-data to be on your mirror +BASEDIR=/store/mirror/archlinux + +rsync --verbose --recursive --times --links --hard-links \ + --stats --delete-after --ignore-errors \ + ${RSYNCSOURCE} ${BASEDIR} || echo "Failed to rsync from ${RSYNCSOURCE}." + +date diff --git a/ubuntu_archive_two_stage.sh b/ubuntu_archive_two_stage.sh new file mode 100755 index 0000000..f8852df --- /dev/null +++ b/ubuntu_archive_two_stage.sh @@ -0,0 +1,36 @@ +#/bin/dash + +fatal() { + echo "$1" + exit 1 +} + +warn() { + echo "$1" +} + +# Find a source mirror near you which supports rsync on +# https://launchpad.net/ubuntu/+archivemirrors +# rsync://.rsync.archive.ubuntu.com/ubuntu should always work +RSYNCSOURCE=rsync://no.archive.ubuntu.com/ubuntu/ +#RSYNCSOURCE=rsync://ftp.uninett.no/ubuntu/ + +# Define where you want the mirror-data to be on your mirror +BASEDIR=/store/mirror/ubuntu/archive/ + +if [ ! -d ${BASEDIR} ]; then + warn "${BASEDIR} does not exist yet, trying to create it..." + mkdir -p ${BASEDIR} || fatal "Creation of ${BASEDIR} failed." +fi + +rsync -4 --verbose --recursive --times --links --hard-links \ + --stats --chmod=a+rx \ + --exclude "Packages*" --exclude "Sources*" \ + --exclude "Release*" \ + ${RSYNCSOURCE} ${BASEDIR} || fatal "First stage of sync failed." + +rsync -4 --verbose --recursive --times --links --hard-links \ + --stats --delete --chmod=a+rx --delete-after \ + ${RSYNCSOURCE} ${BASEDIR} || fatal "Second stage of sync failed." + +date -u > ${BASEDIR}/project/trace/$(hostname -f) diff --git a/ubuntu_releases.sh b/ubuntu_releases.sh new file mode 100755 index 0000000..ac28b3d --- /dev/null +++ b/ubuntu_releases.sh @@ -0,0 +1,31 @@ +#/bin/dash + +fatal() { + echo "$1" + exit 1 +} + +warn() { + echo "$1" +} + +# Find a source mirror near you which supports rsync on +# https://launchpad.net/ubuntu/+cdmirrors +# rsync://.rsync.releases.ubuntu.com/releases should always work +#RSYNCSOURCE=rsync://se.rsync.releases.ubuntu.com/releases +#RSYNCSOURCE=rsync://ftp.uninett.no/ubuntu-iso +RSYNCSOURCE=rsync://ubuntu.uib.no/ubuntu-releases/ + +# Define where you want the mirror-data to be on your mirror +BASEDIR=/store/mirror/ubuntu/releases/ + +if [ ! -d ${BASEDIR} ]; then + warn "${BASEDIR} does not exist yet, trying to create it..." + mkdir -p ${BASEDIR} || fatal "Creation of ${BASEDIR} failed." +fi + +rsync --verbose --recursive --times --links --hard-links \ + --stats --delete-after \ + ${RSYNCSOURCE} ${BASEDIR} || fatal "Failed to rsync from ${RSYNCSOURCE}." + +date -u > ${BASEDIR}/.trace/$(hostname -f)