diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/havp.inc | 56 | ||||
-rw-r--r-- | packages/havp.xml | 15 |
2 files changed, 36 insertions, 35 deletions
diff --git a/packages/havp.inc b/packages/havp.inc index 631db0e3..6b112c03 100644 --- a/packages/havp.inc +++ b/packages/havp.inc @@ -19,36 +19,30 @@ function sync_package_havp() { fwrite($fd, "ENABLETROPHIE false\n"); fwrite($fd, "ENABLENOD32 false\n"); fwrite($fd, "ENABLEAVAST false\n"); - foreach($config['installedpackages']['havp']['config'] as $tmp) { - fwrite($fd,"SERVERNUMBER " . $tmp['servernumber'] . "\n"); - fwrite($fd,"MAXSERVERS " . $tmp['maxservers'] . "\n"); - fwrite($fd,"PORT " . $tmp['port'] . "\n"); - if ($tmp['bind_address'] <> "") - fwrite($fd,"BIND_ADDRESS " . $tmp['bind_address'] . " \n"); - if ($tmp['source_address'] <> "") - fwrite($fd,"SOURCE_ADDRESS " . $tmp['source_address'] . " \n"); - if ($tmp['transparent'] == "on"){ - fwrite($fd,"TRANSPARENT true\n"); - } - else { - fwrite($fd,"TRANSPARENT false\n"); - } - if ($tmp['range'] == "on"){ - fwrite($fd,"RANGE true\n"); - } - else { - fwrite($fd,"RANGE false\n"); - } + if($config['installedpackages']['havp']['config'] != "") { + foreach($config['installedpackages']['havp']['config'] as $tmp) { + if ($tmp['servernumber'] != "") fwrite($fd,"SERVERNUMBER " . $tmp['servernumber'] . "\n"); + if ($tmp['maxservers'] != "") fwrite($fd,"MAXSERVERS " . $tmp['maxservers'] . "\n"); + if ($tmp['port'] != "") fwrite($fd,"PORT " . $tmp['port'] . "\n"); + if ($tmp['bind_address'] != "") fwrite($fd,"BIND_ADDRESS " . $tmp['bind_address'] . " \n"); + if ($tmp['source_address'] != "") fwrite($fd,"SOURCE_ADDRESS " . $tmp['source_address'] . " \n"); + + if ($tmp['transparent'] == "on"){ + fwrite($fd,"TRANSPARENT true\n"); + } + else { + fwrite($fd,"TRANSPARENT false\n"); + } + + if ($tmp['range'] == "on"){ + fwrite($fd,"RANGE true\n"); + } + else { + fwrite($fd,"RANGE false\n"); + } + } } fclose($fd); - $start = "/usr/local/sbin/havp &\n"; - $stop = "/usr/bin/killall havp\n" . "sleep 2"; - write_rcfile(array( - "file" => "havp.sh", - "start" => $start, - "stop" => $stop - ) - ); conf_mount_ro(); config_unlock(); unlink_if_exists("/usr/local/etc/havp/havp.config"); @@ -65,14 +59,18 @@ function havp_install_command() { mwexec ("chown havp:havp /var/log/havp"); mwexec ("chown havp:havp /var/tmp/havp"); mwexec ("chown havp:havp /var/run/havp"); + mwexec ("cp /usr/local/pkg/havp.sh /usr/local/etc/rc.d/"); + mwexec ("chmod +x /usr/local/etc/rc.d/havp.sh"); sync_package_havp(); } function havp_deinstall_command() { global $config, $g; + mwexec("/usr/local/etc/rc.d/havp.sh stop"); conf_mount_rw(); unlink_if_exists("/usr/local/etc/rc.d/havp.sh"); unlink_if_exists("/usr/local/etc/havp/havp.config"); + unlink_if_exists("/etc/havp.config"); conf_mount_ro(); } function sync_package_havp_whitelist() { @@ -104,4 +102,4 @@ function sync_package_havp_blacklist() { conf_mount_ro(); config_unlock(); } -?>
\ No newline at end of file +?> diff --git a/packages/havp.xml b/packages/havp.xml index 8f278a4a..b1e442f1 100644 --- a/packages/havp.xml +++ b/packages/havp.xml @@ -3,12 +3,12 @@ <version>0.1</version> <title>Havp: Settings</title> <include_file>/usr/local/pkg/havp.inc</include_file> - + <aftersaveredirect>/pkg_edit.php?xml=havp.xml&id=0</aftersaveredirect> <menu> <name>HAVP</name> <section>Services</section> <tooltiptext>Modify HAVP settings.</tooltiptext> - <url>/pkg_edit.php?xml=havp.xml&act=edit&id=0</url> + <url>/pkg_edit.php?xml=havp.xml&id=0</url> <configfile>havp.xml</configfile> </menu> @@ -20,7 +20,7 @@ <tabs> <tab> <text>Settings</text> - <url>/pkg_edit.php?xml=havp.xml&act=edit&id=0</url> + <url>/pkg_edit.php?xml=havp.xml&id=0</url> <active/> </tab> <tab> @@ -48,6 +48,11 @@ <chmod>0755</chmod> <item>http://agni.linuxense.com/packages/config/havp_blacklist.xml</item> </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://agni.linuxense.com/packages/config/havp.sh</item> + </additional_files_needed> <configpath>['installedpackages']['havp]['config']</configpath> @@ -67,7 +72,7 @@ <field> <fielddescr>Transparent?</fielddescr> <fieldname>transparent</fieldname> - <description>Run HAVP as transparent Proxy?</description> + <description>Run HAVP as transparent Proxy? [Broken now, sorry]</description> <type>checkbox</type> <value>yes</value> </field> @@ -101,9 +106,7 @@ <custom_php_install_command> havp_install_command(); </custom_php_install_command> <custom_php_deinstall_command> havp_deinstall_command(); </custom_php_deinstall_command> - <custom_delete_php_command> sync_package_havp(); </custom_delete_php_command> <custom_php_resync_config_command> sync_package_havp(); </custom_php_resync_config_command> - <custom_add_php_command> sync_package_havp(); </custom_add_php_command> </packagegui> |