Using %pre scripts for partitioning - RHEL-ES-4

Oliver Hookins ohookins at gmail.com
Mon Apr 4 08:08:41 UTC 2005


In order to accommodate various partitioning layouts in the most
automated fashion possible, I want to use a %pre script to set the
layout of the the partitioning based on a kernel parameter that I am
setting.

For example, in my main kickstart script:

%pre
#!/bin/sh
# Check to see which type of partitioning was specified
PART=`cat /proc/cmdline | tr ' ' '\n' | grep '^part=' | cut -d= -f2`

if [ "$PART" = "ide-hda-hdb-srv" ]; then
  %include /mnt/source/kickstart/ide-hda-hdb-srv.ks
elif [ "$PART" = "ide-hda-hdc-srv" ]; then
  %include /mnt/source/kickstart/ide-hda-hdc-srv.ks
elif [ "$PART" = "ide-hda-srv" ]; then
  %include /mnt/source/kickstart/ide-hda-srv.ks
elif [ "$PART" = "ide-freedom" ]; then
  %include /mnt/source/kickstart/ide-freedom.ks
elif [ "$PART" = "ide-ws" ]; then
  %include /mnt/source/kickstart/ide-ws.ks
elif [ "$PART" = "scsi-raid1" ]; then
  %include /mnt/source/kickstart/scsi-raid1.ks
elif [ "$PART" = "scsi-raid5" ]; then
  %include /mnt/source/kickstart/scsi-raid5.ks
else
  echo "No partitioning option specified - will prompt for partitioning."
fi

I'm not sure that this is correct (and it certainly is not working).
The administrator guide hasn't made it abundantly clear as to how to
do this sort of thing. Each of these files to be included has a bunch
of part commands, for example:

ide-freedom.ks:
# Single disk partitioning.
part /boot --fstype ext3 --badblocks --size 500        --asprimary
part swap                --badblocks --size 2048       --asprimary
part /     --fstype ext3 --badblocks --size 1   --grow --asprimary

Can someone steer me in the right direction?
Thanks,
Oliver




More information about the Redhat-install-list mailing list