%include issues

Spike White spikewhitetx at gmail.com
Sat Oct 4 21:50:39 UTC 2014


> What I would like to is make a single kickstart file that could be used
for both Cobbler/net based and DVD based installations.  I added > some
logic to the %pre section to adjust but it doesn’t seem to be working.
Logic is listed below.   The logic works when I test it

> outside of kickstart but the kickstart doesn’t seem to be interpreting
the $basepath variable.  When I interrupt a kickstart using a ctl-f2

> and look at /tmp/ks.cfg it just shows the base kickstart file and not an
interpreted one.  Any help would be appreciated.  If any ideas on

> how to accomplish the same thing are out the please let me know.

>

> %pre

> #!/bin/bash

> if [ `/bin/grep cdrom /proc/cmdline | wc -l` -gt 0 ]

> then

> touch /tmp/yes_cdrom

> basepath=/mnt/stage2/ks/

> else

> touch /tmp/no_cdrom

> basepath=http://10.0.0.100/

> fi

> %include "${basepath}includes/disk_choose"




Don't think you can use %include in a %pre section.  As this section is
being parsed by /bin/bash.  But you can accomplish the

same effect by using bash-based syntax.


[[ -f /tmp/yes_cdrom ]] && cat ${basepath}includes/disk_choose >
/tmp/disk_choose || (cd /tmp; wget ${basepath}includes/disk_choose)


then in your main ks.cfg section:


     %include /tmp/disk_choose


Spike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/kickstart-list/attachments/20141004/54ad77fe/attachment.htm>


More information about the Kickstart-list mailing list