#!/bin/ksh ################################################################################ # # A simple script for maintaining a current copy of OpenBSD. # For example, to just grab the latest release for a given # architecture: # # $ ./fetch_openbsd amd64 # # or to grab a specific release: # # $ ./fetch_openbsd amd64 4.4 # # or to grab the latest snapshot: # # $ ./fetch_openbsd amd64 snapshots # # Author: David C. Snyder - 09/05/2009 # ################################################################################ # # Please choose a mirror that's close to you # from http://www.openbsd.org/ftp.html#rsync # RSYNC_MIRROR=rsync://your.closest.mirror.here/OpenBSD/ ARCH=$1 REL=$2 if [ -z "$ARCH" ] then echo "Usage: $0 architecture [release]" exit 1 fi if [ -z "$REL" ] then REL=`lynx -nolist -dump http://www.openbsd.org/ 2>/dev/null | perl -ane '/ current release.*(\d+\.\d+)/ and do { print $1; "\n"; exit }'` fi if [ -z "$REL" ] then echo "Could not detect latest release from openbsd.org!" exit 2 fi PARTS=" doc ${REL}/${ARCH} ${REL}/packages/${ARCH} patches/${REL}/${ARCH} " for p in $PARTS do echo rsync -avhR --progress --delete-during ${RSYNC_MIRROR}$p . done | sh -x