#!/bin/sh # ~jhs/bin/.sh/distfiles_fetch by jhs@ echo "Warning: This may takes a week to run." echo "Warning: You may want to setenv IS_INTERACTIVE or BATCH." # See /usr/ports/Mk/* re IS_INTERACTIVE & BATCH echo "Warning: This will need maybe 50G free space while running." # If a backup of distfiles is running at the same time, # that will overflow, cd /pub/FreeBSD/dists || exit 1 echo "DU `pwd`" # DUMMY="echo" # Uncomment beginning of this line to comment out some lines below. # ${DUMMY} du -s * echo "Checking ports/ & ports/distfiles." # PORTSDIRS: # Releases for which we have complete ports/ # directory structures, & will do make fetch. PORTSDIRS="${PORTSDIRS} current" PORTSDIRS="${PORTSDIRS} 8.0-RELEASE" PORTSDIRS="${PORTSDIRS} 7.2-RELEASE" PORTSDIRS="${PORTSDIRS} 7.1-RELEASE" PORTSDIRS="${PORTSDIRS} 6.4-RELEASE" PORTSDIRS="${PORTSDIRS} 6.3-RELEASE" PORTSDIRS="${PORTSDIRS} 6.2-RELEASE" PORTSDIRS="${PORTSDIRS} 4.11-RELEASE" # Symbolic link so next for loop can treat current same as releases. if test -e /pri/FreeBSD/releases/current ; then #{ cd /pri/FreeBSD/releases/current || exit 1 rm -f ports ln -s /pri/FreeBSD/branches/`uname -m`/-current/ports ports if test ! -L /pri/FreeBSD/branches/i386/-current/ports ; then #{ ln -s /pri/FreeBSD/branches/i386/-current/686/-current/ports \ /pri/FreeBSD/branches/i386/-current/ports fi #} fi #} # Check all directories exist else exit. for i in ${PORTSDIRS} do #{ echo "$0 Loop Check Exist Start $i {" echo "Ensuring existence of /pri/FreeBSD/releases/$i/ports" cd /pri/FreeBSD/releases/$i/ports || exit 1 echo "Ensuring existence of /pri/FreeBSD/releases/$i/ports/distfiles" # Putting this in backets (cd distfiles || exit 1) # fails to catch error code on non existences, # so as distfiles is a symbolic link elsewhere, add a cd after. cd distfiles || exit 1 cd /pri/FreeBSD/releases/$i/ports || exit 1 echo "Ensuring /pri/FreeBSD/releases/$i/ports/.customise" # else if not customised, fetch may lock up. if test -f .customise ; then #{ echo OK else #}{ echo -n "Not customised, Run: " echo "`which customise` /pri/FreeBSD/releases/$i/ports $i" echo " (If $i=current, specify latest release eg `uname -r`)." exit 1 fi #} echo "$0 Loop Check Exist End $i }" done #} # Now Fetch. # ( No need to add code to fetch in reverse numeric order of releases, # (using something like echo ${PORTSDIRS} | sed -e 's/ /\n/' | sort -r ) # as reverse order comes from top of this script. ) for i in ${PORTSDIRS} do #{ echo "$0 Loop Fetch Start $i {" cd /pri/FreeBSD/releases/$i/ports || exit 1 /bin/pwd PORTSDIR=`pwd` ; export PORTSDIR echo "$0 Loop Fetch Batch Start $i {" ${DUMMY} nice make -k BATCH=YES fetch # -j 2 echo "$0 Loop Fetch Batch End $i }" # echo "$0 Loop Fetch Interactive Start $i {" # echo "Interactive" # More complete, but slower. # ${DUMMY} nice make -k INTERACTIVE=YES fetch # # Above, Do not add -j as it would get too confusing. # echo "$0 Loop Fetch Interactive End $i }" echo "$0 Loop Strip Start $i {" nice distfiles_cmpd echo "$0 Loop Strip End $i }" echo "$0 Loop Fetch End $i }" done #}