[ ... ]

> 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. :)

While commuting to work I have cleaned up your script so it is
hopefully much more readable, and it is attached. Some would
think to "leave elegance to tailors" (and RedHat developers seem
to think so, as most of their scripts seem appalling to me), but
I think it helps cope with complexity and maintainability.

text
install
cdrom

lang                    en_US
langsupport             en_US
keyboard                us
timezone                --utc America/Toronto

xconfig                 --resolution 1024x768 --depth 24
                        --startxonboot --defaultdesktop gnome
network                 --device eth0 --bootproto dhcp --hostname 
sysX.example.com

rootpw                  --iscrypted $1$cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
authconfig              --enableshadow --enablemd5
selinux                 --disabled
firewall                --disabled

zerombr                 yes
bootloader              --location=mbr --append="rhgb quiet"

%include                /tmp/ks-partitions

%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


%pre                    --log=/tmp/ks-preinstall.log
#!/bin/sh

KSEXT='/tmp/ks-partitions'

echo > "$KSEXT" '
clearpart               --all --initlabel
ignoredisk              --drives=hda,hdb,hdc,hdd,sda,sdb,sdc,sdd

'

# 3 primary partitions for boot, root and swap, 2 logical for
# backup and user space. The last one is user space so it can be
# specified to grow to take the rest of the disk.

# On some systems we have hw RAID, on some we need to setup sw
# RAID, one some we just have a single un-RAID disk.

if grep -q "cciss/c0d0" /proc/partitions
then echo >> "$KSEXT" '
  part /boot            --ondisk=cciss/c0d0     --size=200      --asprimary
  part /                --ondisk=cciss/c0d0     --size=20000    --asprimary
  part swap             --ondisk=cciss/c0d0     --size=1000     --asprimary
  part /backup          --ondisk=cciss/c0d0     --size=5000
  part /u               --ondisk=cciss/c0d0     --size=1        --grow
'
elif grep -q "cciss/c1d0" /proc/partitions
then echo >> "$KSEXT" '
  part /boot            --ondisk=cciss/c1d0     --size=200      --asprimary
  part /                --ondisk=cciss/c1d0     --size=20000    --asprimary
  part swap             --ondisk=cciss/c1d0     --size=1000     --asprimary
  part /backup          --ondisk=cciss/c1d0     --size=5000
  part /u               --ondisk=cciss/c1d0     --size=1        --grow
'
elif grep -q hdb /proc/partitions
then echo >> "$KSEXT" '
  part boot-1           --ondisk=hda    --size=200      --asprimary
  part boot-2           --ondisk=hdb    --size=200      --asprimary
  part root-1           --ondisk=hda    --size=20000    --asprimary
  part root-2           --ondisk=hdb    --size=20000    --asprimary
  part swap-1           --ondisk=hda    --size=1000     --asprimary
  part swap-2           --ondisk=hdb    --size=1000     --asprimary
  part backup-1         --ondisk=hda    --size=5000
  part backup-2         --ondisk=hdb    --size=5000
  part u-1              --ondisk=hda    --size=1        --grow
  part u-2              --ondisk=hdb    --size=1        --grow

  raid /boot            --level=RAID1   --device=md0    --fstype=ext3   boot-1 
boot-2
  raid /                --level=RAID1   --device=md1    --fstype=ext3   root-1 
root-2
  raid swap             --level=RAID1   --device=md4    --fstype=swap   swap-1 
swap-2
  raid /backup          --level=RAID1   --device=md2    --fstype=ext3   
backup-1 backup-2
  raid /u               --level=RAID1   --device=md3    --fstype=ext3   u-1 u-2
'
elif grep -q hda /proc/partitions
then echo >> "$KSEXT" '
  part /boot            --size=200      --asprimary     --ondisk=hda
  part /                --size=20000    --asprimary     --ondisk=hda
  part swap             --size=1000     --asprimary     --ondisk=hda
  part /backup          --size=5000                     --ondisk=hda
  part /u               --size=1        --grow          --ondisk=hda
'
elif grep -q sdb /proc/partitions
then echo >> "$KSEXT" '
  part boot-1           --ondisk=sda    --size=200      --asprimary
  part boot-2           --ondisk=sdb    --size=200      --asprimary
  part root-1           --ondisk=sda    --size=20000    --asprimary
  part root-2           --ondisk=sdb    --size=20000    --asprimary
  part swap-1           --ondisk=sda    --size=1000     --asprimary
  part swap-2           --ondisk=sdb    --size=1000     --asprimary
  part backup-1         --ondisk=sda    --size=5000
  part backup-2         --ondisk=sdb    --size=5000
  part u-1              --ondisk=sda    --size=1        --grow
  part u-2              --ondisk=sdb    --size=1        --grow

  raid /boot            --level=RAID1   --device=md0    --fstype=ext3   boot-1 
boot-2
  raid /                --level=RAID1   --device=md1    --fstype=ext3   root-1 
root-2
  raid swap             --level=RAID1   --device=md4    --fstype=swap   swap-1 
swap-2
  raid /backup          --level=RAID1   --device=md2    --fstype=ext3   
backup-1 backup-2
  raid /u               --level=RAID1   --device=md3    --fstype=ext3   u-1 u-2
'
elif grep -q sda /proc/partitions
then echo >> "$KSEXT" '
  part /boot            --ondisk=sda    --size=200      --asprimary     
  part /                --ondisk=sda    --size=20000    --asprimary     
  part swap             --ondisk=sda    --size=1000     --asprimary     
  part /backup          --ondisk=sda    --size=5000                     
  part /u               --ondisk=sda    --size=1        --grow          
'
fi
_______________________________________________
Kickstart-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/kickstart-list

Reply via email to