On 3/14/06, Will McDonald <wmcdonald@xxxxxxxxx> wrote: > On 14/03/06, Aleksandar Milivojevic <alex@xxxxxxxxxxxxxxx> wrote: > > Quoting Will McDonald <wmcdonald@xxxxxxxxx>: > > > > > I was just wondering how (or indeed if) people use the %include > > > directive in Kickstart configuration files when building systems via > > > NFS. I've been trying to modularise our Kickstart files a little to > > > make things more readable, having generic defaults and role specific > > > stuff split out into separate configs. > > > > The %include directives are parsed two times by Anaconda. First time > > before %pre scripts are executed, and then after %pre scripts are > > executed. The missing files are ignored on the first parsing of > > kickstart file. However, Anaconda will complain if they are missing > > when it parses the file for the second time (just after %pre scripts > > are executed). This allows you to create those files dynamically from > > the %pre scripts (or make them accessible if already stored somewhere). > > You must ensure that all files referenced by %include directives > > exist and are accessible by the time %pre scripts finish (for example, > > by creating the file in %pre script or by NFS mounting the directories > > where they live from %pre script). > > > > If else fails, you can always copy the files locally using %pre script... > > Excellent, I hadn't thought of using %pre but from the sounds of it > that'll allow me to keep all the configs broken out into sections. > > Cheers Aleksandar. > > Will. > _______________________________________________ > CentOS mailing list > CentOS@xxxxxxxxxx > http://lists.centos.org/mailman/listinfo/centos > Another useful trick is to pass options in via the kickstart command-line. Within your %pre and %post you can read these options from /proc/cmdline, then source them into your script. For example, we use this to configure static IPs without having to hard-code them. Consider the following three lines: cat /proc/cmdline | sed 's/ /\ export /g' | grep '^export myemployer_' | grep = > /tmp/myemployer_cfg source /tmp/myemployer_cfg If the kickstart command-line included 'myemployer_staticip=192.168.0.42 myemployer_foobar=exnage', the contents of myemployer_cfg would be: myemployer_staticip=192.168.0.42 myemployer_foobar=exnage After you've source'd /tmp/myemployer_cfg, the variables $myemployer_staticip and $myemployer_foobar will be available to you.