"dspam.sh", "start" => $start, "stop" => $stop ) ); conf_mount_ro(); config_unlock(); if (! file_exists("/usr/local/etc/dspam.conf")) { mwexec("ln -s /etc/dspam.conf /usr/local/etc/dspam.conf"); } mwexec("/usr/local/etc/rc.d/dspam.sh stop"); mwexec("/usr/local/etc/rc.d/dspam.sh start"); return 0; } function dspam_configure() { global $config, $g; $dspamcfg = $config['installedpackages']['dspam']['config'][0]; if ($g['booting']) echo "Starting DSPAM service... "; else sleep(1); /* write dhcpd.conf */ $fd = fopen("/usr/local/etc/dspam.conf", "w"); if (!$fd) { printf("Error: cannot open dhcpd.conf in services_dhcpd_configure().\n"); return 1; } $dspamconf = << 0) { $dspamconf .= "Algorithm\t\t"; foreach ($t_algos as $algo) { $dspamconf .= "{$algo['name']} "; } $dspamconf .= "\n"; } $dspamconf .= "PValue\t\t\t{$dspamcfg['pvalue']}\n"; isset($dspamcfg['improbability-drive']) ? $dspamconf .= "ImprobabilityDrive\ton\n" : $dspamconf .= "ImprobabilityDrive\toff\n"; $t_prefs = &$dspamcfg['preference']; foreach ($t_prefs as $pref) { $dspamconf .= "Preference\t\t{$pref['value']}\n"; } $t_overr = &$dspamcfg['override']; foreach ($t_overr as $over) { $dspamconf .= "AllowOverride\t\t{$over['value']}\n"; } if (isset($dspamcfg['ldap-enable'])) { $dspamconf .= << "") { $dspamconf .= << "") { $dspamconf .= "ClientPort\t\t{$dspamcfg['dspam-client-port']}\n"; } } $dspamconf .= "## EOF\n"; fwrite($fd, $dspamconf); fclose($fd); /* fire up dspam --daemon */ mwexec("/usr/local/etc/rc.d/dspam.sh stop"); mwexec("/usr/local/etc/rc.d/dspam.sh start"); if ($g['booting']) { print "done.\n"; } return 0; } function custom_php_install_command() { global $config, $g; /* create a default config */ sync_package_dspam(); } function custom_php_deinstall_command() { global $config, $g; conf_mount_rw(); unlink_if_exists("/usr/local/etc/rc.d/dspam.sh"); unlink_if_exists("/usr/local/etc/dspam.conf"); unlink_if_exists("/usr/local/bin/dspam_spamfeed"); unlink_if_exists("/usr/local/bin/dspam_innocentfeed"); conf_mount_ro(); } ?>