	 kn t/t/by name         by name         BUILD           d   	kH      A                                                ./               A          A          
k꾝  m          l  p/~/r/   ,          l      ./lpp_name               m          m          4 R S bos.sysmgt {
bos.sysmgt.nim.spot 4.1.3.0 01 N U en_US Network Install Manager - SPOT
[
*prereq bos.sysmgt.nim.spot 4.1.1.0
%
/usr/lib/boot/network 40
/usr/lpp/SAVESPACE 40
/usr/lib/objrepos 8
INSTWORK 48 16
%
%
%
IX50489  325 AIX 4.1.3.0 Maintenance Level
4.1.3.0_AIX_ML  273 AIX 4.1.3.0 Maintenance Level
AIX41ML  326 Latest AIX 4.1 Maintenance Level
%
]
}
    	k\      A                                                ./usr            A          A          
k{      A                                                ./usr/lpp                A          A          k꒦      A                                                ./usr/lpp/bos.sysmgt/bos.sysmgt.nim.spot/4.1.3.0                 A          A          k  m             q/l/k/   ,                 ./usr/lpp/bos.sysmgt/bos.sysmgt.nim.spot/4.1.3.0/liblpp.a                m          m          <aiaff>
1544        0           68          1362        0           22          190         0           801272139   300         300         644         9   productid `
bos.sysmgt 5765-39300
269         582         68          801360240   300         300         644         29  bos.sysmgt.nim.spot.copyright `
 Licensed Materials - Property of IBM

 576539300
   (C) Copyright International Business Machines Corp. 1993, 1995.

 All rights reserved.
 US Government Users Restricted Rights - Use, duplication or disclosure
 restricted by GSA ADP Schedule Contract with IBM Corp.

   478         1180        190         802159467   300         300         644         29  bos.sysmgt.nim.spot.inventory `
/usr/lib/boot/network/rc.bos_inst:
          owner = root
          group = system
          mode = 555
          type = FILE
          class = apply,inventory,bos.sysmgt.nim.spot
          size = 4336
          checksum = "20122     5 "

/usr/lib/boot/network/rc.dd_boot:
          owner = root
          group = system
          mode = 555
          type = FILE
          class = apply,inventory,bos.sysmgt.nim.spot
          size = 11835
          checksum = "55404    12 "

67          1362        582         802159467   300         300         644         24  bos.sysmgt.nim.spot.size`
/usr/lib/boot/network 40
/usr/lpp/SAVESPACE 40
/usr/lib/objrepos 8
 69          1544        1180        802159467   300         300         644         22  bos.sysmgt.nim.spot.al`
./usr/lib/boot/network/rc.bos_inst
./usr/lib/boot/network/rc.dd_boot
 190         0           1362        0           0           0           0           0   `
5           68          190         582         1180        1362        productid bos.sysmgt.nim.spot.copyright bos.sysmgt.nim.spot.inventory bos.sysmgt.nim.spot.size bos.sysmgt.nim.spot.al kT K` m            k/|/n/   ,                ./usr/lib/boot/network/rc.bos_inst               m          m          # @(#)19  1.19  src/bos/usr/lib/boot/network/rc.bos_inst.sh, cmdnim, bos41J, 9521A_all 5/23/95 15:02:06
#
#   COMPONENT_NAME: CMDNIM
#
#   FUNCTIONS: SubSet
#		mount_from_list
#
#   ORIGINS: 27
#
#
#   (C) COPYRIGHT International Business Machines Corp. 1993, 1995
#   All Rights Reserved
#   Licensed Materials - Property of IBM
#   US Government Users Restricted Rights - Use, duplication or
#   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
#
# This script is to be run as a "dot" script from within rc.boot only.
# Function: BOS installation configuration on network booted machine.

# NOTE: Since the rc.diag file is very similar to this file, please check
# to see if changes made to either file are appropriate for the other.

mount_from_list()
{
${NIM_DEBUG}

	# Mount anything else from the info file
	# format of each stanza is:
	#		<hostname>:<remote dir>:<local mntpnt>
	if [ -n "${NIM_MOUNTS}" ]
	then
		${SHOWLED} 0x610
		OIFS="$IFS"
		for mount_args in ${NIM_MOUNTS}
		do
			IFS=':'
			set -- ${mount_args}
			IFS="$OIFS"

			# make sure local mount point exists
			if [ ! -d "${3}" ]
			then
				/SPOT/usr/bin/mkdir -p ${3} || loopled 0x611
			fi

			mount $1:$2 $3 || loopled 0x611

		done
	fi
}

SubSet()
{
set +x

# This function creates links for selected device types and classes.
# This provides a means to control which devices are configured, which
# saves time and system resources.  Links are from the remotely mounted
# filesystem which is mounted over /SPOT to the /usr/lib/methods directory.

for i in 3353c088 3353c188 3353c288 3353c388 8efc 8fba 8ff4 ascsi bbl colorgda \
	fd fda fga gga graygda hga hispd3d hscsi ide0 ide1 isa_keyboard \
	keyboard keyboard_2 kma lft ncr810 nep ppr pscsi s1a s1a_1 s1a_3 s2a \
	s2a_1 s2a_3 s3a_3 serdasda serdasdc sga sga sga_bus sio sio_1 sio_2 \
	sio_3 sys tty vscsi wfg wga
do
	odmget -q type=$i PdDv
done | egrep "Change|Configure" >/tmp/list1

for i in bus disk keyboard lvm tape
do
	odmget -q class=$i PdDv
done | egrep "Change|Configure|Define" >>/tmp/list1

odmget -q "uniquetype = adapter/mca/ppr and attribute = cfg_method_load" PdAt| \
	egrep "values" >> /tmp/list1

odmget -q "uniquetype like adapter/*sio/* and attribute = load_module" PdAt| \
        egrep "values" >> /tmp/list1

# sort it with unique option to prevent duplicates
sort -u /tmp/list1 |
	awk '$3 != "\"\"" {
		gsub(/"/, "", $3);
		gsub("/etc/", "/usr/lib/", $3);
		print "/SPOT" $3;
	}' > /tmp/list2

rm /tmp/list1
ln -fs $(cat /tmp/list2) /usr/lib/methods
rm /tmp/list2
}

##################### MAIN ########################
#
# -----------------------  PHASE ONE
#
${NIM_DEBUG}

case "$PHASE" in
	1)
	# update the Mstate
	/SPOT/usr/sbin/nimclient -S booting

	mount_from_list
	${SHOWLED} 0x622
set +x
	/SPOT/usr/bin/rm -fr /etc/init /usr/bin /usr/lib/drivers \
		/usr/lib/microcode /usr/lib/netsvc /usr/sbin

	/SPOT/usr/bin/ln -s /SPOT/usr/* /usr
	ln -fs /SPOT/usr/lib/!(libc.a|libs.a) /usr/lib
	ln -s /SPOT/usr/lib/boot/ssh /etc/init
${NIM_DEBUG}

	SubSet
	strload -f /dev/null
	cfgmgr -f -v
	${SHOWLED} 0x622
set +x
	# now link to the full databases
	ln -fs /usr/lib/objrepos/* /etc/objrepos
	ln -s /SPOT/usr/lib/methods/cfgcon /SPOT/usr/lib/methods/startlft \
		/SPOT/usr/lib/methods/starttty /usr/lib/methods
${NIM_DEBUG}
	SubSet
	export DEV_PKGNAME=ALL
	cfgmgr -s -v

	# do this link at the end of this phase because ksh has libs.a
	# open and we don't want multiple copies in memory at the same
	# time.  After this phase ends, init will restart ksh and ksh
	# will load the linked copy and the in-core copy will be removed
	#
	# we cannot do the same thing for libc.a because init has libc.a
	# open and init doesn't get restarted until phase 3 newroot
	ln -fs /SPOT/usr/lib/libs.a.min /usr/lib/libs.a

	${SHOWLED} 0x622
	;;

#
# -----------------------  PHASE TWO
#
	2)

set +x
	unset fd_invoker loopled
	shift $#

	rm -f /sbin/rc.boot

${NIM_DEBUG}

	# set TCP timeouts to reasonable values (default is 2 hours!!!)
	/SPOT/usr/sbin/no -o tcp_keepintvl=150
	/SPOT/usr/sbin/no -o tcp_keepidle=1200

	# the next three lines are only for testing.  for actual installs,
	# these three lines will be replaced by the exec of bi_main
#	/usr/lib/methods/cfgcon
#	PS1='RAMFS> '; export PS1
#	exec /usr/bin/ksh

	${SHOWLED} 0xfff
	exec /usr/lpp/bosinst/bi_main
	;;
esac
k L` m          ;.  k//n/   ,          ;.      ./usr/lib/boot/network/rc.dd_boot                m          m          # @(#)18  1.19.1.2  src/bos/usr/lib/boot/network/rc.dd_boot.sh, cmdnim, bos41B, 412_41B_sync 12/7/94 09:47:02
#
#   COMPONENT_NAME: CMDNIM
#
#   FUNCTIONS: make_dataless
#
#   ORIGINS: 27
#
#
#   (C) COPYRIGHT International Business Machines Corp. 1993, 1994
#   All Rights Reserved
#   Licensed Materials - Property of IBM
#   US Government Users Restricted Rights - Use, duplication or
#   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
#
# This script is to be run as a "dot" script from within rc.boot only.
# Function: diskless/dataless configuration

nim_status() {
	# update the "info" attribute on the NIM master
	/usr/sbin/nimclient -o change -a force=yes -a ignore_lock=yes -a info="$*"
}

fatal_error() {
	typeset led=${1}
	shift
	nim_status "${*:-fatal network boot error}"
	loopled ${led}
}

DEFAULT_DISK=hdisk0	# the default physical disk to use for local paging

make_dataless() {
${NIM_DEBUG}

	nim_status "creating a local paging device"
	${SHOWLED} 0x616
	[ -z "${DTLS_VG_DISK}" ] && DTLS_VG_DISK=${DEFAULT_DISK}
	# clear the ipl record on this disk
	mkboot -c -d /dev/${DTLS_VG_DISK}
	VGNAME=$(mkvg -f -d 8 ${DTLS_VG_DISK})
	[ $? != 0 ] && fatal_error 0x617 "mkvg failed on ${DTLS_VG_DISK}"
	varyonvg -n ${VGNAME}
	[ $? != 0 ] && fatal_error 0x617 "varyonvg failed for ${VGNAME}"
	syncvg -v ${VGNAME} &
	syncvg1_pid=$!
	cp /mnt/etc/swapspaces /etc
	[ $? != 0 ] && fatal_error 0x617 "copy of swapspaces failed"
	# if no page space is specified, default to the amount of real memory
	[ -z "${DTLS_PAGING_SIZE}" ] && \
		((DTLS_PAGING_SIZE=$(bootinfo -r)/4096))
	SWAP_DEV=$(mkps -s${DTLS_PAGING_SIZE} -n -a ${VGNAME})
	[ $? != 0 ] && fatal_error 0x617 "mkps failed on ${VGNAME}"
	cp /etc/swapspaces /mnt/etc/swapspaces
	[ $? != 0 ] && fatal_error 0x617 "restore copy of swapspaces failed"

	# initialize primary dump device
	ln -s /mnt/etc/objrepos/SWservAt* /etc/objrepos
	sysdumpdev -Pp /dev/$SWAP_DEV
	[ $? != 0 ] && fatal_error 0x617 "sysdumpdev failed"

	[ -n "${DTLS_LOCAL_FS}" ] && {
	# if this variable is not null, then we need to create /home
	# and/or /tmp.  Remember that the NFS /usr filesystem is mounted
	# over /usr, but that the NFS root filesystem is mounted over /mnt.
	# That is why we must copy /etc/filesystem to the ram filesystem
	# and then back.  This will only work for filesystems that already
	# have the mountpoints in the NFS root filesystem.
		nim_status "creating a local /home and/or /tmp"
		cp /mnt/etc/filesystems /etc
		cp /mnt/sbin/helpers/v3fshelper /sbin/helpers
		for fs in ${DTLS_LOCAL_FS}
		do
			case ${fs} in
				home)	FS_SIZE=8192;;
				tmp)	FS_SIZE=16384;;
				*)	continue;;
			esac
		crfs -v jfs -m /${fs} -g ${VGNAME} -A yes -p rw \
				-a size=${FS_SIZE}
		done
		cp /etc/filesystems /mnt/etc
	}

	# Copy LVM information to the hardfile
	cd /
	find /etc/vg -print | cpio -updmv /mnt
	[ $? != 0 ] && fatal_error 0x617 "failed to copy lvm info to hardfile"
	# Make sure we save base cust info
	[[ -s /etc/basecust ]] && cp /etc/basecust /mnt/etc/basecust

	# inform NIM that this has succeeded
	/usr/sbin/nimclient -R success
}

