System information

Sharing and maintaining SLES 10 SP2 Linux under z/VM 77
function modifySystem()
# Arg 1: "dcss" - if converting to DCSS R/O file systems also, else null
# 1) Copy modified /etc/init.d/boot, /etc/init.d/boot.rootfsck and /etc/fstab
# 2) Copy source /etc/ and /root/ directories to target /local/
# 3) Move /etc/init.d under /sbin/ and create symlink to point back
#+--------------------------------------------------------------------------+
{
TGT="/mnt/target"
echo ""
echo "Backing up and modifying /etc/init.d/boot script ..."
cp $TGT/etc/init.d/boot $TGT/etc/init.d/boot.orig
if [ "$?" != 0 ]; then exit 50; fi
cat $TGT/etc/init.d/boot.orig | \
sed -e 's:bootrc=/etc/init.d/boot.d:bootrc=/sbin/init.d/boot.d:g' > \
$TGT/etc/init.d/boot
if [ "$?" != 0 ]; then exit 51; fi
echo ""
echo "Backing up and patching /etc/init.d/boot.rootfsck script ..."
cp $TGT/etc/init.d/boot.rootfsck $TGT/etc/init.d/boot.rootfsck.orig
if [ "$?" != 0 ]; then exit 52; fi
patch $TGT/etc/init.d/boot.rootfsck < $rorDiffs
if [ "$?" != 0 ]; then exit 53; fi
echo ""
echo "Backing up and copying modified /etc/fstab file ..."
cp $TGT/etc/fstab $TGT/etc/fstab.orig
if [ "$?" != 0 ]; then exit 54; fi
# If using DCSS read-only file systems:
# 1) Copy different fstab file
# 2) Change zipl.conf differently - add "mem=2G"
# 3) Modify /etc/sysconfig/kernel to load the dcssblk driver
# 4) Add a line to /etc/modprobe.conf.local with the dcssblk options
if [ "$1" = "DCSS" ]; then # use DCSSs not minidisks for R/O FSs
echo "Modifying system for DCSS R/O file systems"
cp $fstabDCSSfile $TGT/etc/fstab
cp $TGT/etc/sysconfig/kernel $TGT/etc/sysconfig/kernel.orig
sed -i -e 's/MODULES_LOADED_ON_BOOT="/MODULES_LOADED_ON_BOOT="dcssblk /g'\
$TGT/etc/sysconfig/kernel
if [ "$?" != 0 ]; then exit 55; fi
echo 'options dcssblk "segments=ROOTFS01,BOOTFS01,OPTFS01,USRFS01"' >>\
$TGT/etc/modprobe.conf.local
if [ "$?" != 0 ]; then exit 56; fi
else # not DCSS system - just copy new /etc/fstab file
echo "Copying /etc/fstab file"
cp $fstabFile $TGT/etc/fstab
fi
if [ "$?" != 0 ]; then exit 57; fi
echo ""
echo "Backing up and modifying /etc/zipl.conf file ..."
cp $TGT/etc/zipl.conf $TGT/etc/zipl.conf.orig
if [ "$?" != 0 ]; then exit 58; fi
if [ "$1" = "DCSS" ]; then # also add "mem=2G" to zipl.conf
cat $TGT/etc/zipl.conf.orig | \
sed -e 's/dasd=1b0-1bf/ro mem=2G dasd=1b0(ro),1b1(ro),1b2-1b7,1b8(ro),1b9-1bf/g' \
> $TGT/etc/zipl.conf
else # no DCSSs - just add "(ro)" to the R/O disks
cat $TGT/etc/zipl.conf.orig | \