[wplug] kickstart config redhat 8.0

Vanco, Donald VANCOD at PIOS.com
Wed Mar 5 09:38:03 EST 2003


James O'Kane wrote:
> On Tue, 4 Mar 2003, Vanco, Donald wrote:
> 
>> James O'Kane wrote:
>>> On Mon, 3 Mar 2003, John Harrold wrote:
>>> 
>>>> Sometime in March James O'Kane assaulted the keyboard and produced:
>>>> 
>>>>> You could put something in %post that takes the current IP and
>>>>> gets the hostname from that and modifies /etc/sysconfig/network
>>>> 
>>>> yeah i thought about that, but i was hoping there was something
>>>> better :). 
>>>> 
>>>> do you know of where i can get the output of the post install
>>>> script in case something fails and i can then debug it.
>>> 
>>> 
>>> It's been a while, but if I remember right, if you dont' specify
>>> 'reboot' in the ks.cfg, it will wait at the end for you to hit
>>> enter. Switch to <alt><F3> or <F4> I think that's where the output
>>> goes. 
>> 
>> 	While certainly an option, "interacting" with a kickstart install
>> pretty much defeats the purpose.
> 
> He specifically asked where the output when so he could debug it.
> That is a different case than the normal mass install phase. If he
> sets 'reboot' then the output would be gone.

	Oh - in that case.......  There's still _no need_ to interact with
the console - it all gets logged to ~/install.log.syslog.  Actually -
there's more in there (relating to the kickstart install) than you'll see on
any of the VCs

	If you're kickstart file is "good" - the install will work.  If
you've horked something badly in %pre or %post the installer may or may not
halt and give you error messages (ferinstance -syntax errors in %post).
That's why install.log.syslog exists - because there may not be any useful
information on the console if you don't specifically call for it.

	Check out my example below - debugging without the system logger
would be virtually impossible!

Don



#Generated by Kickstart Configurator  NOT!

#System language
lang en_US

#Language modules to install
langsupport --default en_US en_US 

#System keyboard
keyboard us

#System mouse
mouse --emulthree generic3usb

#System timezone
timezone --utc America/Los_Angeles

#Root password
rootpw --iscrypted $1$7Òj3ÏüíÝ$K82/M7G1J2zL1KsrtIqSx/

#Reboot after installation
reboot

#Use text mode install
text

#System bootloader configuration
bootloader --useLilo --linear --location=mbr 

#Install Red Hat Linux instead of upgrade
install

#Use NFS installation media
nfs --server 192.168.168.230 --dir /install/rh73

#Clear the Master Boot Record
zerombr yes

#Clear all partitions from the disk
clearpart --all 

#Disk partitioning information
part /boot --fstype ext3 --size 50 --ondisk /dev/hda 
part / --fstype ext3 --size 1024 --ondisk /dev/hda 
part  swap --size 4096 --ondisk /dev/hda 
part /scr --fstype ext3 --size 1 --grow --ondisk /dev/hda 
part /var --fstype ext3 --size 1024 --ondisk /dev/hda 

#Use DHCP networking
network --bootproto dhcp

#System authorization information
auth  --useshadow  --enablemd5 

#Firewall configuration
firewall --disabled 

#Do not configure the X Window System
skipx

%packages
@X Window System
@Network Support
@Network Managed Workstation
@Utilities
@Legacy Application Support

%pre

	

%post
#
# Set variables
#
# MIP = Management IP (IP)
# TIP = Time Server (IP)
# NFS = NFS Server (IP)
# NAMESERVERS = list of , delimited name servers (IP)
# MAPPERHOST = host to start GM active mapper (NAME)
# MASTERNAME = master server (NAME)
# DNSDOMAIN = domain name (NAME)
# NISDOMAIN = master NIS domain (NAME)
# GKHFILE = path to SSH gkh file (PATH)
#
MIP=192.168.168.230
TIP=192.168.168.230
NFS=192.168.168.230
NAMESERVERS=192.168.168.230
MAPPERHOST=192.168.168.230
MASTERNAME=prometheus
DNSDOMAIN=odyssey.com

GATEWAY=$(netstat -rn | grep 0.0.0.0 | tail -1 | awk '{print $2}')
netstat -rn | logger
GKHFILE=/install/post/.ssh
#SERIAL=#SERIAL#
TFTPXCATROOT=/opt/xcat/
TFTPDIR=tftpboot
TFTP_IP=192.168.168.230
POST_DIR=/install
#INSTALL_ROLL=#INSTALL_ROLL#
#ACCT=#ACCT#
#GM=#GM#
#GPFS=#GPFS#
#PBS=#PBS#
#RSH=#RSH#
#USERMASTER=#USERMASTER#
TIMESERVERS=192.168.168.230
NODETYPE=compute73
#RESNAME=#RESNAME#
#XCATPREFIX=#XCATPREFIX#
#PBSSERVER=192.168.168.230
#RSHC=#RSHC#
#ACCESS=#ACCESS#
#USENIS=#USENIS#
#NISMASTER=#NISMASTER#
#NISSLAVES=#NISSLAVES#
#INSTALL_DIR=#INSTALL_DIR#
#USERNODES=#USERNODES#
#CHKSUM=#CHKSUM#
#GMVER=1.5.2.1_Linux
#KERNELVER=2.4.18-3
#KERNELVER=2.4.18-10smp
#KERNELVER=2.4.18-10gpfs.p3
KERNELVER=2.4.18-24.7.xbigmem
#MYRIMASK=255.255.0.0
HOMEFS=/home
LOCALFS=/usr/local
XCATFS=/opt/xcat
XCATDIR=$(echo $XCATFS | awk -F: '{print $2}')
export MIP TIP NFS NAMESERVERS MAPPERHOST MASTERNAME DNSDOMAIN
export GATEWAY GKHFILE SERIAL TFTPXCATROOT
export TFTP_IP POST_DIR
export KERNELVER

