<?xml version="1.0" encoding="utf-8" ?>
<packagegui>
	<title>Services: Hula</title>
	<name>hula</name>
	<version>3.0</version>
        <donotsave>true</donotsave>
        <preoutput>yes</preoutput>
        <savetext>Change</savetext>
    	<additional_files_needed>
		<item>http://www.pfsense.com/packages/All/hula.tgz</item>
	</additional_files_needed>
	<!-- Menu is where this packages menu will appear -->
	<menu>
	    <name>Hula Setup</name>
	    <tooltiptext>This area will help setup Hula for the first time.</tooltiptext>
	    <section>Services</section>
	    <configfile>hula.xml</configfile>
	</menu>
    	<menu>
	    <name>Hula Admin</name>
	    <tooltiptext>This area will help manage Hula from day to day.</tooltiptext>
	    <section>Services</section>
	    <url>http://$myurl:89</url>
	</menu>
    	<menu>
	    <name>Hula Users</name>
	    <tooltiptext>This area is for user logins.</tooltiptext>
	    <section>Services</section>
	    <url>http://$myurl:8080</url>
	</menu>
        <!-- Do not save invokes a simple input menu and will not update
             the configuration database. -->
	<fields>
	    <field>
		<fielddescr>Hula Default Domain</fielddescr>
		<fieldname>domain</fieldname>
		<description>Enter the default domain that hula will use.</description>
		<type>input</type>
	    </field>
    </fields>
    <custom_add_php_command>
	conf_mount_rw();
	config_lock();
	system("/usr/local/hula/sbin/hulasetup --domain=" . $_POST['domain']);
	system("/usr/local/etc/rc.d/hula.sh &amp;");
	conf_mount_ro();
	config_unlock();
    </custom_add_php_command>
    <custom_php_deinstall_command>
	mwexec("/usr/bin/killall -9 hulamanager");
	rmdir_recursive("/usr/local/hula");
	unlink_if_exists("/usr/local/etc/rc.d/hula.sh");
    </custom_php_deinstall_command>
    <custom_php_install_command>
	$fout = fopen("/usr/local/etc/rc.d/hula.sh","w");
	fwrite($fout, "#!/bin/sh\n\n");
	fwrite($fout, "/sbin/mount -t linprocfs linprocfs /proc\n");
	fwrite($fout, "/usr/local/hula/sbin/hulamanager &amp;\n");
	fclose($fout);
	chmod("/usr/local/etc/rc.d/hula.sh", 0755);
    </custom_php_install_command>
</packagegui>