Bernard Li wrote:
can do but how do I regenerate my autoinstall script? do I redo the
si_getimage? I notice there is also something called
si_mkautoinstallscript on the server. sounds promising but it is not
installed on the client. do i copy this over to the client and use it?
Yes you run si_mkautoinstallscript to regenerate the script (make sure
you make a backup copy before you run it).
The script is executed on the image server, which should contain a copy
of your golden image.
Hi, Bernard.
I changed <the image>/etc/systemimager/autoinstallscript.conf per your
suggestion and ran si_mkautoinstallscript. it generated a new
/var/lib/systemimager/scripts/<the image>.master
this is enclosed. note the order is still the same, i.e. wrong and will
result in an image that mounts root on top of /boot.
p
#!/bin/sh
#
# "SystemImager"
#
# Copyright (C) 1999-2004 Brian Elliott Finley
#
# 28.07.2005 Erich Focht : SCSI device detection and generation of
# /a/etc/systemconfig/hardware.lst
#
# David N. Lombard : Disks enumeration and disk editing
#
# $Id: autoinstallscript.template 3397 2006-01-09 13:33:05Z bli $
#
# This master autoinstall script was created with SystemImager v3.6.3
# Pull in variables left behind by the linuxrc script.
# This information is passed from the linuxrc script on the autoinstall media
# via /tmp/variables.txt. Apparently the shell we use in BOEL is not
# intelligent enough to take a "set -a" parameter.
#
. /tmp/variables.txt || shellout
# Load functions and other variables
. /etc/init.d/functions
get_arch
if [ -z $NO_LISTING ]; then
VERBOSE_OPT="v"
else
VERBOSE_OPT=""
fi
[ -z $IMAGENAME ] && IMAGENAME=dell_450_CENTOS4.2_image_v2
[ -z $OVERRIDES ] && OVERRIDES="dell_450_CENTOS4.2_image_v2"
### BEGIN Check to be sure this not run from a working machine ###
# Test for mounted SCSI or IDE disks
mount | grep [hs]d[a-z][1-9] > /dev/null 2>&1
[ $? -eq 0 ] && logmsg Sorry. Must not run on a working machine... && shellout
# Test for mounted software RAID devices
mount | grep md[0-9] > /dev/null 2>&1
[ $? -eq 0 ] && logmsg Sorry. Must not run on a working machine... && shellout
# Test for mounted hardware RAID disks
mount | grep c[0-9]+d[0-9]+p > /dev/null 2>&1
[ $? -eq 0 ] && logmsg Sorry. Must not run on a working machine... && shellout
### END Check to be sure this not run from a working machine ###
################################################################################
#
# Stop RAID devices before partitioning begins
#
# Q1) Why did they get started in the first place?
# A1) So we can pull a local.cfg file off a root mounted software RAID system.
# They may not be started on your system -- they would only be started if
# you did the stuff in Q3 below.
#
# Q2) Why didn't my local.cfg on my root mounted software RAID work for me
# with the standard kernel flavour?
# A2) The standard kernel flavour uses modules for the software RAID drivers --
# therefore, software RAID is not available at the point in the boot process
# where BOEL needs to read the local.cfg file. They are only pulled over
# when this script is run, which is, of course, only runnable if it was
# pulled over the network using the settings that you would have wanted it
# to get from the local.cfg file, which it couldn't. Right?
#
# Q3) Whatever. So how do I make it work with a local.cfg file on my root
# mounted software RAID?
# A3) Compile an autoinstall kernel with software RAID, and any other drivers
# you might need built in (filesystem, SCSI drivers, etc.).
#
if [ -f /proc/mdstat ]; then
RAID_DEVICES=` cat /proc/mdstat | grep ^md | sed 's/ .*$//g' `
# raidstop will not run unless a raidtab file exists
echo "" >> /etc/raidtab || shellout
# turn dem pesky raid devices off!
for RAID_DEVICE in ${RAID_DEVICES}
do
DEV="/dev/${RAID_DEVICE}"
# we don't do a shellout here because, well I forgot why, but we don't.
logmsg "raidstop ${DEV}" && raidstop ${DEV}
done
fi
#
################################################################################
# BEGIN disk enumeration
#
# Note the kludgey way to get /dev/sd* and /dev/*/c*d* to sort properly...
#
# Parse the correct file depending by the kernel release -AR-
kernel=`uname -r | sed "s/^\(2\.[64]\).*/\1/"`
if [ $kernel = "2.4" ]; then
diskfile=/proc/partitions
else
diskfile=/proc/diskstats
fi
echo DISKORDER=${DISKORDER=sd,cciss,ida,rd,hd}
[ -z $DISKORDER ] || {
logmsg enumerate_disks
order=`echo "$DISKORDER" | sed 's/ /,/g' | sed s/,,*/,/g | sed s/^,//`
DISKS=0
while : ; do
[ -z $order ] && break
type=`expr $order : '\([^,]*\),' \| $order`
case $type in
cciss | ida | rd )
for dev in `cat $diskfile | sed -ne "s/.*\($type\\/c[0-9]d[0-9]\).*/\1/p"
| sort -u` ; do
logmsg " $dev"
eval DISK$DISKS=/dev/${dev}
DISKS=`expr $DISKS + 1`
done
;;
hd | sd )
for dev in `cat $diskfile | sed -ne "s/.*\($type[a-z]\+\).*/\1/p" | sort
-u` ; do
logmsg " $dev"
eval DISK$DISKS=/dev/${dev}
DISKS=`expr $DISKS + 1`
done
;;
* )
logmsg "type='$type'"
shellout
;;
esac
order=`expr $order : '[^,]*,\(.*\)'`
done
logmsg DISKS=$DISKS
[ $DISKS -eq 0 ] && {
beep
beep
logmsg ""
logmsg "NO DISK DEVICE FILES WERE FOUND. THIS USUALLY MEANS THE KERNEL DID
NOT"
logmsg "RECOGNIZE ANY OF THE ATTACHED DISKS."
logmsg ""
logmsg "The kernel boot messages, which preceded this, may indicate why."
logmsg ""
logmsg "Reverting to disk configuration specified by image master script."
DISKORDER=
logmsg ""
}
echo
beep
}
#
# END disk enumeration
################################################################################
if [ -z $DISKORDER ] ; then
DISK0=/dev/hda
elif [ -z $DISK0 ] ; then
echo "Undefined: DISK0"
shellout
fi
### BEGIN partition $DISK0 ###
logmsg "Partitioning $DISK0..."
logmsg "Old partition table for $DISK0:"
parted -s -- $DISK0 print
# Create disk label. This ensures that all remnants of the old label, whatever
# type it was, are removed and that we're starting with a clean label.
logmsg "parted -s -- $DISK0 mklabel msdos || shellout"
parted -s -- $DISK0 mklabel msdos || shellout
# Get the size of the destination disk so that we can make the partitions fit
properly.
DISK_SIZE=`parted -s $DISK0 unit MB print | grep 'Disk geometry for' | sed
's/^.*-//g' | sed 's/\..*$//' | sed 's/MB//' `
[ -z $DISK_SIZE ] && shellout
if [ "$ARCH" = "alpha" ]; then
END_OF_LAST_PRIMARY=1
else
END_OF_LAST_PRIMARY=0
fi
logmsg "Creating partition ${DISK0}1."
START_MB=$END_OF_LAST_PRIMARY
END_MB=$(echo "scale=3; ($START_MB + 101)" | bc)
logmsg "parted -s -- $DISK0 mkpart primary ext2 $START_MB $END_MB || shellout"
parted -s -- $DISK0 mkpart primary ext2 $START_MB $END_MB || shellout
END_OF_LAST_PRIMARY=$END_MB
logmsg parted -s -- $DISK0 set 1 boot on || shellout
parted -s -- $DISK0 set 1 boot on || shellout
logmsg "Creating partition ${DISK0}2."
START_MB=$END_OF_LAST_PRIMARY
END_MB=$(echo "scale=3; ($START_MB + 2048)" | bc)
logmsg "parted -s -- $DISK0 mkpart primary ext2 $START_MB $END_MB || shellout"
parted -s -- $DISK0 mkpart primary ext2 $START_MB $END_MB || shellout
END_OF_LAST_PRIMARY=$END_MB
logmsg "Creating partition ${DISK0}3."
START_MB=$END_OF_LAST_PRIMARY
END_MB=$(echo "scale=3; ($START_MB + 2047)" | bc)
logmsg "parted -s -- $DISK0 mkpart primary ext2 $START_MB $END_MB || shellout"
parted -s -- $DISK0 mkpart primary ext2 $START_MB $END_MB || shellout
END_OF_LAST_PRIMARY=$END_MB
logmsg "Creating partition ${DISK0}4."
START_MB=$END_OF_LAST_PRIMARY
END_MB=$(( $DISK_SIZE - 0 ))
logmsg "parted -s -- $DISK0 mkpart primary ext2 $START_MB $END_MB || shellout"
parted -s -- $DISK0 mkpart primary ext2 $START_MB $END_MB || shellout
END_OF_LAST_PRIMARY=$END_MB
logmsg "New partition table for $DISK0:"
logmsg "parted -s -- $DISK0 print"
parted -s -- $DISK0 print
### END partition $DISK0 ###
### BEGIN software-RAID initialization commands -AR- ###
### END software-RAID initialization commands ###
logmsg "Load device mapper driver (for LVM)."
modprobe dm-mod
### BEGIN LVM initialization commands -AR- ###
### END LVM initialization commands ###
### BEGIN LVM groups creation commands -AR- ###
### END LVM groups creation commands ###
### BEGIN LVM volumes creation commands -AR- ###
### END LVM volumes creation commands ###
logmsg "Load additional filesystem drivers."
modprobe reiserfs
modprobe ext2
modprobe ext3
modprobe jfs
modprobe xfs
### BEGIN swap and filesystem creation commands ###
logmsg "mke2fs -j ${DISK0}1 || shellout"
mke2fs -j ${DISK0}1 || shellout
logmsg "mkdir -p /a/boot || shellout"
mkdir -p /a/boot || shellout
logmsg "mount ${DISK0}1 /a/boot -t ext3 -o defaults || shellout"
mount ${DISK0}1 /a/boot -t ext3 -o defaults || shellout
logmsg "mke2fs -j ${DISK0}4 || shellout"
mke2fs -j ${DISK0}4 || shellout
logmsg "mkdir -p /a/ || shellout"
mkdir -p /a/ || shellout
logmsg "mount ${DISK0}4 /a/ -t ext3 -o defaults || shellout"
mount ${DISK0}4 /a/ -t ext3 -o defaults || shellout
logmsg "mkswap -v1 ${DISK0}2 || shellout"
mkswap -v1 ${DISK0}2 || shellout
logmsg "swapon ${DISK0}2 || shellout"
swapon ${DISK0}2 || shellout
logmsg "mkswap -v1 ${DISK0}3 || shellout"
mkswap -v1 ${DISK0}3 || shellout
logmsg "swapon ${DISK0}3 || shellout"
swapon ${DISK0}3 || shellout
### END swap and filesystem creation commands ###
### BEGIN mount proc in image for tools like System Configurator ###
logmsg "mkdir -p /a/proc || shellout"
mkdir -p /a/proc || shellout
logmsg "mount proc /a/proc -t proc -o defaults || shellout"
mount proc /a/proc -t proc -o defaults || shellout
### END mount proc in image for tools like System Configurator ###
if [ ! $kernel = "2.4" ]; then
### BEGIN mount sysfs in image for tools that might be run during chroot ###
logmsg "mkdir -p /a/sys || shellout"
mkdir -p /a/sys || shellout
logmsg "mount sysfs /a/sys -t sysfs -o defaults || shellout"
mount sysfs /a/sys -t sysfs -o defaults || shellout
### END mount sysfs in image for tools that might be run during chroot ###
fi
################################################################################
#
# Lay the image down on the freshly formatted disk(s)
#
if [ ! -z $MONITOR_SERVER ]; then
start_report_task
fi
if [ ! -z $FLAMETHROWER_DIRECTORY_PORTBASE ]; then
# Use multicast
MODULE_NAME="${IMAGENAME}"
DIR=/a
RETRY=7
FLAMETHROWER_TARPIPE=y
flamethrower_client
else
# Use rsync
if [ $NO_LISTING ]; then
logmsg "Quietly installing image... "
start_spinner
fi
if [ "${TMPFS_STAGING}" = "yes" ]; then
# Deposit image into tmpfs
DIR=/tmp/tmpfs_staging
logmsg
logmsg "TMPFS_STAGING=${TMPFS_STAGING} -- Staging in ${DIR}"
mkdir -p ${DIR}
logmsg "rsync -aHS${VERBOSE_OPT} --exclude=lost+found/ --numeric-ids
${IMAGESERVER}::${IMAGENAME}/ ${DIR}/"
rsync -aHS${VERBOSE_OPT} --exclude=lost+found/ --exclude=/proc/*
--numeric-ids \
${IMAGESERVER}::${IMAGENAME}/ ${DIR}/ || shellout
# Move from staging in tmpfs to disk
rsync -aHS${VERBOSE_OPT} --exclude=lost+found/ --numeric-ids ${DIR}/ /a/
else
logmsg "rsync -aHS${VERBOSE_OPT} --exclude=lost+found/
--exclude=/proc/* --numeric-ids ${IMAGESERVER}::${IMAGENAME}/ /a/"
rsync -aHS${VERBOSE_OPT} --exclude=lost+found/ --exclude=/proc/*
--numeric-ids ${IMAGESERVER}::${IMAGENAME}/ /a/ || shellout
fi
fi
beep
#
################################################################################
if [ $NO_LISTING ]; then
stop_spinner
fi
# Leave notice of which image is installed on the client
echo $IMAGENAME > /a/etc/systemimager/IMAGE_LAST_SYNCED_TO || shellout
if [ ! -z $MONITOR_SERVER ]; then
stop_report_task 100
fi
# Copy the raidtab into the image.
cp -f /etc/raidtab /a/etc/raidtab
### BEGIN generate new fstab file from autoinstallscript.conf ###
cat <<'EOF' > /a/etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/hda1 /boot ext3 defaults 1 2
/dev/hda4 / ext3 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/hda2 swap swap defaults 0 0
/dev/hda3 swap swap defaults 0 0
# DO NOT EDIT BELOW THIS LINE...ANY CHANGES MIGHT BE DISCARDED
Ironman:/can/mocap /can/mocap nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
Superman:/images7 /images7 nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
Shem:/sataraid1 /archive/1 nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
Shem:/arena1 /archive/2 nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/Project /project nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/images1 /images1 nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/images2 /images2 nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/images3 /images3 nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/images4 /images4 nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/anim /mainframe/anim nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/admin /mainframe/admin nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/share /mainframe/share nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/eng /mainframe/eng nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/pa_linux /mainframe/pa nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/sw_install /mainframe/sw_install nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/vault /vault nfs rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/tmp_shottracker /net_tmp/default nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
noah:/farm /mainframe/farm nfs
rw,bg,intr,rsize=32768,wsize=32768,vers=3,udp
EOF
### END generate new fstab file from autoinstallscript.conf ###
################################################################################
#
# Process override directories
#
for OVERRIDE in $OVERRIDES
do
if [ ! -z $FLAMETHROWER_DIRECTORY_PORTBASE ]; then
# Use multicast
MODULE_NAME="override_${OVERRIDE}"
DIR=/a
RETRY=7
FLAMETHROWER_TARPIPE=y
flamethrower_client
else
# Use rsync
logmsg "rsync -av --numeric-ids $IMAGESERVER::overrides/$OVERRIDE/ /a/"
rsync -av --numeric-ids $IMAGESERVER::overrides/$OVERRIDE/ /a/ ||
logmsg "Override directory $OVERRIDE doesn't seem to exist, but that may be OK."
fi
done
beep
#
################################################################################
################################################################################
# BEGIN disk edits
#
[ -z $DISKORDER ] || {
echo "Editing files for actual disk configuration..."
echo " /dev/hda -> $DISK0"
for file in /etc/fstab /etc/raidtab /etc/systemconfig/systemconfig.conf; do
[ -f /a/$file ] || continue
echo " $file"
cp /a/$file /a/$file.image
cat /a/$file.image |
sed s:/dev/hda:%DISK0%:g |
sed s:%DISK0%:$DISK0:g |
cat > /a/$file
done
echo
beep
}
#
# END disk edits
################################################################################
##################################################################
#
# Uncomment the line below to leave your hostname blank.
# Certain distributions use this as an indication to take on the
# hostname provided by a DHCP server. The default is to have
# SystemConfigurator assign your clients the hostname that
# corresponds to the IP address the use during the install.
# (If you used to use the static_dhcp option, this is your man.)
#
#HOSTNAME=""
################################################################################
#
# mount /dev /a/dev -o bind if needed
#
#not needed for this image
#
################################################################################
################################################################################
#
# Detect scsi hardware and include the device IDs into the hardware.lst
# file used by systemconfigurator. Do nothing if the hardware.lst file
# already exists (which is a sign that it has been already prepared).
# Would be shorter if discover could return numerical device IDs...
#
if [ ! -f /a/etc/systemconfig/hardware.lst ]; then
SCSI_MODS=`discover -f "%m\n" scsi | grep -v ide-scsi | uniq`
for MOD in $SCSI_MODS; do
DEVID=`grep $MOD /proc/bus/pci/devices | cut -f 2 | sort | uniq`
for MYDEV in $DEVID; do
VENDOR=`echo $MYDEV | cut -b 1-4`
MODEL=`echo $MYDEV | cut -b 5-8`
echo "$VENDOR $MODEL scsi $MOD" >> /a/etc/systemconfig/hardware.lst
echo "Added SCSI device $VENDOR:$MODEL using module $MOD to
hardware.lst"
done
done
fi
#
################################################################################
################################################################################
#
# System Configurator
#
# Configure the client's hardware, network interface, and boot loader.
#
[ -z $DEVICE ] && DEVICE=eth0
chroot /a/ systemconfigurator
--excludesto=/etc/systemimager/systemconfig.local.exclude --configsi --stdin <<
EOL || shellout
[NETWORK]
HOSTNAME = $HOSTNAME
DOMAINNAME = $DOMAINNAME
[INTERFACE0]
DEVICE = eth0
TYPE = dhcp
EOL
#
################################################################################
################################################################################
#
# Post Install Scripts
#
run_post_install_scripts
#
################################################################################
################################################################################
#
# Unmount filesystems
#
if [ ! $kernel = "2.4" ]; then
logmsg "umount /a/sys || shellout"
umount /a/sys || shellout
fi
logmsg "umount /a/proc || shellout"
umount /a/proc || shellout
logmsg "umount /a/boot || shellout"
umount /a/boot || shellout
logmsg "umount /a/ || shellout"
umount /a/ || shellout
#
################################################################################
################################################################################
#
# Tell the image server we're done
#
rsync $IMAGESERVER::scripts/imaging_complete > /dev/null 2>&1
#
################################################################################
# Take network interface down
[ -z $DEVICE ] && DEVICE=eth0
ifconfig $DEVICE down || shellout
# Announce completion (even for non beep-incessantly --post-install options)
beep 3
beep_incessantly