1

How do I execute a command before kickstart parses ks.cfg?

My specific problem is that I want to install redhat into a tmpfs by telling kickstart:

part / --fstype ext3 --size 1000 --maxsize 4000 --ondisk loop1

I've tried doing:

%pre
#!/bin/sh
mkdir /tmp-root
mount -t tmpfs tmpfs /tmp-root
dd if=/dev/zero of=/tmp-root/tmp-root.img bs=4096 count=1000000
losetup /dev/loop1 /tmp-root/tmp-root.img

but that is not done early enough. Ugh!

Update: I'm beginning to think it has nothing to do with being done early enough. I believe it has to do with anaconda and kudzu not thinking that a loopback device is a valid device. I'm not a python guy, so the idea of hacking up the kickstart code sucks!

-Vinnie

Crazy Chenz
  • 195
  • 9

1 Answers1

1

You'll need to %include your disk config, something like this:

%include /tmp/part.ks

%pre 
cat > /tmp/part.ks <<END
part / --fstype ext3 --size 1000 --maxsize 4000 --ondisk loop1
END

mkdir /tmp-root
mount -t tmpfs tmpfs /tmp-root
dd if=/dev/zero of=/tmp-root/tmp-root.img bs=4096 count=1000000
losetup /dev/loop1 /tmp-root/tmp-root.img
James
  • 7,643
  • 2
  • 24
  • 33
  • Hmm... that seems round about... I don't know why that is any more advantageous then hard coding the "part" line in the command section, but I'll try it when I get a chance tomorrow. – Crazy Chenz Jan 13 '10 at 03:26
  • %include directives are special - anaconda parses the kickstart file once, runs all the %pre code, then parses it again to pull in the %include files – James Jan 13 '10 at 15:41