This ks script isn't working on CentOS 4.8... Should it?

Madison Kelly linux at alteeve.com
Thu Nov 19 19:53:56 UTC 2009


Hi all,

   I've got an installer that I've been trying to get to work on various 
servers depending on their under-lying disk type. I adapted a KS from 
the web and came up with the kickstart below. In short though; I'm 
trying to use it on CentOS 4.8 i386.

   It creates the '/tmp/part-include' file but only with the 
'clear-part' line. It doesn't seem to run the bash script after it. Do I 
need some magic to make it run?

Thanks!

-----------

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 
usrvr.lab.opticalonline.com
rootpw --iscrypted $1$xxxxxxxxxxxxxxxxxxxxxxxx
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone --utc America/Toronto
ignoredisk --drives=sda,sdb,sdc,sdd
bootloader --location=partition

# 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
# This should detect what disk parition layout to used depending on the
# partitions found.

# Prepare the disks.
echo "zerombr yes" > /tmp/part-include
echo "clearpart --all --initlabel" > /tmp/part-include

### Some detection.
if [grep -q cciss/c0d0]; then
	### No RAID is needed at the software level, it's managed by the 
controller.
	# '/boot' partition
	echo "part /boot   --size=200   --asprimary --ondisk=cciss/c0d0p1" > 
/tmp/part-include
	# '/' partition
	echo "part /       --size=200   --asprimary --ondisk=cciss/c0d0p2" > 
/tmp/part-include
	# <swap> partitions (RAID 0)
	echo "part swap    --size=1000  --asprimary --ondisk=cciss/c0d0p3" > 
/tmp/part-include
	# '/backup' partition
	echo "part /backup --size=5000              --ondisk=cciss/c0d0p4" > 
/tmp/part-include
	# '/u' partition (grows to fill disk).
	echo "part /u      --size=1     --grow      --ondisk=cciss/c0d0p5" > 
/tmp/part-include
elif [grep -q cciss/c1d0]; then
	### No RAID is needed at the software level, it's managed by the 
controller.
	# '/boot' partition
	echo "part /boot   --size=200   --asprimary --ondisk=cciss/c1d0p1" > 
/tmp/part-include
	# '/' partition
	echo "part /       --size=200   --asprimary --ondisk=cciss/c1d0p2" > 
/tmp/part-include
	# <swap> partitions (RAID 0)
	echo "part swap    --size=1000  --asprimary --ondisk=cciss/c1d0p3" > 
/tmp/part-include
	# '/backup' partition
	echo "part /backup --size=5000              --ondisk=cciss/c1d0p4" > 
/tmp/part-include
	# '/u' partition (grows to fill disk).
	echo "part /u      --size=1     --grow      --ondisk=cciss/c1d0p5" > 
/tmp/part-include
elif [grep -q hdb /proc/partitions]; then
	### /dev/hdX RAID
	# '/boot' partition
	echo "part raid.10 --size=200   --asprimary --ondisk=hda" > 
/tmp/part-include
	echo "part raid.20 --size=200   --asprimary --ondisk=hdb" > 
/tmp/part-include

	# '/' partition
	echo "part raid.11 --size=20000 --asprimary --ondisk=hda" > 
/tmp/part-include
	echo "part raid.21 --size=20000 --asprimary --ondisk=hdb" > 
/tmp/part-include

	# <swap> partitions (RAID 0)
	echo "part raid.12 --size=1000  --asprimary --ondisk=hda" > 
/tmp/part-include
	echo "part raid.22 --size=1000  --asprimary --ondisk=hdb" > 
/tmp/part-include

	# '/backup' partition
	echo "part raid.13 --size=5000              --ondisk=hda" > 
/tmp/part-include
	echo "part raid.23 --size=5000              --ondisk=hdb" > 
/tmp/part-include

	# '/u' partition (grows to fill disk).
	echo "part raid.14 --size=1     --grow      --ondisk=hda" > 
/tmp/part-include
	echo "part raid.24 --size=1     --grow      --ondisk=hdb" > 