# Setup Syslog
#
# Turn syslog so we can use logger to send messages to syslogd running on a
# management node. Use logger.
#
mv /etc/syslog.conf /etc/syslog.conf.ORIG
echo "*.*	@$MIP" >/etc/syslog.conf
/etc/rc.d/init.d/syslog start
logger "Install: syslog setup"

 # Mount /post
#
logger "Install: mounting /post"
mkdir /post 2>&1 | logger
mount -r -o nolock $NFS:$POST_DIR /post 2>&1 | logger

#
# Hardcode eth0 (optional, recommended)
#
logger "Install: setting up eth0"
IP0=$(ifconfig eth0 | grep inet | awk '{print $2}' | awk -F: '{print $2}')
BC0=$(ifconfig eth0 | grep inet | awk '{print $3}' | awk -F: '{print $2}')
SM0=$(ifconfig eth0 | grep inet | awk '{print $4}' | awk -F: '{print $2}')
cd /etc/sysconfig/network-scripts
cp ifcfg-eth0 ifcfg-eth0.ORIG
echo "DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPADDR=$IP0
BROADCAST=$BC0
NETMASK=$SM0" >ifcfg-eth0

mv /etc/resolv.conf /etc/resolv.conf.ORIG
echo "search $DNSDOMAIN" >/etc/resolv.conf
for i in $(echo $NAMESERVERS | tr ',' ' ')
do
	echo "nameserver $i"
done >>/etc/resolv.conf

HOSTNAME=$(host $IP0 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}')
cp /etc/sysconfig/network /etc/sysconfig/network.ORIG
echo "NETWORKING=yes
HOSTNAME=$HOSTNAME
GATEWAYDEV=eth0
GATEWAY=$GATEWAY" >/etc/sysconfig/network
if [ "$NISDOMAIN" != "NA" ]
then
	echo "NISDOMAIN=$NISDOMAIN" >>/etc/sysconfig/network
fi

#
# Setup eth1
#
logger "Install: setting up eth1"
#cd /etc
#echo "alias eth1 eepro100" >>modules.conf
cd /etc/sysconfig/network-scripts
cp ifcfg-eth1 ifcfg-eth1.ORIG
echo "DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes" >ifcfg-eth1
chmod 755 ifcfg-eth*

#
# Setup hosts
#
echo "Install: setting up /etc/hosts"
echo "127.0.0.1	localhost

$IP0	$HOSTNAME	$HOSTNAME.$DNSDOMAIN
$MIP	$MASTERNAME	$MASTERNAME.$DNSDOMAIN" >/etc/hosts

# Add users (optional)
#
# perl -e 'print crypt("netfinity","Xa") . "\n";'p
#
# where "netfinity" is the password.
#
#logger "Install: adding users"
#adduser admin -u 1000 -p Xafi1q7Up9JG6

# Update RPMS
#
if [ -d /post/updates/rh73 ]
then
#	logger "Install: Update RPM RPMS"
	cd /post/updates/rh73
#	rpm -Uivh --force --nodeps db3* 2>&1 | logger
#	rpm -Fvh rpm* 2>&1 | logger
#	logger "Install: Update RPMS, rebuilding RPM db"
#	rpm --rebuilddb 2>&1 | logger
	logger "Install: Update RH7.3 RPMS"
#	rpm -Uivh --force --nodeps openssl* 2>&1 | logger
#	rpm -Fvh --force --nodeps * 2>&1 | logger
	rpm -Fvh --nodeps $(ls *.rpm | egrep -v '^(kernel-)') 2>&1 | logger
	rpm -ivh kernel-bigmem-2.4.18-24.7.x.i686.rpm
	rpm -ivh kernel-smp-2.4.18-24.7.x.i686.rpm
	rpm -ivh kernel-2.4.18-24.7.x.i686.rpm
fi

#
# Install more rpms
#
if [ -d /post/rpm73 ]
then
	logger "Install: installing rpms"
	cd /post/rpm73
	for i in *.rpm
	do
		logger "Install: installing rpm $i"
		rpm -ivh --force --nodeps $i 2>&1 | logger
	done
fi

