[Fedora-livecd-list] yum in kickstart %post

Brenton Rothchild brentonr at dorm.org
Thu Feb 23 17:37:14 UTC 2006


Hello everyone,

I'm using Kadischi with rawhide and find it incredibly useful.

However, I wanted to run yum in the %post section of a kickstart
script I use.  I ran into a problem where yum attempts to check
the current architecture of its environment by checking
/proc/cpuinfo.  (For the curious, this was to support installing
XFce4 from extras-development).

Like several other generic chroot'd problems/solutions with kickstarts,
I added these before running anaconda in kadischi.py:

+# set up chroot environment if necessary
+if chroot:
+        flc_log ('setting up chroot environment from host to build')
+        os.makedirs (normalize_path([sysdir, 'proc']))
+        os.makedirs (normalize_path([sysdir, 'sys']))
+        run ("mount --bind /proc %s" % (normalize_path([sysdir, 'proc'])), builddir)
+        run ("mount --bind /sys %s" % (normalize_path([sysdir, 'sys'])), builddir)

and immediately after running anaconda in kadischi.py:

+# tear down chroot environment if necessary
+if chroot:
+        flc_log ('tearing down chroot environment')
+        run ("umount %s" % (normalize_path([sysdir, 'proc'])), builddir)
+        run ("umount  %s" % (normalize_path([sysdir, 'sys'])), builddir)

I also added a command-line argument to (--chroot) to control these.

I wanted to add this to kadischi so I didn't have to find a way
to run the %post with "--nochroot" and find a way to propagate the
/tmp/livecd-build_noX/ path into the kickstart somewhere...  Of course
this means you'd have to build the ISO on the same architecture that
you're targeting the ISO installation...

I wondered if anyone else had this problem and a better solution?
Or would anyone find a patch useful?  This was my first time
doing anything in Python, too, so who knows if it's a good way
to implement this type of solution... ;)

I also added a "--nocompress" option to skip the whole mkzftree phase,
since most of the ISOs I generate are below CD-sizes before compression;
I run the ISOs in QEMU from a USB keychain, so speed was becoming an
issue with the compressed images...  Would anyone find this useful
as well?


Thanks!
-Brenton Rothchild




More information about the Fedora-livecd-list mailing list