[Read Isolinux Label in Kickstart File]
Alan McKay
alan.mckay at gmail.com
Mon May 3 15:49:45 UTC 2010
You should be able to do this. In my kickstart files I use a lot of
prompting and asking questions, and taking actions accordingly. Even
with regards to disk partitioning. For example :
whichdiskprompt()
{
#
# which disk to format and install on
# eventually need option for /data
#
echo ""
echo "Here are the disks you have to choose from ..."
fdisk -l 2>/dev/null | grep Disk | grep "/dev/sd[abcd]"
DISKS=`fdisk -l 2>/dev/null | grep Disk | grep "/dev/sd[abcd]" | awk
'{print $2}' | awk -F/ '{print $3}' | sed s/://`
SAVEPS3=$PS3
PS3="Which disk to format? "
MYDISK=
select MYDISK in $DISKS
do
[ "$MYDISK" != "" ] && break
done
PS3=$SAVEPS3
echo "You chose [$MYDISK]"
MYDISKSIZE=`fdisk -l 2>/dev/null | grep Disk | grep "/dev/$MYDISK" |
awk '{print $3}' | awk -F. '{print $1}'`
export MYDISK
export MYDISKSIZE
}
I also work with NFS filesystems in my kickstart, so you could store
your different formatting options on NFS, have your script look in a
certain location to see what options are available there, and then
prompt the user accordingly.
I even have my options selected in %pre saved to the NFS drive so they
can be read back in in %post and used there.bb
Here is %pre part - note NFS server is 192.168.0.9
#
# now lets try to copy some info over to an NFS drive
# to save it for %post
#
mkdir -p /mnt/ks
chmod 0777 /mnt /mnt/ks
mount 192.168.0.9:/data/ks /mnt/ks -w
mkdir -p /mnt/ks/kstmp
MYMAC=`ifconfig | grep HWaddr | head -1 | awk '{print $5}'`
#
# OK, save out the vars we want for %post
echo "MYMAC=$MYMAC" > /mnt/ks/kstmp/$MYMAC.vars
echo "MYSYSTYPE=$MYSYSTYPE" >> /mnt/ks/kstmp/$MYMAC.vars
echo "MYDISK=$MYDISK" >> /mnt/ks/kstmp/$MYMAC.vars
echo "MYDISKSIZE=$MYDISKSIZE" >> /mnt/ks/kstmp/$MYMAC.vars
echo "MYOWNVAR=$MYOWNVAR" >> /mnt/ks/kstmp/$MYMAC.vars
echo "MYSWAPSIZE=$MYSWAPSIZE" >> /mnt/ks/kstmp/$MYMAC.vars
echo "MYROOTSIZE=$MYROOTSIZE" >> /mnt/ks/kstmp/$MYMAC.vars
echo "MINROOTSIZE=$MINROOTSIZE" >> /mnt/ks/kstmp/$MYMAC.vars
echo ""
cat /mnt/ks/kstmp/$MYMAC.vars
echo ""
umount /mnt/ks
and here is %post part
MYMAC=`ifconfig | grep HWaddr | head -1 | awk '{print $5}'`
cp /etc/fstab /etc/fstab.orig
echo "192.168.0.9:/data/ks /mnt/ks nfs
rsize=32768,wsize=32768,timeo=14,intr" >> /etc/fstab
mkdir -p /mnt/ks
chmod 0777 /mnt /mnt/ks
/etc/init.d/netfs start
mount /mnt/ks
cp /mnt/ks/kstmp/$MYMAC.vars /root
umount /mnt/ks
mv -f /etc/fstab.orig /etc/fstab
while read line
do
eval $line
done < /root/$MYMAC.vars
--
“Don't eat anything you've ever seen advertised on TV”
- Michael Pollan, author of "In Defense of Food"
More information about the Kickstart-list
mailing list