#
# Install tarballs (.tgz, .tar.gz, .tar.Z, .tar)
#
# tarballs must have a file.path with the full path to extrace tarball
#
# e.g. blah.tgz, blah.path where cat blah.path = /usr/local
# blah.tgz will be extracted into /usr/local
#
if [ -d /post/tarballs ]
then
	logger "Install: installing tarballs"
	cd /post/tarballs
	for i in *.path
	do
		if [ -r $i ]
		then
			cd $(cat $i)
		fi
		if [ "$?" = "1" ]
		then
			logger "Install: could not cd to $(cat $i)"
		else
			if [ -r /post/tarballs/${i%%.path}.tgz ]
			then
				logger "Install: installing tarball
${i%%.path}.tgz"
				tar zxf /post/tarballs/${i%%.path}.tgz 2>&1
| logger
			fi
			if [ -r /post/tarballs/${i%%.path}.tar.gz ]
			then
				logger "Install: installing tarball
${i%%.path}.tar.gz"
				tar zxf /post/tarballs/${i%%.path}.tar.gz
2>&1 | logger
			fi
			if [ -r /post/tarballs/${i%%.path}.tar.Z ]
			then
				logger "Install: installing tarball
${i%%.path}.tar.Z"
				tar Zxf /post/tarballs/${i%%.path}.tar.Z
2>&1 | logger
			fi
			if [ -r /post/tarballs/${i%%.path}.tar ]
			then
				logger "Install: installing tarball
${i%%.path}.tar"
				tar xf /post/tarballs/${i%%.path}.tar 2>&1 |
logger
			fi
		fi
	done
fi

#
# New Kernel
#
BRPM=$(echo $KERNELVER | sed 's/smp//')
echo $KERNELVER | grep smp >/dev/null 2>&1
if [ "$?" = "0" ]
then
	KRPM="kernel-smp-$BRPM.i686.rpm"
else
	KRPM="kernel-$KERNELVER.i686.rpm"
fi
if [ -r /post/updates/rh73/$KRPM ]
then
	logger "Install: installing new RPM kernel"
	cd /
	rpm -ivh --force --nodeps /post/updates/rh73/$KRPM 2>&1 | logger
#	rpm -Fvh --force --nodeps
/post/updates/rh73/kernel-headers-$BRPM.i386.rpm 2>&1 | logger
	rpm -Fvh --force --nodeps
/post/updates/rh73/kernel-source-$BRPM.i386.rpm 2>&1 | logger
	rpm -Fvh --force --nodeps
/post/updates/rh73/kernel-doc-$BRPM.i386.rpm 2>&1 | logger
	ROOTDEV=$(grep root /etc/lilo.conf | tail -1 | awk '{print $1}')
	cp /etc/lilo.conf /etc/lilo.conf.ORIG
	echo "
image=/boot/vmlinuz-$KERNELVER
	label=xCAT" >>/etc/lilo.conf
if [ -r /boot/initrd-$KERNELVER.img ]
then
	echo "	initrd=/boot/initrd-$KERNELVER.img" >>/etc/lilo.conf
fi
echo "	read-only
	$ROOTDEV" >>/etc/lilo.conf
	cp /etc/lilo.conf /etc/lilo.conf.SAVE
	sed 's/default=.*/default=xCAT/' </etc/lilo.conf.SAVE
>/etc/lilo.conf
	ln -s -f /boot/System.map-$KERNELVER /boot/System.map
	if lilo 2>&1
	then
		:
	else
		cat /etc/lilo.conf
	fi | logger
#	logger "Install: setting up e1000"	#eepro100-e1000
#	perl -pi -e 's/eepro100/e1000/g' /etc/modules.conf
#eepro100-e1000
fi

if [ -r /post/kernel/kernel-$KERNELVER.tgz ]
then
	logger "Install: installing new kernel"
	cd /
	tar zxvf /post/kernel/kernel-$KERNELVER.tgz
	ROOTDEV=$(grep root /etc/lilo.conf | tail -1 | awk '{print $1}')
	cp /etc/lilo.conf /etc/lilo.conf.ORIG
	echo "
image=/boot/vmlinuz-$KERNELVER
	label=xCAT" >>/etc/lilo.conf
if [ -r /boot/initrd-$KERNELVER.img ]
then
	echo "	initrd=/boot/initrd-$KERNELVER.img" >>/etc/lilo.conf
fi
echo "	read-only
	$ROOTDEV" >>/etc/lilo.conf
	cp /etc/lilo.conf /etc/lilo.conf.SAVE
	sed 's/default=linux/default=xCAT/' </etc/lilo.conf.SAVE
>/etc/lilo.conf
	ln -s -f /boot/System.map-$KERNELVER /boot/System.map
	if lilo 2>&1
	then
		:
	else
		cat /etc/lilo.conf
	fi | logger
#	logger "Install: setting up e1000"	#eepro100-e1000
#	perl -pi -e 's/eepro100/e1000/g' /etc/modules.conf
#eepro100-e1000
	rm -f /dev/perfctr
	mknod /dev/perfctr c 10 182
	chmod 644 /dev/perfctr
	echo "#!/bin/bash
