Solved; Was: This ks script isn't working on CentOS 4.8... Should it?

Madison Kelly linux at alteeve.com
Sat Nov 21 12:35:01 UTC 2009


Hugh Brown wrote:
> If you try and run the script on a regular box, it fails.  While you are 
> working on fine tuning the script, run it on a regular box and verify 
> that the file it creates  that to test with initially before you move to 
> the load testing situation.

I want to thank Hugh for the note on me being a bash dork and Terry for 
his cat suggestion. Thanks also to Chip and Tru for taking the time to 
respond. I got a working kickstart file now that, finally, handles 
underlying disks properly.

It took me forever to find a working sample of a logical kickstart 
script, so now that I have one working, I'd like to post it here, "for 
the record", in case someone else finds it trying to sort out how to do 
something similar down the road. :)

Madi

-=] Begin 'ks_unified.cfg', careful of email-induced line wraps [=-
# Disk type detecting kickstart script. Tested on CentOS 4.8

text
install
cdrom
lang en_US
langsupport en_US
keyboard us
xconfig --resolution 1024x768 --depth 24 --startxonboot 
--defaultdesktop gnome
network --device eth0 --bootproto dhcp --hostname sysX.example.com
rootpw --iscrypted $1$cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone --utc America/Toronto

# This will run whatever was created by the script below.
%include /tmp/part-include

%packages --resolvedeps
@ development-tools
@ editors
@ legacy-network-server
@ legacy-software-development
@ server-cfg
@ system-tools
@ sound-and-video
@ network-server
@ admin-tools
@ smb-server
@ base-x
@ gnome-desktop
@ text-internet
@ printing
@ graphical-internet
k3b
dhcp
expect
ncompress
vnc
tftp
uucp
perl-Crypt-SSLeay
perl-TimeDate
system-config-printer
#
# Exclude the following packages:
#
-lksctp-tools
-HelixPlayer
-cdparanoia
-rhythmbox
-sound-juicer


### Script to setup partitions.
%pre --log=/tmp/ks-preinstall.log

#!/bin/sh

# Prepare the disks in the script below. It checks '/proc/partitions' to see
# what configuration to use.

### Some detection.
if grep -q "cciss/c0d0" /proc/partitions; then
	### No RAID is needed at the software level, it's managed by the
	#   controller.
cat >> /tmp/part-include <<END
ignoredisk --drives=hda,hdb,hdc,hdd,sda,sdb,sdc,sdd
zerombr yes
bootloader --location=mbr --append="rhgb quiet"
clearpart --all --initlabel

# '/boot' partition
part /boot	--size=200	--asprimary	--ondisk=cciss/c0d0
# '/' partition
part /		--size=20000	--asprimary	--ondisk=cciss/c0d0
# <swap> partitions
part swap	--size=1000	--asprimary	--ondisk=cciss/c0d0
# '/backup' partition
part /backup	--size=5000			--ondisk=cciss/c0d0
# '/u' partition (grows to fill disk).
part /u		--size=1	--grow		--ondisk=cciss/c0d0
END
elif grep -q "cciss/c1d0" /proc/partitions; then
	### No RAID is needed at the software level, it's managed by the
	# controller.
cat >> /tmp/part-include <<END
ignoredisk --drives=hda,hdb,hdc,hdd,sda,sdb,sdc,sdd
zerombr yes
bootloader --location=mbr --append="rhgb quiet"
clearpart --all --initlabel

# '/boot' partition
part /boot	--size=200	--asprimary	--ondisk=cciss/c1d0
# '/' partition
part /		--size=20000	--asprimary	--ondisk=cciss/c1d0
# <swap> partitions
part swap	--size=1000	--asprimary	--ondisk=cciss/c1d0
# '/backup' partition
part /backup	--size=5000			--ondisk=cciss/c1d0
# '/u' partition (grows to fill disk).
part /u		--size=1	--grow		--ondisk=cciss/c1d0
END
elif grep -q hdb /proc/partitions; then
	### /dev/hdX RAID
cat >> /tmp/part-include <<END
ignoredisk --drives=hdc,hdd,sda,sdb,sdc,sdd
zerombr yes
bootloader --location=mbr --append="rhgb quiet"
clearpart --all --initlabel

# '/boot' partition
part raid.10 --size=200   --asprimary --ondisk=hda
part raid.20 --size=200   --asprimary --ondisk=hdb
# '/' partition
part raid.11 --size=20000 --asprimary --ondisk=hda
part raid.21 --size=20000 --asprimary --ondisk=hdb
# <swap> partitions
part raid.12 --size=1000  --asprimary --ondisk=hda
part raid.22 --size=1000  --asprimary --ondisk=hdb
# '/backup' partition
part raid.13 --size=5000              --ondisk=hda
part raid.23 --size=5000              --ondisk=hdb
# '/u' partition (grows to fill disk).
part raid.14 --size=1     --grow      --ondisk=hda
part raid.24 --size=1     --grow      --ondisk=hdb

# Build the RAID arrays
raid /boot   --fstype ext3 --level=RAID1 --device=md0 raid.10 raid.20
raid /       --fstype ext3 --level=RAID1 --device=md1 raid.11 raid.21
raid swap    --fstype swap --level=RAID1 --device=md4 raid.12 raid.22
raid /backup --fstype ext3 --level=RAID1 --device=md2 raid.13 raid.23
raid /u      --fstype ext3 --level=RAID1 --device=md3 raid.14 raid.24
END
elif grep -q hda /proc/partitions; then
	### /dev/hda single
cat >> /tmp/part-include <<END
ignoredisk --drives=hdb,hdc,hdd,sda,sdb,sdc,sdd
zerombr yes
bootloader --location=mbr --append="rhgb quiet"
clearpart --all --initlabel --drives hda

# '/boot' partition
part /boot	--size=200	--asprimary	--ondisk=hda
# '/' partition
part /		--size=20000	--asprimary	--ondisk=hda
# <swap> partitions
part swap	--size=1000	--asprimary	--ondisk=hda
# '/backup' partition
part /backup	--size=5000			--ondisk=hda
# '/u' partition (grows to fill disk).
part /u		--size=1	--grow		--ondisk=hda
END
elif grep -q sdb /proc/partitions; then
	### /dev/sdX RAID - This should be the majority.
cat >> /tmp/part-include <<END
ignoredisk --drives=hda,hdb,hdc,hdd,sdc,sdd
zerombr yes
bootloader --location=mbr --append="rhgb quiet"
clearpart --all --initlabel

# '/boot' partition
part raid.10 --size=200   --asprimary --ondisk=sda
part raid.20 --size=200   --asprimary --ondisk=sdb
# '/' partition
part raid.11 --size=20000 --asprimary --ondisk=sda
part raid.21 --size=20000 --asprimary --ondisk=sdb
# <swap> partitions
part raid.12 --size=1000  --asprimary --ondisk=sda
part raid.22 --size=1000  --asprimary --ondisk=sdb
# '/backup' partition
part raid.13 --size=5000              --ondisk=sda
part raid.23 --size=5000              --ondisk=sdb
# '/u' partition (grows to fill disk).
part raid.14 --size=1     --grow      --ondisk=sda
part raid.24 --size=1     --grow      --ondisk=sdb

# Build the RAID arrays
raid /boot   --fstype ext3 --level=RAID1 --device=md0 raid.10 raid.20
raid /       --fstype ext3 --level=RAID1 --device=md1 raid.11 raid.21
raid swap    --fstype swap --level=RAID1 --device=md4 raid.12 raid.22
raid /backup --fstype ext3 --level=RAID1 --device=md2 raid.13 raid.23
raid /u      --fstype ext3 --level=RAID1 --device=md3 raid.14 raid.24
END
elif grep -q sda /proc/partitions; then
	### /dev/sda single
cat >> /tmp/part-include <<END
ignoredisk --drives=hda,hdb,hdc,hdd,sdb,sdc,sdd
zerombr yes
bootloader --location=mbr --append="rhgb quiet"
clearpart --all --initlabel --drives sda

# '/boot' partition
part /boot	--size=200	--asprimary	--ondisk=sda
# '/' partition
part /		--size=20000	--asprimary	--ondisk=sda
# <swap> partitions
part swap	--size=1000	--asprimary	--ondisk=sda
# '/backup' partition
part /backup	--size=5000			--ondisk=sda
# '/u' partition (grows to fill disk).
part /u		--size=1	--grow		--ondisk=sda
END
fi




More information about the Kickstart-list mailing list