xcat-core/xCAT-IBMhpc/share/xcat/IBMhpc/IBMhpc.sles.postinstall

87 lines
2.9 KiB
Plaintext
Raw Permalink Normal View History

#!/bin/sh
#--
#-- IBMhpc.postinstall
#-- Run this script from your <profile>.postinstall to perform the following
#-- general setup in your diskless image for your HPC cluster:
#-- - create entries in /etc/fstab for basic filesystems
#-- - enables the "cons" entry in /etc/inittab
#-- - create initial copies of /etc/passwd and other files in the image
#-- - turn on the "at" service
#-- - turn on xinetd
#-- -
#--
#-- it gets these arguments:
#--
#-- $1 = install root (chroot directory for profile)
#-- $2 = OS version
#-- $3 = architecture
#-- $4 = profile name
#-- $5 = work dir (where genimage is located)
#--
#--
installroot=$1
osver=$2
arch=$3
profile=$4
workdir=$5
#-- Generate /etc/fstab automatically during image generation:
#-- adjust filesystem sizes as needed for your cluster
cat <<END >$installroot/etc/fstab
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
#${profile}_${arch} / tmpfs rw 0 1
none /tmp tmpfs defaults,size=3g 0 2
none /var/tmp tmpfs defaults,size=1g 0 2
END
#-- Uncomment the "cons" entry in /etc/inittab
#cons:12345:respawn:/sbin/smart_agetty -L 38400 console
TMP_inittab=`sed 's/\(#\)\(cons:12345.*\)$/\2/' $installroot/etc/inittab`
echo "$TMP_inittab" > $installroot/etc/inittab
# Create initial copies of /etc/passwd and others in case they are needed
# by other postscripts
# If you would like xCAT to keep these up to date,
# use the xCAT syncfiles function which runs during
# packimage/liteimg and at other times
cp -p /etc/passwd $installroot/etc/passwd
cp -p /etc/group $installroot/etc/group
cp -p /etc/shadow $installroot/etc/shadow
cp -p /etc/hosts $installroot/etc/hosts
# Turn on 'at' service
chroot $installroot chkconfig atd on
# Turn on xinetd
chroot $installroot chkconfig xinetd on
# Automatically mount /dev/cpuset at node boot
if ! grep 'cpuset' $installroot/etc/init.d/boot.local ; then
cat <<END >>$installroot/etc/init.d/boot.local
if test -e /dev/cpuset || mkdir -p /dev/cpuset ; then
mount -t cpuset none /dev/cpuset
fi
END
fi
# Modify some ulimits
if [ ! -f $installroot/etc/sysconfig/ulimit ]; then
cp -p /etc/sysconfig/ulimit $installroot/etc/sysconfig
fi
if [ ! -f $installroot/etc/sysconfig/ulimit.XCAT_BAK ]; then
cp -p $installroot/etc/sysconfig/ulimit $installroot/etc/sysconfig/ulimit.XCAT_BAK
fi
# max locked memory
/usr/bin/sed -i 's/HARDLOCKLIMIT=.*/HARDLOCKLIMIT="unlimited"/g' $installroot/etc/sysconfig/ulimit
/usr/bin/sed -i 's/SOFTLOCKLIMIT=.*/SOFTLOCKLIMIT="unlimited"/g' $installroot/etc/sysconfig/ulimit
# max memory size
/usr/bin/sed -i 's/HARDRESIDENTLIMIT=.*/HARDRESIDENTLIMIT="unlimited"/g' $installroot/etc/sysconfig/ulimit
/usr/bin/sed -i 's/SOFTRESIDENTLIMIT=.*/SOFTRESIDENTLIMIT="unlimited"/g' $installroot/etc/sysconfig/ulimit