echo \"Loading Qlogic (qla2200) driver from qlogic.com...\"
/sbin/insmod qla2200
echo \"Loading Performance Counters (perfctr) driver...\"
/sbin/insmod perfctr" >>/etc/rc.modules
	chmod 755 /etc/rc.modules
fi

#
# Setup GPFS
#
if [ "$GPFS" = "Y" ]
then
	if [ -d /post/gpfs ]
	then
		cd /post/gpfs
		echo "Install GPFS" | logger
		echo "/sbin/insmod sg" >>/etc/rc.modules
		chmod 755 /etc/rc.modules
		echo "options scsi_mod max_scsi_luns=255"
>>/etc/modules.conf
		/sbin/mkinitrd -f /boot/initrd-$KERNELVER.img $KERNELVER
		/sbin/lilo 2>&1 | logger
		if [ -r mmsdrfs ]
		then
			mkdir -p /var/mmfs/gen 2>&1 | logger
			chmod 755 /var/mmfs /var/mmfs/gen 2>&1 | logger
			cp -f mmsdrfs /var/mmfs/gen 2>&1 | logger
		fi
		rpm -Uivh src-*.i386.rpm 2>&1 | logger
		rpm -Uivh rsct.core.utils-*.i386.rpm 2>&1 | logger
		rpm -Uivh rsct.core-*.i386.rpm 2>&1 | logger
		rpm -Uivh rsct.basic-*.i386.rpm 2>&1 | logger
		rpm -Uivh gpfs.*.rpm 2>&1 | logger
		cp -f gpfs.sh /etc/profile.d 2>&1 | logger
		cp -f gpfs.csh /etc/profile.d 2>&1 | logger
		if [ -r mmfslinux-$KERNELVER ]
		then
			cp -f mmfslinux-$KERNELVER
/usr/lpp/mmfs/bin/mmfslinux 2>&1 | logger
		fi
		cd -
		perl -pi -e
's!src::respawn:/sbin/srcmstr!src:2345:respawn:/sbin/srcmstr!' /etc/inittab
		mkdir /tmp/mmfs
	fi
fi

#
# Setup GM
#
if [ "$GM" = "Y" ]
then
	if [ -r /post/kernel/gm-$GMVER-$KERNELVER.i686.rpm ]
	then
		rpm -i --force /post/kernel/gm-$GMVER-$KERNELVER.i686.rpm
	else
		logger "Install: /post/kernel/gm-$GMVER-$KERNELVER.i686.rpm
not found! Setting up Myrinet anyway."
	fi
	MYRINET=$(
		host ${HOSTNAME}-myri0 2>/dev/null | \
		grep address | \
		awk '{print $4}'
	)
	if [ -n "$MYRINET" ]
	then
		logger "Install: setting up myri0 ip $MYRINET"
		cd /etc
		echo "alias myri0 gm" >>modules.conf
		cd /etc/sysconfig/network-scripts
		echo "DEVICE=myri0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPADDR=$MYRINET
NETMASK=$MYRIMASK" >ifcfg-myri0
		echo "$MYRINET  $HOSTNAME-myri0 $HOSTNAME-myri0.$DNSDOMAIN"
