#!/bin/sh
#
# HP SmartStart Toolkit Linux Edition
# Copyright 2002,2004 Compaq Information Technologies Group, L.P.
#
# bootstrap
#
##########updated#########
HOME=/root/compaq

PATH=$PATH:/usr/lib
export HOME PATH

# mount the proc filesystem
mount -n /proc /proc -t proc 1> /dev/null 2> /dev/null

# mount the usr.iso file
cd /
mount -o loop ${HOME}/compressed/usr.iso /usr/

echo "0 0 0 0" > /proc/sys/kernel/printk

echo ""

# Loading System Management Driver
/etc/init.d/hpasm start driver >/dev/null 2>/dev/null

echo "*** Setting up Network ***"
hostname smartstart 1> /dev/null 2> /dev/null
ifconfig lo up 127.0.0.1

## Network Setup ##
  ## load network drivers, you may need to change these lines to load the
  ## appropriate drivers
modprobe eepro100 1> /dev/null 2>/dev/null
sleep 1s
modprobe bcm5700 1> /dev/null 2>/dev/null
sleep 1s
modprobe e100 1> /dev/null 2>/dev/null
sleep 1s
## we can use ifconfig to statically set the IP address
## ifconfig eth0 10.7.90.201
## OR
## we can use dhcpcd to get a dynamic IP address <--preferred
/bin/dhcpcd
sleep 2s
ifconfig
sleep 2s


echo "*** Connecting to bootstrap NFS share ***"
mount -t nfs -o ro,nolock 10.7.90.120:/BOOTSTRAP /mnt/nfs_bootstrap
sleep 1s
mount | grep nfs
sleep 2s


## Create TOOLKIT workspace ##
cd /
mkdir /TOOLKIT
mount -t ramfs none TOOLKIT/



## Pull down first toolkit script from NFS share ##
echo "*** Getting toolkit_redirect.sh from bootstrap NFS share ***"
cp -a /mnt/nfs_bootstrap/toolkit_redirect.sh /TOOLKIT/
sleep 1s

## pass execution to toolkit script ##
if [ -e /TOOLKIT/toolkit_redirect.sh ]; then
        exec /TOOLKIT/toolkit_redirect.sh
else
        echo "ERROR: Could not find /TOOLKIT/toolkit_redirect.sh.  Check NFS mount /mnt/nfs_bootstrap on Target Machine OR NFS share /BOOTSTRAP on NFS Server."
        exec /bin/bash
fi


