<?xml version="1.0" encoding="utf-8" ?>
<packagegui>
	<title>BSDStats</title>
	<name>bsdstats</name>
	<version>0.1</version>
	<!-- Menu is where this packages menu will appear -->
	<menu>
		<name>BSDStats</name>
		<tooltiptext>BSDStats</tooltiptext>
		<url>http://bsdstats.hub.org/</url>
		<section>Diagnostics</section>
	</menu>
	<custom_php_install_command>
		system("/bin/mkdir -p /usr/local/etc/periodic/monthly/");
		system("/usr/bin/fetch -q -o /usr/local/etc/periodic/monthly/ http://www.bsdstats.org/downloads/300.statistics");
		system("/bin/chmod a+rx /usr/local/etc/periodic/monthly/300.statistics");
		if(!is_file("/usr/local/etc/periodic/monthly/300.statistics") {
			update_status("Could not fetch 300.statistics from bsdstats.org");
			update_output_window("Install failed. Please check dns, etc");
			exit;
		}
		system("echo monthly_statistics_report_devices=yes >> /etc/periodic.conf");
		system("echo monthly_statistics_enable=yes >> /etc/periodic.conf");
		mwexec_bg("/usr/local/etc/periodic/monthly/300.statistics");
	</custom_php_install_command>
	<custom_php_deinstall_command>
		system("/bin/cat /etc/periodic.conf | grep -n \"monthly_statistics_report_devices\" >/tmp/periodic.conf");
		system("/bin/cat /tmp/periodic.conf | grep -n \"monthly_statistics_enable\" >/etc/periodic.conf");
		system("/bin/rm /usr/local/etc/periodic/monthly/300.statistics");
		system("/bin/rm /tmp/periodic.conf");
		system("/bin/rm /tmp/getid");
	</custom_php_deinstall_command>
	<additional_files_needed>
		<prefix>/usr/bin/</prefix>
		<chmod>077</chmod>
		<item>http://www.pfsense.com/packages/config/bsdstats/bin/dig</item>
	</additional_files_needed>
</packagegui>