jails2xml ready for review!

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.

Short description:
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"?>
<jails>
<jail>
<hostname>xxx</hostname>
<ip>192.168.xxx.xxx</ip>
<rootdir>/usr/jail/xxx</rootdir>
<exec>/bin/sh /etc/rc</exec>
<mount_enable>YES</mount_enable>
<devfs_enable>YES</devfs_enable>
<devfs_ruleset>devfsrules_jail</devfs_ruleset>
<procfs_enable>YES</procfs_enable>
<fdescfs_enable>YES</fdescfs_enable>
</jail>
<host>
<hostname>xxx.xxx</hostname>
<release>8.0-RELEASE-p2</release>
<allinfo>FreeBSD xxx.xxx 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Tue Jan  5 16:02:27 UTC 2010     [nohide]root@i386-builder.daemonology.net[/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]root@i386-builder.daemonology.net[/nohide]:/usr/obj/usr/src/sys/GENERIC </verbose>
</host>
<generated>Tue Apr  6 20:02:39 CEST 2010</generated>
</jails>

And just to make sure I am clear about this. This is for FreeBSD systems running jails via the ezjail administration framework.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *