[Fedora-livecd-list] Support for custom configuration using python templates

John (J5) Palmieri johnp at redhat.com
Tue Apr 24 18:53:57 UTC 2007


This is the first in a bunch of OLPC needs I will be writing about on
the list.  It is super simple for me to hack up solutions that work for
us but I would like to find a common solution that benefits all Fedora
based projects.

One of the things we need to for OLPC from the LiveCD creator is the
ability to output configuration files from a template.  We do this
currently in Pilgrim and can do this in the LiveCD tools via the %post
as shell scripts.  This is pretty unwieldy and tends to be error prone
with typos and missing character escapes causing sometimes hard to debug
problems.  

A simple idea is to have standard template mechanism such as using
pythons string substitutions. For example take the file /etc/issue.  In
shell we do this:

cat <<EOF > $INSTALL_ROOT/etc/issue
OLPC build $BUILD (stream $STREAM; variant $VARIANT)
Kernel \r on an \m
EOF

It would be nice to have a template file which read something like:

OLPC build %(build) (stream %(stream); variant %(variant))
Kernel \r on an \m

and simply passed in a hash with substitutions from the livecd tools. 

Python templates or whatever templates is not really the issue here.
What is the issue is defining a standard template format to use,
defining how the tool finds the templates and defining how substitutions
are specified. 

Any suggestions?  I am willing to do the code myself but in the lack of
any interest I'm going to end up creating a one off solution, so mucho
input is desired.

-- 
John (J5) Palmieri <johnp at redhat.com>




More information about the Fedora-livecd-list mailing list