The full process.
Up until now, I've only given snippets of the steps it took to create an RIT Live CD Spin of Fedora 15, so this time I'll detail every step (and issue) I took along the way, along with some of the issues I ran into. To start, there are Live CD creation tools provided to you for creating Fedora Live CDs that are pretty much automated, but setting up the configuration of the Live CD is what can be tricky. Before we can really begin, we need to install the tools needed for creating our spin. You can get these tools by grabbing the following packages.
sudo yum -y install spin-kickstarts livecd-tools
Next, we need our own kickstart file. We can start with a basic kickstart file as shown below.
%include /usr/share/spin-kickstarts/fedora-live-desktop.ks
%include /usr/share/spin-kickstarts/fedora-live-minimization.ks
%packages
%end
%post
%end
This is pretty much the most basic of kickstart files that can be used. These kickstart files effectively define how the Live CD will be created, and are the tool you use for customizing your spin. First, the
%include
statement is used to pull in other made kickstart files. A basic spin can get nearly all of the groundwork done by just pulling in the two kickstart files shown above, provided that you don't mind the default Live CD environment.
The next step is defining the applications you want in your spin. Add every desired package in the
%packages section
. For example, no RIT student can live without emacs and pidgin, so I'll toss those packages in.
%packages
emacs
pidgin
%end
Because the creation process creates a filesystem to be put on a non-rewritable media, it's important to get all your customization done in the kickstart file. There is a useful area of the file, the
%post
section, that allows you to run commands to customize the environment before the creation process runs
mksquashfs
to make things final, stuffing it all into a nice iso package. For the RIT spin, we wanted a few little features, such as having default RIT bookmarks for Firefox, and some nice RIT default wallpaper.
To tackle the bookmarks, I had to poke around a bit at the guts of Firefox 6 to see how bookmarks are stored. When firefox runs, it creates a default profile for the user, and stores bookmarks in an
sqlite
database. While it would have been easy to set some bookmarks, and just copy the
.sqlite
file for later use, I noticed that Firefox computes a random hash for the user profile folder, making it pretty much impossible to be able to predict the folder of the default profile for any given user. I then looked into how these
.sqlite
databases are being generated.
Firefox 6 contains an archive called
omni.jar
, located in /usr/lib/firefox-6 that effectively has a
bookmarks.html
file inside, defining the bookmarks hierarchy that is used to generate the inital sqlite database for each profile. In order to change this, it is necessary to unzip the archive, swap in the
bookmarks.html
file (
here's mine), and finally zip it back up. To do this I put my own script into the
%post
section of the kickstart file. The script I use to do this can be
found here.
Lastly, I had to change the default wallpaper for the spin. The first step to getting this to work was to get the wallpapers on the newly created filesystem (before
mksquashfs
runs) to be used. While it's possible to create your own package to include, I decided it might be easier to just look for a swapping command. Because Fedora 15 runs gnome3, it was tempting to use the
gsettings
command to set the background, but this won't do anything. (One approach that may work is creating a startup script to do just that, but
gsettings
cannot be run without the user being logged in and gnome initialized. Therefore, it won't work in the
%post
section of the kickstart file.)
Instead, I decided to write a script that safely tuck away the default Fedora 15 backgrounds (there are three versions of it), and swap in
my own wallpapers for them. It's a bit hackish, but at least the wallpaper will appear on the the default startup, and this way, I don't have to create a whole new package and tinker with the various
.xml
configuration files to change the default location. Note that
wget
is necessary to add as a package to grab the files that I had hosted (probably the easiest way to pull in file needed by the
%post
scripts). Furthermore, livecd users are not added to the sudoers file, so it's easiest just to run a
su -c "command"
to get the job done, as the background folder contents does require root permissions to alter.
Something to note as well is that Fedora 15 has 3 default wallpapers, each with different resolutions that reside in their own folders. It's a good idea to do the same with your own.
A last feature I wished to add to the spin is a prompt to ask if the user would like to run the live cd with
RPM Fusion enabled. Obviously, much of the software out there that provides a user with a normal experience is proprietary, and won't be put on the spin by default. Instead, the user should have the ability to quickly fetch and enable these packages.
I created a
simple pygtk2 launcher that runs a simple
fetch script for RPM Fusion (Note, the prior is a python script, and the latter is a fetch script, so simply rename the extension if you pull them from my public webspace). Adding scripts to the startup routine is trivial... if you have access to the gsettings command. My first approach was to add my script to init.d, but this approach will not work. A second approach I took was to attempt to pull a customized bash_profile which launches the prompt on login, and tosses it into the user folder. However, this will not work either, because the liveusr profile will not be created at the time of %post, and therefore, it is not possible to modify its bash_profile. This feature will require a little more exploration.
Given more time for refinement, a better approach would be to make a proper package for the wallpapers, but if you have to get it done quickly (and with the long creation process), this quick-and-dirty method should get things set just fine. Overall, however, the process is fairly straight forward, and most of the difficulties come from the fact that you don't have too much wiggle room on the temporary filesystem customization.
The final kickstart file I use for the RIT spin can be
found here. If you wish to contribute to the spin project, or make your own based on what I have, feel free to fork the public repo.