# An example showing the "proper" way to fast copy filesystems from
#  a master "golden" disk.
# Also showing how to do everything just in the mrconfig file.
version 1

# This logs to a remote host. You must use IP address, not hostname
loghost  10.62.51.110

# this is the normal way to setup a clean root disk.
# WARNING: Preparing to wipe the disk!
disksetup
partition dks0d1s0 standard root /

# the poor-man's nameserver
init echo "appending to miniroot hosts file..."
init echo "10.26.80.118	dist.domain.com dist" >> /etc/hosts
init echo "10.62.51.110	verthande.domain.com verthande" >> /etc/hosts
init echo "10.62.51.133	urthr.domain.com urthr" >> /etc/hosts
init echo "10.62.51.76	skuld.domain.com skuld" >> /etc/hosts

# Create the xfsdump-ed source by installing a target machine with
# the desired installation state. This would include the needed IRIX
# bits, plus any other applications, scripts, configurations, etc,
# created locally. Assume for the example that this is an Indy. Then
# the following commands will create the source for the xfsrestore:
#   dvhtool -v get sash /stand/sash
#   xfsdump -J - | compress > /other_disk/root.IP22.NEWPORT.Z
#   rcp /other_disk/root.IP22.NEWPORT.Z dist:/usr/dist
# (/other_disk just can't be on the filesystem which is getting xfsdump-ed).

preinst echo starting to xfsrestore filesystem: `date`
preinst rsh guest@dist cat /usr/dist/root.${SGI_CPUBOARD}.${SGI_GFXBOARD}.Z | uncompress | xfsrestore -J - /root
preinst echo finished xfsrestore-ing filesystem: `date`

# note that there is no "inst" section

# if the original filesystem contains all the valid IP address/hostname
# possibilities, then these 2 steps can be skipped.
postinst sed 's/192.0.2.1.*IRIS/'`nvram netaddr`" "`hostname`/ < /root/etc/hosts > /root/etc/hosts.N
postinst mv /root/etc/hosts.N /root/etc/hosts

# can't skip this one, or it will come up as the original host!
postinst echo `hostname` > /root/etc/sys_id

# the following command is very site- and network-dependent!
postinst echo netmask 0xffffff00 > /root/etc/config/ifconfig-1.options

### very important! ###
# make sure that /stand/sash is installed on the xfsdump source!
# otherwise the system will not boot!
postinst dvhtool -v creat /root/stand/sash sash /dev/rdsk/dks0d1vh
