SUMMARY: Scripting Jumpstart Client Additions

From: Steve Chapman <schapman_at_ejasent.com>
Date: Mon Feb 10 2003 - 23:10:04 EST
As usual, the people on this list came through magnificently!!  A few people
mentioned a few parameters in add_install_client that I didn't know about
and didn't read about in the book I had or from the Sun websites.  But a few
people (kind, generous souls) sent me their interactive scripts that set up
the JumpStart sessions for you!!  Since they were kind enough to share them
with me, I hope they will not mind that I have attached them for the rest of
the list, as well.  I ask that if you improve any of the scripts, you notify
the author so they may benefit from this vast pool of knowledge, as well.

From Beat Jucker [Beat.Jucker@glue.ch]: 
"Here you will find my two scripts for flash archive. Now it takes me just
10 minutes to install/configure a new client (I call it target). The scripts
are just for my personal use therefore the description is not as good as it 
could be.  Please let me know of any improvements." (Attachments
"v100_appl.mkconfig" and "v100_appl.finish")

Since I am trying to create one script that installs either Solaris 7 or 8,
I did not delve too deeply into the flash archive scripts, but I appreciate
Beat's help and hope that any improvements anyone else makes to his scripts
are shared with the group.

From Nicole Skyrca [NSkyrca@NaviSite.com]:
"  I wrote a script to prompt for these things.    I have included it here.
You will have to update some
things in it, such as build server name etc.  And please note that the
section about asking if the
machine is on a different subnet than the build server may not work
properly.  We have a build 
network, and we usually build all of our machines on that network, so I
haven't really tested it." (Attachment setup_for_Jumpstart)

This is the one I used, as it came in early and was written at a level that
I (a novice shell scripter, at best) could follow and understand.  I
modified this one a LOT for my own use (but I am attaching her original, as
well), and found it a great template for my purposes. Nicole's script also
contains many of the undocumented parameters I mentioned before.  Thank you,
Nicole!!

From Zaigui Wang [zaigui@yahoo.com]:
"I have been using this for a while, and it works
great. You just need to put those other components
together before you run it. Let me know if you have
questions." (Attachment jumpstart.txt)

Since this came in after Nicole's, and I was already well under way, I
didn't dive too deeply into this script, but from the cursory glance I took,
the error-checking of user entry is phenomenal, and I will be using portions
in my script eventually.

From Jeff Elliot [Jeff.Elliott@umb.com]:
"Here is what I have so far.   The GETCLUSTER function needs work so the
user can select the level of the OS install.  When I get some refinements in
place, I will forward them." (Attachment jumpstart_interactive)

Jeff's is also a great template.  After reviewing his code, I found mine
sloppy and lacking and had to refine mine to be a little more like his
before I could, in good conscience, share it with anyone.... 

Finally, here is my blatant theft of Nicole's script, which is hers with
some additional basic error-checking, add clients to /etc/ethers and
/etc/hosts, and create a custom sysidcfg file based on a template
(sysidcfg.orig); but without support for  anything other than Solaris 7 and
8 (although I haven't tested Solaris 7 yet...) (Attachments
Jumpstart_setup.sh and sysidcfg.orig)

Thank you again to everyone for their suggestions, assistance, and scripts!

Steve Chapman

[demime 0.99c.7 removed an attachment of type application/octet-stream which had a name of setup_for_jumpstart]

[demime 0.99c.7 removed an attachment of type application/octet-stream which had a name of v100_appl.finish]

[demime 0.99c.7 removed an attachment of type application/octet-stream which had a name of v100_appl.mkconfig]
~#!/bin/ksh
# addc -- add jumpstart client script

#define some constants 
JUMP="/export/jumpstart"
REVS="Solaris-8_0202 Solaris-9_0902"
NICS="hme0 qfe0 ge0 le0"
ARCHS="sun4u sun4m"
SERVER=""
SIP=""
SUBNET=""

# start questionaire
print ""
echo "Add jumpstart client"
echo "--------------------"
print ""

# get hostname 
while true; do
	echo "Hostname:\c"
	read HOST
	case $HOST in
		[0-9]*) ;;
		"");;
		*) break;;
	esac
done  

# get IP address. 
while true; do
	echo "IP address: \c"
	read IP
	case $IP in 
		+([0-9]).+([0-9]).+([0-9]).+([0-9]) ) break;;
		*);;
	esac
done

# get MAC address. 
while true; do
	echo "Ethernet address (MAC): \c"
	read MAC
	case $MAC in
		*(0)8:*(0)0:20:*:*:*) break;;
		*(0)0:*(0)0:c:*:*:*) break;;
		*);;
	esac
done

# get NIC type. Limited flexibility.
echo "Select NIC type:"
select NIC in $NICS; do
	if [[ ! "$REPLY" -gt "$(echo $NICS|wc -w)" ]]; then
		break
	fi
done

# get Architecture of client
echo "Select architecture:"
select ARCH in $ARCHS; do
	if [[ ! "$REPLY" -gt "$(echo $ARCHS|wc -w)" ]]; then
		break
	fi
done

# Which revision of Solaris 8?
echo "Which revision/update of Solairs 8 do you want to install?"
select REV in $REVS; do
	if [[ ! "$REPLY" -gt "$(echo $REVS|wc -w)" ]]; then
		break
	fi
done

# Now we know which image to use
IMAGES="/export/$REV"

# set up the sysidcfg file 
/bin/rm -rf ${JUMP}/sysidcfg/${HOST}
mkdir ${JUMP}/sysidcfg/${HOST}
cp ${JUMP}/sysidcfg/template ${JUMP}/sysidcfg/${HOST}/sysidcfg	

# get the network and default router, set up the server name
SUBNET=${IP%.*}
case $SUBNET in
	'xxx.xxx.208') SERVER=jumpstart-208
		      SIP=xxx.xxx.208.xxx;;
	'xxx.xxx.64' ) SERVER=jumpstart-64
		      SIP=xxx.xxx.64.xxx;;
		  * ) echo "invalid network!" && exit;;
esac

default_router=${SUBNET}.xxx

# add this host to the /etc/hosts file
egrep -v "$HOST|$IP" /etc/hosts > /tmp/hosts
cat /tmp/hosts > /etc/hosts
echo "$IP	$HOST" >> /etc/hosts
# clean up existing ether address (there may be host name change)
egrep -v "$HOST|$MAC" /etc/ethers > /tmp/ethers
cat /tmp/ethers > /etc/ethers

# fix the sydidcfg file
( echo "/name_server=/";echo "s/=/=${SERVER}(${SIP})/";
  echo "/interface=/";echo "s/=/=${NIC}/";
  echo "/default_route=/"; echo "s/=/=${default_router}/";
  echo "w";echo "w";echo "q" ) | \
  ed -s "${JUMP}/sysidcfg/${HOST}/sysidcfg" > /dev/null

# Done collecting data. Now processing
echo "Processing data ... Please wait."
args="-e $MAC -i $IP -c ${SERVER}:${JUMP} \
      -p ${SERVER}:${JUMP}/sysidcfg/${HOST} $HOST $ARCH"
echo ${IMAGES}/Solaris*/Tools/add_install_client $args
${IMAGES}/Solaris*/Tools/add_install_client $args


[demime 0.99c.7 removed an attachment of type application/octet-stream which had a name of sysidcfg.orig]

[demime 0.99c.7 removed an attachment of type application/octet-stream which had a name of Jumpstart_setup.sh]
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Mon Feb 10 23:17:31 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:03 EST