/tmp/part-include

	# Build the RAID arrays
	echo "raid /boot   --fstype ext3 --level=RAID1 --device=md0 raid.10 
raid.20" > /tmp/part-include
	echo "raid /       --fstype ext3 --level=RAID1 --device=md1 raid.11 
raid.21" > /tmp/part-include
	echo "raid swap    --fstype swap --level=RAID0 --device=md4 raid.12 
raid.22" > /tmp/part-include
	echo "raid /backup --fstype ext3 --level=RAID1 --device=md2 raid.13 
raid.23" > /tmp/part-include
	echo "raid /u      --fstype ext3 --level=RAID1 --device=md3 raid.14 
raid.24" > /tmp/part-include
elif [grep -q hda /proc/partitions]; then
	### /dev/hda single
	# '/boot' partition
	echo "part /boot	--size=200	--asprimary	--ondisk=hda" > /tmp/part-include
	# '/' partition
	echo "part /		--size=20000	--asprimary	--ondisk=hda" > /tmp/part-include
	# <swap> partitions
	echo "part swap	--size=1000	--asprimary	--ondisk=hda" > /tmp/part-include
	# '/backup' partition
	echo "part /backup	--size=5000			--ondisk=hda" > /tmp/part-include
	# '/u' partition (grows to fill disk).
	echo "part /u		--size=1	--grow		--ondisk=hda" > /tmp/part-include
elif [grep -q hdb /proc/partitions]; then
	### /dev/sdX RAID - This should be the majority.
	# '/boot' partition
	echo "part raid.10 --size=200   --asprimary --ondisk=sda" > 
/tmp/part-include
	echo "part raid.20 --size=200   --asprimary --ondisk=sdb" > 
/tmp/part-include

	# '/' partition
	echo "part raid.11 --size=20000 --asprimary --ondisk=sda" > 
/tmp/part-include
	echo "part raid.21 --size=20000 --asprimary --ondisk=sdb" > 
/tmp/part-include

	# <swap> partitions (RAID 0)
	echo "part raid.12 --size=1000  --asprimary --ondisk=sda" > 
/tmp/part-include
	echo "part raid.22 --size=1000  --asprimary --ondisk=sdb" > 
/tmp/part-include

	# '/backup' partition
	echo "part raid.13 --size=5000              --ondisk=sda" > 
/tmp/part-include
	echo "part raid.23 --size=5000              --ondisk=sdb" > 
/tmp/part-include

	# '/u' partition (grows to fill disk).
	echo "part raid.14 --size=1     --grow      --ondisk=sda" > 
/tmp/part-include
	echo "part raid.24 --size=1     --grow      --ondisk=sdb" > 
/tmp/part-include

	# Build the RAID arrays
	echo "raid /boot   --fstype ext3 --level=RAID1 --device=md0 raid.10 
raid.20" > /tmp/part-include
	echo "raid /       --fstype ext3 --level=RAID1 --device=md1 raid.11 
raid.21" > /tmp/part-include
	echo "raid swap    --fstype swap --level=RAID0 --device=md4 raid.12 
raid.22" > /tmp/part-include
	echo "raid /backup --fstype ext3 --level=RAID1 --device=md2 raid.13 
raid.23" > /tmp/part-include
	echo "raid /u      --fstype ext3 --level=RAID1 --device=md3 raid.14 
raid.24" > /tmp/part-include
elif [grep -q hda /proc/partitions]; then
	### /dev/sda single
	# '/boot' partition
	echo "part /boot	--size=200	--asprimary	--ondisk=sda" > /tmp/part-include
	# '/' partition
	echo "part /		--size=20000	--asprimary	--ondisk=sda" > /tmp/part-include
	# <swap> partitions
	echo "part swap	--size=1000	--asprimary	--ondisk=sda" > /tmp/part-include
	# '/backup' partition
	echo "part /backup	--size=5000			--ondisk=sda" > /tmp/part-include
	# '/u' partition (grows to fill disk).
	echo "part /u		--size=1	--grow		--ondisk=sda" > /tmp/part-include
fi




More information about the Kickstart-list mailing list