<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd">
<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?>
<packagegui>
    <description>Jail management</description>
    <requirements>Disk space...</requirements>
    <faq>Currently there are no FAQ items provided.</faq>
	<name>pfJailctl</name>
	<version>0.1</version>
	<title>Jails</title>
	<!-- Menu is where this packages menu will appear -->
	<menu>
		<name>Jails</name>
		<tooltiptext>Jail management</tooltiptext>
		<section>Services</section>
		<configfile>jailctl.xml</configfile>
	</menu>
	<service>
		<name>Jails</name>
		<rcfile>jails.sh</rcfile>
		<description>All jails with autostart enabled.</description>
		<custom_php_service_status_command>
			include("/usr/local/pkg/jailctl.inc");
			jailctl_servicestatus();
		</custom_php_service_status_command>
	</service>
	<!-- configpath gets expanded out automatically and config items will be
	 stored in that location -->
	<configpath>['installedpackages']['$packagename']['config']</configpath>
	<additional_files_needed>
		<prefix>/usr/local/pkg/</prefix>
		<chmod>0644</chmod>
		<item>https://packages.pfsense.org/packages/config/jailctl/jailctl_defaults.xml</item>
	</additional_files_needed>	
	<additional_files_needed>
		<prefix>/usr/local/pkg/</prefix>
		<chmod>0644</chmod>
		<item>https://packages.pfsense.org/packages/config/jailctl/jailctl_settings.xml</item>
	</additional_files_needed>	
	<additional_files_needed>
		<prefix>/usr/local/pkg/</prefix>
		<chmod>0644</chmod>
		<item>https://packages.pfsense.org/packages/config/jailctl/jailctl.inc</item>
	</additional_files_needed>	
	<additional_files_needed>
		<prefix>/usr/local/pkg/</prefix>
		<chmod>0644</chmod>
		<item>https://packages.pfsense.org/packages/config/jailctl/jailctl-utils.inc</item>
	</additional_files_needed>
	<additional_files_needed>
		<prefix>/usr/local/pkg/</prefix>
		<chmod>0644</chmod>
		<item>https://packages.pfsense.org/packages/config/jailctl/jailctl_list.inc</item>
	</additional_files_needed>
	<additional_files_needed>
		<prefix>/usr/local/sbin/</prefix>
		<chmod>0755</chmod>
		<item>https://packages.pfsense.org/packages/config/jailctl/jailctl</item>
	</additional_files_needed>	
	<additional_files_needed>
		<prefix>/usr/sbin/</prefix>
		<chmod>0755</chmod>
		<item>https://packages.pfsense.org/packages/config/jailctl/sysinstall</item>
	</additional_files_needed>
	
	<tabs>
		<tab>
			<text>Jails</text>
			<url>/pkg.php?xml=jailctl.xml</url>
			<active/>
		</tab>
		<tab>
			<text>Global settings</text>
			<url>/pkg_edit.php?xml=jailctl_settings.xml&amp;id=0</url>
		</tab>
