Ok, so after som nice flow and a whole lot of code cleanup I think it is actually presentable now.
So without any further ado, get a copy at http://kosmos.ttyv0.se/attachments/download/41/jails2xml.sh , give it a try and please give me some feedback.
There are a couple of things to be added and updated, this is not “finished”. (like splitting config options at the top to a separate file and giving better granularity to the host info added to the xml.)
But I wanted the chance to get feedback as soon as possible and also might not have as much time to work on this as I would like for a while.
This script will with its default options run through your /usr/local/etc/ezjail/ directory and add all the set options for each jail to an xml file called jails.xml in the current directory.
It will also add some info about the host system, and the time of creation of the xml.
So far tested successfully on systems running 7.2-R and 8.0-R.
An anonymized sample of a jails.xml with a single jail configured on the host:
<?xml version="1.0" encoding="iso-8859-1"?>
<allinfo>FreeBSD xxx.xxx 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Tue Jan 5 16:02:27 UTC 2010 [nohide]email@example.com[/nohide]:/usr/obj/usr/src/sys/GENERIC i386</allinfo>
<verbose>FreeBSD 8.0-RELEASE-p2 #0: Tue Jan 5 16:02:27 UTC 2010 [nohide]firstname.lastname@example.org[/nohide]:/usr/obj/usr/src/sys/GENERIC </verbose>
<generated>Tue Apr 6 20:02:39 CEST 2010</generated>
And just to make sure I am clear about this. This is for FreeBSD systems running jails via the ezjail administration framework.