On 11/09/12 15:12, Bai Shen wrote:
This is the snippet I'm attempting to get to work. I am calling
it in
place of the autopart command in the sample kickstart.
Did you get this working?
If not yet, the reason will be that 'autopart' is a built-in kickstart
instruction to anaconda and is not shell or cheetah code like the
excerpt below.
This should be in a %pre script and all the 'part' statements should be
directed to /tmp/partitions (or another file of your choice), then you
include that later. See my amendments below
# amended from here...
%pre
#set $vgname = "VolGroup00"
set \$(list-harddrives)
let numd=\$#/2
d1=\$1
d2=\$3
d3=\$5
d4=\$7
cat > /tmp/partitions << END_PARTS
part /boot --fstype ext3 --size=500 --asprimary --ondisk=\$d1
part swap --size=4000 --asprimary --ondisk=\$d1
part pv.00 --size=100 --grow --asprimary --ondisk=$\d1
volgroup $vgname pv.00
logvol / --vgname=$vgname --size=100000 --name=sysroot --fstype ext3
logvol /home --vgname=$vgname --size=5000 --name=home --fstype ext3
logvol /opt --vgname=$vgname --size=5000 --name=opt --fstype ext3
part /data1 --fstype ext3 --size=1000000 --ondisk=\$d2
part /data2 --fstype ext3 --size=1000000 --ondisk=\$d3
part /data3 --fstype ext3 --size=1000000 --ondisk=\$d4
END_PARTS
# end of amendments
Now you simply change the original 'autopart' statement to
%include /tmp/partitions
That will be BEFORE the %pre script, in the first section of the
kickstart (where normal kickstart instructions go)
I believe there are examples of this in the default included snippets?
tbh, it really helps if you understand how kickstarts work and the order
in which things happen...
http://fedoraproject.org/wiki/Anaconda/Kickstart
Should help with that. The basic process is:
1. Boot (which launches the first stage of anaconda, in your initrd)
2. configure networking (usually DHCP or from boot arguments like
ip=X.X.X.X
3. download the larger second stage of anaconda
- this may be on some boot ISOs already
if not it comes from the images directory in your installation tree
4. request kickstart file
- cobbler will process the kickstart file and substitute all the
cheetah code with appropriate output
- the downloaded file is stored as /tmp/ks.cfg in the installation
environment
5. parse the kickstart file and run any %pre scripts
- you can even edit the kickstart file in here if you want.
Odd, I know, but sometimes useful)
6. re-parse the kickstart file, processing the %include statements etc
7. partition and install
8. run %post --nochroot scripts
9. chroot into /mnt/sysimage (your new system installation is mounted here)
10. run any other %post scripts
11. finish and probably reboot.
Regards,
Stuart
--
Stuart Sears RHCA etc.
"It's today!" said Piglet.
"My favourite day," said Pooh.