<!--		<tab>
			<text>Jail defaults</text>
			<url>/pkg_edit.php?xml=jailctl_defaults.xml&amp;id=0</url>
		</tab> -->
	</tabs>


	<adddeleteeditpagefields>
		<columnitem>
			<fielddescr>State</fielddescr>
			<fieldname>jstate</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>Jail name</fielddescr>
			<fieldname>jname</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>Jail IF</fielddescr>
			<fieldname>jifdesc</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>Jail IP</fielddescr>
			<fieldname>jip</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>Jail path</fielddescr>
			<fieldname>jpath</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>Actions</fielddescr>
			<fieldname>jactions</fieldname>
		</columnitem>

	</adddeleteeditpagefields>

	<fields>
	<field>
		<fielddescr>Jail hostname</fielddescr>
		<fieldname>jname</fieldname>
		<description>FQDN of the jail</description>
		<type>input</type>
	</field>
	<field>
		<fielddescr>Network interface</fielddescr>
		<fieldname>jif</fieldname>
		<description>Jail will be bound to this interface</description>
		<type>interfaces_selection</type>
	</field>
	<field>
		<fielddescr>IP address</fielddescr>
		<fieldname>jip</fieldname>
		<description>Must be in the same subnet as the parent interface</description>
		<type>input</type>
	</field>
	<field>
		<fielddescr>Autostart jail on boot?</fielddescr>
		<fieldname>jautostart</fieldname>
		<description>Start this jail automatically when the system boots?</description>
		<type>checkbox</type>
	</field>
	
	
	<field>
		<fielddescr>Jail templates</fielddescr>
		<fieldname>jselect_templates</fieldname>
		<type>listtopic</type>
		<name>Select a predefined template for your jail:</name>
	</field>
	<field>
		<fielddescr>Templates</fielddescr>
		<fieldname>jtemplates</fieldname>
		<description>Files from the templates will be read-only inside the jail.</description>
		<type>select</type>
		<options>
			<option><name> --- select --- </name><value></value></option>
		</options>
		<default_value>jtemplate_default</default_value>
	</field>
		<field>
		<fielddescr>Use unionfs</fielddescr>
		<fieldname>juse_unionfs</fieldname>
		<description>Use unionfs instead of nullfs to mount the template contents into the jail</description>
		<type>checkbox</type>
	</field>

	<field>
		<fielddescr>Package sets</fielddescr>
		<fieldname>jselect_sets</fieldname>
		<type>listtopic</type>
		<name>OR select a distribution set to install:</name>
	</field>
	<field>
		<fielddescr>Distribution sets</fielddescr>
		<fieldname>jdistset</fieldname>
		<description>Select a standard set of distributions to install</description>
		<type>select</type>
		<options>
			<option><name> --- select --- </name><value></value></option>
			<option><name>User (binaries only)</name><value>distSetUser</value></option>
			<option><name>Developer (src/all, binaries)</name><value>distSetDeveloper</value></option>
			<option><name>Kernel developer (src/kern, binaries)</name><value>distSetKernDeveloper</value></option>
			<option><name>Minimum (minimal binaries)</name><value>distSet</value></option>
		</options>
		<default_value></default_value>
	</field>

	<field>
		<fielddescr>Individual packages</fielddescr>
		<fieldname>jselect_individual</fieldname>
		<type>listtopic</type>
		<name>OR select individual distributions in addition to 'base':</name>
	</field>

	<field>
		<fielddescr>Individual distributions</fielddescr>
		<fieldname>jdists</fieldname>
		<description>Select individual distributions (multiple selection)</description>
		<type>select</type>
		<options>
			<option><name>Manual pages</name><value>manpages</value></option>
			<option><name>The Ports collection</name><value>ports</value></option>
			<option><name>Miscellaneous documentation</name><value>doc</value></option>
			<option><name>Local additions collection</name><value>local</value></option>
			<option><name>X.org client binaries</name><value>Xbin</value></option>
			<option><name>X.org libraries</name><value>Xlib</value></option>
			<option><name>X.org manual pages</name><value>Xman</value></option>
			<option><name>X.org imake distribution</name><value>Xprog</value></option>
			<option><name>Games</name><value>games</value></option>
		</options>
		<multiple/>
	</field>
	
	</fields>


	<!-- php hooks -->
	<include_file>/usr/local/pkg/jailctl_list.inc</include_file>
	<custom_add_php_command>
		sync_package_jailctl();
	</custom_add_php_command>
	<custom_delete_php_command>
		jailctl_delete();
	</custom_delete_php_command>
	<custom_php_resync_config_command>
		sync_package_jailctl();
	</custom_php_resync_config_command>
	<custom_php_install_command>
		jailctl_install();
	</custom_php_install_command>
	<custom_php_deinstall_command>
		jailctl_deinstall();
	</custom_php_deinstall_command>
	<custom_php_after_form_command>
		jailctl_addinterfaces($config);
		jailctl_addtemplates($config);
	</custom_php_after_form_command>
</packagegui>