Subject: MASTER_SITE_OVERRIDE
To: None <tech-pkg@netbsd.org>
From: Andrew Brown <atatat@atatdot.net>
List: tech-pkg
Date: 03/15/2002 13:44:39
i wanted to reclaim some disk space on my laptop, so i moved *all* my
distfiles over to another machine that has more space, but is less
portable.  then i started reinstalling all my pkgs.  setting
MASTER_SITE_OVERRIDE makes this easier, since i can get the "still
current" tar balls from somewhere local instead of wasting time
downloading them all again.

but i don't want to try to get them from my home machine if i'm not at
home.  in fact, in some places, there are other "local repositories"
of tarballs that i can snarf from.  i came up with a solution and i
thought i'd share it, in case any of you can win from this.  in my
/etc/mk.conf file, in the BSD_PKG_MK section, i put this:

	__GATEWAY!=route -ns get default
	.if   (${__GATEWAY} == "172.17.42.12")
	MASTER_SITE_OVERRIDE=   ftp://duke/distfiles/
	.elif (${__GATEWAY} == "192.168.0.1")
	MASTER_SITE_OVERRIDE=   ftp://192.168.0.1/pub/distfiles/
	.elif (${__GATEWAY} == "10.100.1.125")
	MASTER_SITE_OVERRIDE=   ftp://10.100.1.42/pkgsrc/distfiles/
	.endif

yes, i number things strangely.  that's not the point.  caveat: the
the -s option to route has only been in -current since last october.
for releases and for -current for before that.  for those people

	__GATEWAY!=route -n get default | awk '$1=="gateway:"{print$2}'

ought to work fine.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."