[ale] [ALE] Any Kickstart Guru's In the House

Derek Carter (aka goozbach) goozbach at friocorte.com
Tue May 22 21:40:10 EDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/22/2012 01:42 PM, Derek Carter (aka goozbach) wrote:
> you may want to try something like this in you %pre
> 
> # copy the files to the system root so they are accessible in
> %post while : ; do logger "sleeping for kickstartfiles mount to be
>  available" sleep 10 if [ -d /mnt/sysimage/root ]; then cp -a 
> /tmp/foo /mnt/sysimage/tmp/foo # store the installer args cat 
> /proc/cmdline > /mnt/sysimage/installed-version logger "Copied 
> kickstartfiles to system" break fi done &
> 
> (snippet lovingly stolen from Cobbler's stock templates).
> 
> PS are you me? I'm currently debugging a centos5 kickstart 
> migration to centos6? :)
> 
> PPS apparently 'seq' doesn't exist in the centos6 install image.
> 
> PPPS and the default env of %pre is /bin/sh instead of /bin/bash
> 
> PPPPS I hope this info helps.

Today I also discovered that doing something like this in a '%pre'
section is a bad idea, as centos6 waits until all pre scripts are
finished before moving on to steps such as mounting the system image
(see the problem there?).

Apparently the better way to do this is to have the above stanza be in
a first %post script with the --nochroot flag like so:


- ----------------------
%end
#end of packages

#start of first %post
%post --nochroot
#!/usr/bin/bash
while : ; do
     logger "sleeping for kickstartfiles mount to be available"
     sleep 10
     if [ -d /mnt/sysimage/root ]; then
         cp -a /tmp/foo /mnt/sysimage/tmp/foo
         # store the installer args
         cat /proc/cmdline > /mnt/sysimage/installed-version
         logger "Copied kickstartfiles to system"
         break
     fi
done &
%end
#end of first %post

#start of second post
%post
echo "this is run inside the new installation's chroot"

#<snip> remainder of your %post script

%end
- ------------------------------------

Hope that helps...

- --
Derek
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPvD/mAAoJECcWlbcE84qz7jEP/iMgo73Uslmiw2FKmBsPy+Nl
jZsY6mv6N7mu52Jmd2WQZDvgToz36XpmiP/wUG65soANFDxZi5ZBcNA8v04vLPy3
O1Kb/yQHxd7IAn6PZreyOj22+YNwBfg8O7v7u5wTArXEzek+O8YbAlWmSKozSwVy
Q/pC8ZJFiP/q9dKlzTzJw848Q7u9rXjuweE5OzZJMiB3eZX47TpMyGvNHrue3bX/
MCbB56Ga59Gjwd3uSuCi2wjRdKCwgmpyRc3kcrtiBsGk47vf6KUGUPIeB/HPU+QZ
rJsyYmT9EVuKIA1aa4woKpwK1+4bhSviknsArmENb0Bd9cKGtk1Kf0XUBTXg2NHk
IfEQBs2amQicfswxlMWA/ybjxh6YPlAIx5H8O7tBk+45oHoKtWKOdC1PWb7LfZ7M
zAXscSP8RZWjGrtm/VuQeFjVH0bgsBtmsqmr7OAHdcbni5o/ep19DRsCJCu1Zh4J
5+K9Ef+uak88FC74LaKwOcBalwtNMJRvYvjXUmTVQninaNlzxTG1E/jWxK0hpGeU
5NqQXy5LEbj5/zzDnz+kDLC4zKGl+5Eu0sMWsCWG6Q921idued8taukv+AKy7EQM
f3wDCVjcQmh4vzI8MpnzmMOuYh5eEXJRvI7yh51yFnogd4Ne4DBRFHYGMeWgnlYT
lZF9fAFn1556X8MDugJP
=VIyT
-----END PGP SIGNATURE-----


More information about the Ale mailing list