#!/bin/sh -x

load_module() {
	local mod
	mod=$1
	wget http://dagobah.ucc.asn.au/bah/$mod.ko
	insmod $mod.ko
	rm -f $mod.ko
}

cd /tmp
load_module sunrpc
load_module lockd
load_module nfs

cd /lib
wget http://dagobah.ucc.asn.au/bah/libnsl-2.3.4.so -O libnsl.so.1
wget http://dagobah.ucc.asn.au/bah/libwrap.so.0.7.6 -O libwrap.so.0

cd /bin
wget http://dagobah.ucc.asn.au/bah/portmap
wget http://dagobah.ucc.asn.au/bah/mount -O mount2
chmod 755 portmap
chmod 755 mount2

ifconfig lo inet 127.0.0.1 netmask 255.255.255.0 up
/bin/portmap

mkdir /target
mount2 -t nfs 130.95.13.7:/space/netboot/manduba /target

chroot /target bash /usr/local/sbin/upme

