Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

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
share|improve this answer
    
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 3: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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.