Project

General

Profile

Actions

Sites mirrors

OpenBSD

Scripts Irisa:

pandore|11:04:27|:~/Downloads/mirror$cat cvs-update-src.sh

#!/bin/bash
set -o nounset   # Treat unset variables as an error when performing parameter expansion and exits with a non-zero status.

rm -f ~/log.cvsup
touch ~/log.cvsup
echo "started at" `date +%H:%M:%S` >> ~/log.cvsup

# Pour plus de clarte/simplicite remplacement du "cd ftp/src"
# Le "ftp" etant un lien symbolique vers le "bon" espace
# cd ftp/src
REP="/home/ftp/pub/mirrors/OpenBSD/src"
if [ ! -d "${REP}" ] ;then echo "Erreur - Repertoire ""${REP}"" inexistant" >> ~/log.rsync; exit 1; fi
cd ${REP}


#
#
#
#export CVSROOT=anoncvs@anoncvs.ca.openbsd.org:/cvs
export CVSROOT=anoncvs@anoncvs.eu.openbsd.org:/cvs
#export CVSROOT=anoncvs@anoncvs.comstyle.com:/cvs
CVS_RSH="/usr/bin/ssh" cvs -d ${CVSROOT} -q update -AdP >> ~/log.cvsup 2>&1
chmod -R o+rX ${REP}
echo "ended at" `date +%H:%M:%S` >> ~/log.cvsup

cat ~/log.cvsup | mail -s "[ftp] cvs-update" your.email@domain.ext your.other.email@domain.ext

pandore|11:05:46|:~/Downloads/mirror$cat mirror.sh

#!/bin/bash
set -o nounset   # Treat unset variables as an error when performing parameter expansion and exits with a non-zero status.

# 
# Il y a deja un rsync qui "tourne" on n'en lance pas un nouveau
#
pgrep -u `id -u` rsync > /dev/null 2>&1
if [ $? = 0 ] ; then exit 0; fi

rm -f ~/log.rsync
touch ~/log.rsync
echo "started at" `date +%H:%M:%S` >> ~/log.rsync

# Pour plus de clarte/simplicite remplacement du "cd ftp"
# Ce "ftp" etant un lien symbolique vers le "bon" espace
# En plus c'est un peu plus "sure" dans le contexte d'un "rsync ... --delete ...." 
REP="/home/ftp/pub/mirrors/OpenBSD"
if [ ! -d "${REP}" ] ;then echo "Erreur - Repertoire ""${REP}"" inexistant" >> ~/log.rsync; exit 1; fi

#MIRROR=rsync://ftp.belnet.be/packages/openbsd/
#MIRROR=rsync://anga.funkfeuer.at/OpenBSD/
#MIRROR=rsync://rsync.it.su.se/OpenBSD/
#MIRROR=rsync://ftp.openbsd.dk/OpenBSD/
#MIRROR=rsync://rsync.de.openbsd.org/OpenBSD
MIRROR=rsync://ftp.eu.openbsd.org/OpenBSD/
#MIRROR=rsync://ftp.fr.openbsd.org/OpenBSD/

####################################
# identify last version available
####################################
echo "check for OpenBSD versions availables" >> ~/log.rsync 2>&1
major=5
minor=1
current_version=5.0
old_version=4.9
version_to_remove=4.8
wget --spider --quiet ftp://ftp.eu.openbsd.org/pub/OpenBSD/$major.$minor/
result=$?
while [ $result -eq 0 ]
do
  echo "version $major.$minor exits " >> ~/log.rsync 2>&1
  version_to_remove=$old_version
  old_version=$current_version
  current_version=$major.$minor
  minor=$(( $minor + 1 ))
  if [ $minor -eq 10 ]; then
        major=$(( $major + 1 ))
        minor=0
  fi
  wget --spider --quiet ftp://ftp.eu.openbsd.org/pub/OpenBSD/$major.$minor/
  result=$?
done
echo "current version to rsync = $current_version" >> ~/log.rsync 2>&1
echo "old version to rsync = $old_version" >> ~/log.rsync 2>&1
echo "version to remove if exist= $version_to_remove" >> ~/log.rsync 2>&1

cd ${REP}


rm -rfv $version_to_remove >> ~/log.rsync 2>&1

rsync -azv --delete ${MIRROR}/$current_version .       >> ~/log.rsync 2>&1

rsync -azv --delete ${MIRROR}/OpenBGPD .  >> ~/log.rsync 2>&1
rsync -azv --delete ${MIRROR}/OpenNTPD .  >> ~/log.rsync 2>&1
rsync -azv --delete ${MIRROR}/OpenSSH .   >> ~/log.rsync 2>&1
rsync -azv --delete ${MIRROR}/doc .       >> ~/log.rsync 2>&1
rsync -azv --delete ${MIRROR}/patches .   >> ~/log.rsync 2>&1
rsync -azv --delete ${MIRROR}/snapshots . >> ~/log.rsync 2>&1
rsync -azv --delete ${MIRROR}/timestamp . >> ~/log.rsync 2>&1
rsync -azv --delete ${MIRROR}/tools .     >> ~/log.rsync 2>&1
rsync -azv --delete ${MIRROR}/$old_version .       >> ~/log.rsync 2>&1

chmod -R o+rX ${REP}
echo "ended" `date +%H:%M:%S` >> ~/log.rsync

cat ~/log.rsync | mail -s "[ftp] rsync-mirror" your.email@domain.ext your.other.email@domain.ext

OPNSense

We’ve setup a rsync daemon for mirroring, it links directly to our publicly available files and is available at the following location:

rsync.opnsense.org::opnsense-dist

I tested it from our location using:

rsync -avz --delete --safe-links rsync.opnsense.org::opnsense-dist <target>

Ad: When it’s setup, just point me the location and I will update our website to list your mirror.

Updated by sacha about 6 years ago · 3 revisions