>>/etc/hosts
	fi
	chkconfig --level 345 gm on
	if [ -d /post/gm_routes ]
	then
		mkdir -p /usr/gm/routes
		cp -f /post/gm_routes/* /usr/gm/routes
	fi
fi

#
# Setup PBS
#
if [ "$PBS" = "Y" ]
then
	if [ -r /post/rc.d/pbs ]
	then
		logger "Install: setting up pbs"
		cp -f /post/rc.d/pbs* /etc/rc.d/init.d
		chmod 755 /etc/rc.d/init.d/pbs*
		chkconfig --del pbs
		chkconfig --del pbs_server
		chkconfig --del pbs_sched
		chkconfig --level 345 pbs_mom on
	fi
	mkdir -p /var/spool/pbs
	chmod 755 /var /var/spool /var/spool/pbs
	cd /var/spool/pbs
	mkdir aux checkpoing mom_logs mom_priv spool undelivered
	chmod 777 spool undelivered
	chmod o+t spool undelivered
	chmod 755 aux mom_logs
	chmod 751 mom_priv
	cd mom_priv
	mkdir jobs
	chmod 751 jobs
	ln -f -s $XCATPREFIX/pbs/prologue .
	ln -f -s $XCATPREFIX/pbs/epilogue .
	echo "\$logevent 0x1ff" >config
	echo "\$clienthost  $PBSSERVER" >>config
	chmod 644 config
	cd ..
	echo "PATH=/bin:/usr/bin" >pbs_environment
	echo "LANG=en_US" >>pbs_environment
	echo "$PBSSERVER" >server_name
	chmod 644 pbs_environment server_name

	echo "0 5 * * * root $XCATPREFIX/sbin/trimpbslogs 30" >>/etc/crontab

	echo "export
PATH=\$PATH:/usr/local/pbs/bin:/usr/local/pbs/sbin:/usr/local/maui/bin"
>/etc/profile.d/pbs.sh
	echo "export PBS_DEFAULT=$PBSSERVER" >>/etc/profile.d/pbs.sh
	echo "setenv PATH
\"\${PATH}:/usr/local/pbs/bin:/usr/local/pbs/sbin:/usr/local/maui/bin\""
>/etc/profile.d/pbs.csh
	echo "setenv PBS_DEFAULT \"$PBSSERVER\"" >>/etc/profile.d/pbs.csh
	chmod 755 /etc/profile.d/pbs.*
fi

#
# Fix portmap
#
#if [ -r /post/rc.d/portmap ]
#then
#	cp -f /post/rc.d/portmap /etc/rc.d/init.d
#fi

#
# Secure inetd
#
#if [ -r /etc/inetd.conf ]
#then
#	logger "Install: secure inetd.conf"
#	cp -f /etc/inetd.conf /etc/inetd.conf.ORIG
#	perl -pi -e 's/^/#/' /etc/inetd.conf
#fi

#
# Enable rsh
#
if [ "${RSH}" = "Y" ]
then
	if [ -r /etc/xinetd.d/rsh ]
	then
		logger "Install: enable rsh"
		perl -pi -e 's/^(\tdisable[^=]*=) yes/$1 no/'
/etc/xinetd.d/rsh
		perl -pi -e 's/^(\tdisable[^=]*=) yes/$1 no/'
/etc/xinetd.d/rlogin
		logger "Install: setup root .rhosts"
		cd /root
		echo "$MASTERNAME" >.rhosts
		echo "$MASTERNAME.$DNSDOMAIN" >>.rhosts
		chmod 600 .rhosts
	fi
	echo "rsh" >>/etc/securetty
	echo "rlogin" >>/etc/securetty
fi

#
# Setup sshd_config for .rhosts/hosts.equiv
#
if [ -r /etc/ssh/sshd_config ]
then
	logger "Install: setup /etc/ssh/sshd_config"
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIG
#	logger "Install: enable .rhosts/hosts.equiv for ssh"
#	perl -pi -e 's/^RhostsAuthentication .*$/RhostsAuthentication yes/'
/etc/ssh/sshd_config
#	perl -pi -e 's/^IgnoreRhosts .*$/IgnoreRhosts no/'
/etc/ssh/sshd_config
	perl -pi -e 's/^X11Forwarding .*$/X11Forwarding yes/'
/etc/ssh/sshd_config
	perl -pi -e 's/^KeyRegenerationInterval .*$/KeyRegenerationInterval
0/' /etc/ssh/sshd_config
	perl -pi -e 's/^MaxStartups/#MaxStartups/g' /etc/ssh/sshd_config
	echo "MaxStartups 1000" >>/etc/ssh/sshd_config
fi

#
# Setup root .ssh
#
if [ -d /post/.ssh ]
then
	logger "Install: setup root .ssh"
	cd /post
	find .ssh -print | cpio -dump /root
	chmod 700 /root/.ssh
	chmod 600 /root/.ssh/*
fi

#
# Setup scratch
#
if [ -d /scr ]
then
	logger "Install: setup scratch"
	chmod 755 /scr 2>&1 | logger
fi
if [ -d /scratch ]
then
	logger "Install: setup scratch"
	chmod 755 /scratch 2>&1 | logger
fi
if [ -d /nobackup ]
then
	logger "Install: setup scratch"
	chmod 777 /nobackup 2>&1 | logger
fi

#
# NFS
#
logger "Install: setup NFS mounts in fstab"
if [ -n "$HOMEFS" -a "$HOMEFS" != "NA" ]
then
	echo "$HOMEFS /home nfs rsize=4096,wsize=4096,timeo=14,intr 1 2"
>>/etc/fstab
fi
if [ -n "$LOCALFS" -a "$LOCALFS" != "NA" ]
then
	echo "$LOCALFS /usr/local nfs rsize=4096,wsize=4096,timeo=14,intr 1
2" >>/etc/fstab
fi
if [ -n "$XCATFS" -a "$XCATFS" != "NA" ]
then
	mkdir -p $XCATDIR
	echo "$XCATFS $XCATDIR nfs rsize=4096,wsize=4096,timeo=14,intr 1 2"
>>/etc/fstab
fi

#
# Sync clock
#
logger "Install: sync clock"
ntpdate -bs $TIP 2>&1 | logger
setclock 2>&1 | logger

#
# Setup NTP
#
logger "Install: Setup NTP"
for i in $(echo $TIMESERVERS | tr ',' ' ')
do
	echo "server $i.$DNSDOMAIN"
done >/etc/ntp.conf

echo "driftfile /etc/ntp/drift
multicastclient
broadcastdelay	0.008
authenticate no
keys		/etc/ntp/keys
trustedkey	65535
requestkey	65535
controlkey	65535" >>/etc/ntp.conf

for i in $(echo $TIMESERVERS | tr ',' ' ')
do
	echo "$i.$DNSDOMAIN"
done >/etc/ntp/step-tickers

#
# Setup PAM (optional, recommended)
#
if [ "$ACCESS" = "Y" ]
then
	logger "Install: Setup PAM"
	cd /etc/pam.d
	for i in ftp login rlogin rsh sshd
	do
		echo "account    required     /lib/security/pam_access.so"
>>$i
	done
	echo "-:ALL EXCEPT root:ALL" >>/etc/security/access.conf
	cp /etc/security/access.conf /etc/security/access.conf.BOOT
	echo "cp /etc/security/access.conf.BOOT /etc/security/access.conf
>/dev/null 2>&1" >>/etc/rc.d/rc.local
fi

#
# Setup accounting (optional)
#
if [ "$ACCT" = "Y" ]
then
	if [ -r /post/rc.d/acct ]
	then
		logger "Install: Setup BSD accounting"
		cp -f /post/rc.d/acct /etc/rc.d/init.d/acct
		chkconfig --level 345 acct on
	fi
fi

#
# Setup rc.local
#
logger "Install: Setup rc.local"
cp -f /etc/rc.d/rc.local /etc/rc.d/rc.local.ORIG
echo >>/etc/rc.d/rc.local
#echo "echo \"65535\" >/proc/sys/fs/file-max" >>/etc/rc.d/rc.local
#echo "echo \"32768\" >/proc/sys/fs/inode-max" >>/etc/rc.d/rc.local
#echo "echo \"1024 65000\" >/proc/sys/net/ipv4/ip_local_port_range"
>>/etc/rc.d/rc.local
#echo "echo \"0\" >/proc/sys/net/ipv4/tcp_sack" >>/etc/rc.d/rc.local
#echo "echo \"0\" >/proc/sys/net/ipv4/tcp_timestamps" >>/etc/rc.d/rc.local
echo "mount -a" >>/etc/rc.d/rc.local

echo "echo \"262144\" > /proc/sys/net/core/rmem_max" >>/etc/rc.d/rc.local
echo "echo \"262144\" > /proc/sys/net/core/wmem_max" >>/etc/rc.d/rc.local
echo "echo \"262144\" > /proc/sys/net/core/wmem_default"
>>/etc/rc.d/rc.local
echo "echo \"262144\" > /proc/sys/net/core/rmem_default"
>>/etc/rc.d/rc.local

echo "
# Based on Fast Ethernet tests with tulip.c:v0.92 driver, 
# the recommended strategy is '3' with faster timeouts 
# Other networks may need different parameters (experiment!) 
# 
#if [ -f /proc/sys/net/ipv4/tcp_delack_strategy ]; then 
#	echo 3 >/proc/sys/net/ipv4/tcp_delack_strategy 
#fi 
#if [ -f /proc/sys/net/ipv4/tcp_faster_timeouts ]; then 
#	echo 1 >/proc/sys/net/ipv4/tcp_faster_timeouts 
#fi 
# 
# Some generally useful network features 
# 
#if [ -f /proc/sys/net/core/netdev_max_backlog ]; then 
#	echo 1000 >/proc/sys/net/core/netdev_max_backlog 
#fi 
#if [ -f /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts ]; then 
#	echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts 
#fi

#setup multicast
route add -net 224.0.0.0 netmask 224.0.0.0 eth0

" >>/etc/rc.d/rc.local 

#
# Setup sendmail
#
logger "Install: Setup sendmail"
cp -f /etc/sendmail.cf /etc/sendmail.cf.ORIG 
cd /usr/share/sendmail-cf/cf
cp -f redhat.mc redhat.mc.ORIG
echo "FEATURE(nullclient,mailhost.$DNSDOMAIN)
MASQUERADE_AS(mailhost.$DNSDOMAIN)" >>redhat.mc
m4 redhat.mc > /etc/sendmail.cf
echo "*/15 * * * * root /usr/sbin/sendmail -q" >>/etc/crontab