#
# -----------------------  PHASE ONE
#
${NIM_DEBUG}

case "$PHASE" in
	1)
	# update the Mstate
	ln -s /SPOT/usr/sbin/nimclient /usr/sbin/nimclient
	ln -s /SPOT/usr/bin/chmod /usr/bin/chmod
	ln -s /SPOT/usr/bin/alog /usr/bin/alog
	/usr/sbin/nimclient -S booting

set +x
	/SPOT/usr/bin/rm /lib /sbin/helpers/v3fshelper /usr/bin/tftp
	cp /SPOT/usr/sbin/rmdev /usr/sbin
	cp /SPOT/usr/bin/rm /usr/bin
	/SPOT/usr/bin/mkdir -p /lib/netsvc
	# we removed /lib, which was a symlink to /usr/lib, and replaced it
	# with a real directory.  now we populate that real directory with
	# hard links to the files in /usr/lib.  this enables us to access the
	# libraries in the RAM filesystem when /usr is overmounted.  This
	# is a good thing because we do not want to have multiple copies
	# of the same library loaded into memory during boot!
	ln /usr/lib/* /lib
	ln /usr/lib/netsvc/* /lib/netsvc
${NIM_DEBUG}
	${SHOWLED} 0x610
	mount ${ROOT} /mnt
	[ $? -ne 0 ] && \
		fatal_error 0x611 "unable to NFS mount the root directory at ${ROOT}"
	${SHOWLED} 0x612

	# copy the niminfo file into the root
	cp /SPOT/niminfo /mnt/etc/niminfo

	if [ -s /mnt/etc/basecust ]
	then
		cp /mnt/etc/basecust /etc
		cp /SPOT/usr/lib/boot/restbase /usr/sbin
		cp /SPOT/usr/bin/uncompress /usr/bin
 		SIBLING_DEVS=$(/SPOT/usr/bin/odmget \
			-q "name like ${PHY_BOOT_DEV%%*([0-9])}*" CuDv |
			/SPOT/usr/bin/fgrep name |/SPOT/usr/bin/cut -f2 -d \")
	fi
	ln /usr/sbin/mount /usr/sbin/umount
	ln /usr/sbin/mount /etc/umount
	nim_status "network boot phase 1"
	umount allr

	# unconfigure network services and devices and let cfgmgr do it the
	# right way.  this also resets device information to what it was
	# before the system was shutdown if /etc/basecust is non-null
	ifconfig ${LDEV} down
	ifconfig ${LDEV} detach
	ifconfig lo0 down

	# SIBLING_DEVS is defined only if /mnt/etc/basecust exists.  If basecust
	# does not exist, then we do not need to remove the boot device ODM data
 	for dev in ${SIBLING_DEVS}; do
 		rmdev -dl ${dev}
 	done

	rm -f /usr/sbin/rmdev
	route -f

	if [ -s /etc/basecust ]
	then
		restbase -o /etc/basecust
		rm -f /etc/basecust /usr/bin/restbase /usr/bin/uncompress
	fi

	# run config manager to configure only the network boot devices and
	# their parents.  we are limited to only those devices because the
	# boot RAM filesystem contains a subset of device configuration files
	cfgmgr -f -v

	# check the physical boot device name again, in case the basecust data
	# added an entry that conflicts with what was there before basecust
	PHY_BOOT_DEV=`bootinfo -b`
	pdev_to_ldev

	${SHOWLED} 0x606
	config_network
	case $? in
		1) fatal_error 0x607 "unable to configure the primary network interface";;
		2) fatal_error 0x613 "unable to add routes";;
	esac
	rm -fr /usr/lib/drivers /usr/lib/methods/!(showled) /usr/lib/microcode \
		/usr/sbin/cfgmgr /usr/sbin/ifconfig /usr/sbin/route
${NIM_DEBUG}

	LIBPATH=/lib; export LIBPATH

	${SHOWLED} 0x610
	mount -r ${SPOT} /usr
	[ $? -ne 0 ] && \
		fatal_error 0x611 "unable to NFS mount the SPOT at location ${SPOT}"
	strload -f /dev/null
	# run cfgmgr to configure remaining devices now that we have the
	# device support in /usr from the remotely mounted filesystem
	cfgmgr -f -v

	mount ${ROOT} /mnt
	[ $? -ne 0 ] && \
		fatal_error 0x611 "unable to NFS mount root directory at location ${ROOT}"

	# configure paging - local or NFS network

	# the grep searches for lines that do not have an asterisk as the
	# first character and contain "/dev".  the sed deletes the lines that
	# contain "swapnfs" and strips away all characters preceding the "/dev"
	local_swap=$(grep "^[^*].*/dev" /mnt/etc/swapspaces | \
		sed -e "/.*\/dev\/swapnfs.*/d; s/.*\(\/dev.*\)/\1/")

	# Start local paging
	if [ -n "$local_swap" ]
	then
		nim_status "configuring local paging device"
		for paging in $local_swap
		do
			${SHOWLED} 0x614
			# get the volume group name
			name=${paging##*/}
			vgname=$(odmget -qname=$name CuDv | \
				sed -n "s/.*parent *= *\"\(.*\)\"/\1/gp")
			if [ -z "$vgname" ]
			then
				${SHOWLED} 0x615
				continue
			fi

			# make the /dev entries which are found
			# in the client's root
			dev_vg=$(ls -l /mnt/dev/$vgname 2>/dev/null)
			if [ -n "$dev_vg" ]
			then
				if [ ! -c /dev/$vgname ]
				then
				# volume group not present yet
				# activate it

					# major number is field 5
					# minor is field 6
					set -- $dev_vg

					# remove the "," after
					# the major number
					major=$(echo $5 | sed -e "s/,//g")

					# make the /dev entry
					mknod /dev/$vgname c $major $6

					# varyon the volume group
					varyonvg -fn $vgname || ${SHOWLED} 0x615
					syncvg -v $vgname &
					syncvg2_pid=$!
				fi

				# make the paging device entry
				dev_ps=$(ls -l /mnt$paging)
				if [ -n "$dev_ps" ]
				then
					# major number is field 5
					# minor is field 6
					set -- $dev_ps

					# remove the "," after
					# the major number
					major=$(echo $5 | sed -e "s/,//g")

					# make the /dev entry
					mknod $paging b $major $6

					# check for local dump image
					# if present, upload it to the server
					BS=8192
					dump_info=/tmp/dump.info
					dump_mnt=/tmp/dump
					dump_file=${dump_mnt}/dump

					# is there a dump image to upload?
					sysdumpdev -z >${dump_info} 2>&1
					if [[ -n "${DUMP}" ]] && [[ -s ${dump_info} ]]
					then
						# dump info in this format:
						#		<total num bytes> <dump device>
						set -- $( cat ${dump_info} )
						num_bytes=${1}
						dump_device=${2}

						# how many blocks?
						(( num_blocks=num_bytes/BS ))
						(( (num_bytes%BS) > 0 )) && (( num_blocks=num_blocks+1 ))

						# mount the remote dump directory
						mkdir ${dump_mnt}
						if mount ${DUMP} ${dump_mnt}
						then
							# upload the dump image
							dd if=${dump_device} of=${dump_file} bs=${BS} \
								count=${num_blocks}

							unmount ${dump_mnt}
						fi
					fi

					# swapon the paging device
					swapon $paging || ${SHOWLED} 0x615
				else
					${SHOWLED} 0x615
				fi
			else
				${SHOWLED} 0x615
			fi

		done

		# Copy LVM information to the hardfile
		cd /
		find /etc/vg -print | cpio -updmv /mnt

	fi # local_swap

	# if the dataless conversion flag is set, call a function to do it
	[ -n "${NIM_MK_DATALESS}" ] && make_dataless

	remote_swap=$(grep "^[^*]remdev" /mnt/etc/swapspaces | \
		sed -e "s/.*= *\(.*\)/\1/")

	# Start NFS remote paging
	# configure the remote paging devices
	DEFAULT_IFS=$IFS
	for i in $remote_swap
	do
		nim_status "configuring remote paging device"
		${SHOWLED} 0x618
		IFS=':'
		set -- $i
		IFS=$DEFAULT_IFS
		SWAPHOST=$1
		SWAPFILE=$2
		SWAPDEV=${SWAPFILE##*/}

		if [ -z "$(odmget -qname=$SWAPDEV CuDv)" ]
		then
		# device doesn't exist - create it
			cat <<- EOF > /tmp/swapnfs
			CuDv:
			name = $SWAPDEV
			status = 0
			chgstatus = 1
			PdDvLn = swap/nfs/paging
			EOF

			odmadd /tmp/swapnfs

			# change the paging attributes
			/usr/lib/methods/chggen -l $SWAPDEV -a \
			"swapfilename=$SWAPFILE hostname=$SWAPHOST" || \
			${SHOWLED} 0x619
		fi

		/usr/lib/methods/cfgswpnfs -l $SWAPDEV || ${SHOWLED} 0x619
		swapon /dev/$SWAPDEV && RC=0 || ${SHOWLED} 0x619
	done # remote_swap

	${SHOWLED} 0x620

	# Copy special files to the hardfile
	/usr/lib/boot/mergedev

	# Copy ram disk repository customized data to disk
	cp /etc/objrepos/Cu* /mnt/etc/objrepos

	# copy the client's /etc/filesystems to the RAM filesystem
	cp /mnt/etc/filesystems /mnt/etc/hosts /etc

	# this prevents crashes if no paging was started.  Before paging
	# has been activated, every exec unloads libraries from memory.
	# After paging has been started, the libraries in memory are
	# not unloaded.  Therefore, in the event that paging does not
	# start, this copy of the minimum libs.a is needed for the shell.
	# NOTE: this cp fails if paging has been enabled, but that's ok.
	# it works if paging didn't start, and enables the boot to continue
	cp /usr/lib/libs.a.min /lib/libs.a

	# unmount all of the remote filesystems
	nim_status "network boot phase 2"

	# ensure we can access usr/lib after we mount the root.
	/usr/bin/ln -fs /../usr/lib /mnt/usr/lib

	wait $syncvg1_pid $syncvg2_pid

	/etc/umount -f allr
	;;

#
# -----------------------  PHASE TWO
#
	2)

	${SHOWLED} 0x610
	# change SHOWLED just in case the mount of / succeeds and the mount
	# of /usr fails because /usr will be empty
	SHOWLED=/../usr/lib/methods/showled; export SHOWLED
	mount -f -t dd_boot
	[ $? -ne 0 ] && fatal_error 0x611 "unable to mount -f -t dd_boot"

	slibclean	# clean up unused shared libraries
	SHOWLED=/usr/lib/methods/showled; export SHOWLED

	# set the client's hostname.  this makes NFS services happy.
	hostname ${NIM_HOSTNAME}

	${SHOWLED} 0x553

	nim_status "network boot phase 3"
	;;
esac
					k

	um libs.a is needed for the shell.
	# NOTE: this cp fails if paging has been enabled, but that's ok.
	# it works if paging didn't start, and enables the boot to continue
	cp /usr/lib/libs.a.min /lib/libs.a

	# unmount all of the remote filesystems
	nim_status "network boot phase 2"

	# ensure we can access usr/lib after we mount the root.
	/usr/bin/ln -fs /../usr/lib /mnt/usr/lib

	wait $syncvg1_pid $syncvg2_pid

	/etc/umount -f allr
	;;

#
# -----------------------  PHASE TWO
#
	2)

	${SHOWLED} 0x610
	# change SHOWLED just in case the mount of / succeeds and the mount
	# of /usr fails because /usr will be empty
	SHOWLED=/../usr/lib/methods/showled; export SHOWLED
	mount -f -t dd_boot
	[ $? -ne 0 ] && fatal_error 0x611 "unable to mount -f -t dd_boot"

	slibclean	# clean up unused shared libraries
	SHOWLED=/usr/lib/methods/showled; export SHOWLED

	# set the client's hostname.  this makes NFS services happy.
	hostname ${NIM_HOSTNAME}

	${S