# Forward root mail
#
#logger "Install: Setup forward of root's mail to $MASTERNAME"
#echo "root@$MASTERNAME" >/root/.forward

#
#setup man paths
#
logger "Install: Setup man paths"
cp -f /etc/man.config /etc/man.config.ORIG
FIXEDMANPATH=$(echo $XCATPREFIX/man | sed 's/\//\\\//g')
perl -pi -e "s/^MANPATH[\t
]+\/usr\/local\/man$/MANPATH\t\/usr\/local\/man\nMANPATH $FIXEDMANPATH/"
/etc/man.config

#
#setup paths
#
logger "Install: Setup PATHS"

echo "XCATROOT=$XCATPREFIX
XCATPREFIX=\$XCATROOT
ARCH=\$(uname -m)
PATH=\$PATH:\$XCATPREFIX/bin:\$XCATPREFIX/sbin:\$XCATPREFIX/\$ARCH/bin:\$XCA
TPREFIX/\$ARCH/sbin
export ARCH XCATPREFIX XCATROOT PATH" >/etc/profile.d/xcat.sh

echo "setenv XCATROOT \"$XCATPREFIX\"
setenv XCATPREFIX \"\${XCATROOT}\"
setenv ARCH \`uname -m\`
setenv PATH
\${PATH}:\${XCATPREFIX}/bin:\${XCATPREFIX}/sbin:\${XCATPREFIX}/\${ARCH}/bin:
\${XCATPREFIX}/\${ARCH}/sbin" >/etc/profile.d/xcat.csh

chmod 755 /etc/profile.d/xcat.*

echo "export XCATROOT=$XCATPREFIX" >/etc/sysconfig/xcat
chmod 755 /etc/sysconfig/xcat

echo "
test -d /etc/profile.d
if (\$status == 0) then
	set nonomatch
		foreach i ( /etc/profile.d/*.csh )
		test -f \$i
		if (\$status == 0) then
			source \$i
		endif
		end
	unset i nonomatch
endif" >>/etc/csh.login

#
#setup ld.so paths
#
logger "Install: Setup ls.so paths"
cp -f /etc/ld.so.conf /etc/ld.so.conf.ORIG
if [ "$(uname -m)" = "ia64" ]
then
	AARCH="/ia64"
else
	AARCH=""
fi
if grep "$XCATPREFIX$AARCH/lib" /etc/ld.so.conf >/dev/null 2>&1
then
	:
else
	echo "$XCATPREFIX$AARCH/lib" >>/etc/ld.so.conf
fi

#
# Setup snmp (TBD)
#

#
# Setup services
#
logger "Install: Setup services"
chkconfig --del apmd 
chkconfig --del gpm 
chkconfig --del kudzu 
chkconfig --del lpd 
chkconfig --del pcmcia 
chkconfig --del linuxconf 
chkconfig --del sendmail 
chkconfig --del xfs
chkconfig --del httpd
chkconfig --del identd
chkconfig --del isdn
chkconfig --del pppoe
chkconfig --del wine
chkconfig --del iscsi
chkconfig --level 345 ntpd on
chkconfig --level 345 sshd on
chkconfig --level 345 snmpd on
chkconfig --level 345 autofs on

#
# Setup NIS
#
if [ "$USENIS" = "Y" -a "$NISMASTER" != "NA" -a "$NISDOMAIN" != "NA" ]
then
	logger "Install: Setup NIS"
	NISROLE=client

	if [ "$HOSTNAME" = "$NISMASTER" ]
	then
		NISROLE=master
	fi

	if [ "$NISSLAVES" != "NA" ]
	then
		for i in $(echo $NISSLAVES | tr ',' ' ')
		do
			if [ "$HOSTNAME" = "$i" ]
			then
				if [ "$NISROLE" = "master" ]
				then
					logger "Install: $HOSTNAME cannot be
NIS Master and Slave"
					NISROLE=NA
				else
					NISROLE=slave
				fi
				break
			fi
		done
	fi

	logger "Install: Setup NIS $NISROLE"

	perl -pi -e "s/^NISDOMAIN=.*\n\$//" /etc/sysconfig/network
	echo "NISDOMAIN=$NISDOMAIN" >>/etc/sysconfig/network

	case "$NISROLE" in
		"client")
			perl -pi -e 's/^[^#]+//' /etc/yp.conf
			echo "domain $NISDOMAIN server $NISMASTER"
>>/etc/yp.conf
			if [ "$NISSLAVES" != "NA" ]
			then
				for i in $(echo $NISSLAVES | tr ',' ' ')
				do
					echo "domain $NISDOMAIN server $i"
>>/etc/yp.conf
					NISHIP=$(host $i | grep address |
awk '{print $4}')
    				if [ ! -z "$NISHIP" ]
    				then
        				echo "$NISHIP   $i  $i.$DNSDOMAIN"
>>/etc/hosts
					fi
				done
			fi
			perl -pi -e 's/(^(passwd|shadow|group):.*$)/$1 nis/'
/etc/nsswitch.conf
			/sbin/chkconfig --level 345 ypbind on
			/sbin/chkconfig --level 345 ypserv off
			;;
		*)
			/sbin/chkconfig --level 345 ypbind on
			logger "Install: NIS NOT setup, run gennis after
install"
			;;
	esac
fi

if [ "$INSTALL_ROLL" = "Y" ]
then
	#
	# Copy #INSTALL_DIR#
	#
	logger "Install: copying $INSTALL_DIR"
	cd /
	if [ ! -d "$INSTALL_DIR" ]
	then
		mkdir $INSTALL_DIR
	fi
	mkdir /installtmp
	mount -o nolock $NFS:$INSTALL_DIR /installtmp 2>&1 | logger
	cd /installtmp
	find rh73 -print | cpio -dump $INSTALL_DIR 2>&1 | logger
	find ks73 -print | cpio -dump $INSTALL_DIR 2>&1 | logger
	find post -print | cpio -dump $INSTALL_DIR 2>&1 | logger
	cd /
	umount /installtmp
	rmdir /installtmp

	#
	# Setup NFS
	#
	logger "Install: Setup NFS for Install"
	echo "$INSTALL_DIR *(ro,no_root_squash)" >>/etc/exports
	chkconfig --level 345 nfs on 2>&1 | logger
	chkconfig --level 345 nfslock on 2>&1 | logger
	if [ ! -d "$TFTPDIR" ]
	then
		mkdir $TFTPDIR
	fi
	echo "$MASTERNAME:$TFTPDIR $TFTPDIR nfs
rsize=4096,wsize=4096,timeo=14,intr 1 2" >>/etc/fstab

	#
	# Setup TFTPD
	#
	logger "Install: Setup TFTPD"
	chkconfig --level 345 atftpd on
#	if [ -r /post/tftpd ]
#	then
#		cp -f /post/tftpd /usr/sbin/tftpd 2>&1 | logger
#		cp /etc/rc.d/init.d/xinetd /etc/rc.d/init.d/xinetd.ORIG
#		perl -pi -e 's/daemon xinetd/daemon xinetd -loop 500/'
/etc/rc.d/init.d/xinetd
#		cp -f /etc/xinetd.d/tftp /etc/xinetd.d/tftp.ORIG
#		echo "service tftp
#{
#	socket_type		= dgram
#	protocol		= udp
#	wait			= yes
#	user			= root
#	server			= /usr/sbin/tftpd
#	server_args		= --no-timeout --no-multicast /tftpboot
#	cps			= 100
#	disable			= no
#}" >/etc/xinetd.d/tftp
#	fi
fi

#
# Copy node specific files
#
if [ "$RESNAME" = "$HOSTNAME" ]
then
	RESNAME=""
fi
for i in rh73 $NODETYPE $RESNAME $HOSTNAME
do
	if [ -d /post/sync/$i ]
	then
		logger "Install: copying /post/sync/$i to /"
		if cd /post/sync/$i
		then
			pwd | logger
			for j in $(find . -type f -print)
			do
				if [ -r /$j ]
				then
					cp -f /$j /$j.$i.ORIG 2>&1 | logger
				fi
			done
			find . -print | cpio -dump / 2>&1 | logger
		fi
	fi
done

#
# Unmount /post
#
logger "Install: unmounting /post"
cd /
umount /post
rmdir /post

#
# Check for serial bios
#
if [ -x "$RSHC" ]
then
	BIOSSERIAL=$(
		$RSHC $MASTERNAME $XCATPREFIX/bin/nodels $HOSTNAME
hm.serialbios | \
		grep $HOSTNAME | \
		tail -1 | \
		awk '{print $2}'
	)
else
	BIOSSERIAL=N
fi
echo "Serial BIOS: $BIOSSERIAL" | logger

#
# Set Serial Console
#
if [ "$SERIAL" = "0" -o "$SERIAL" = "1" ]
then
	logger "Install: setup serial console"
	cd /etc
	cp lilo.conf lilo.conf.NOSERIAL
	LN=`grep -n "^default=" lilo.conf.NOSERIAL | awk -F: '{print $1}'`
	head -$LN lilo.conf.NOSERIAL >lilo.conf
	if [ "$BIOSSERIAL" = "Y" ]
	then
		:
	else
		echo "serial=${SERIAL},9600n8" >>lilo.conf
	fi
	echo "append=\"console=tty1 console=ttyS${SERIAL},9600\""
>>lilo.conf
	LN=`expr $LN + 1`
	tail +$LN lilo.conf.NOSERIAL >>lilo.conf
	perl -pi -e 's/^message.*\n//' /etc/lilo.conf
	/sbin/lilo -v 2>&1 | logger

	cd /etc
	cp -f inittab inittab.NOSERIAL 2>&1 | logger
	perl -pi -e 's/^#1:2345/1:2345/' /etc/inittab
	perl -pi -e 's/vt100$/xterm/' /etc/inittab
fi

#
# Setup Syslog Again
#
logger "Install: syslog setup again"
echo "*.*	@$MIP" >/etc/syslog.conf

#
# Set local and remote complete install flag
# Put file in /dev/sda1
#
#(DON'T ERASE)
logger "Install: update local and remote installation flags"
date >/boot/install_complete
echo "$CHKSUM" >/boot/install_chksum

#IP=$(ifconfig eth0 | grep inet | awk '{print $2}' | awk -F: '{print $2}')
#HEX=$(
#	for i in $(echo $IP | tr '.' ' ')
#	do
#		printf "%02x" $i
#	done | tr '[a-z]' '[A-Z]'
#)
#cd /tmp
#
#echo "#boot" >$HEX
#echo "get pxelinux.cfg/$HEX blah" | tftp $TFTP_IP 2>&1 | logger
#grep SERIAL blah >>$HEX
#echo "DEFAULT xCAT
#LABEL xCAT
#LOCALBOOT 0" >>$HEX
#echo "put $HEX pxelinux.cfg/$HEX" | tftp $TFTP_IP 2>&1 | logger

if [ -x "$RSHC" ]
then
	$RSHC $MASTERNAME $XCATPREFIX/bin/nodeset $HOSTNAME boot 2>&1 |
logger
fi

cd /
exit 0	



More information about the wplug mailing list