Commit c1628bbf authored by Franco Fichtner's avatar Franco Fichtner

miniupnpd: add enabled helper

parent 78945ce0
...@@ -26,33 +26,39 @@ ...@@ -26,33 +26,39 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
function miniupnpd_firewall($fw) function miniupnpd_enabled()
{ {
global $config; global $config;
if (isset($config['installedpackages']['miniupnpd']['config'][0]['enable'])) { return isset($config['installedpackages']['miniupnpd']['config'][0]['enable']);
$fw->registerAnchor("miniupnpd/*", "rdr"); }
$fw->registerAnchor("miniupnpd/*", "fw");
function miniupnpd_firewall($fw)
{
if (!miniupnpd_enabled()) {
return;
} }
$fw->registerAnchor('miniupnpd/*', 'rdr');
$fw->registerAnchor('miniupnpd/*', 'fw');
} }
function miniupnpd_services() function miniupnpd_services()
{ {
global $config;
$services = array(); $services = array();
if (isset($config['installedpackages']['miniupnpd']['config'][0]['enable'])) { if (!miniupnpd_enabled()) {
return $services;
}
$pconfig = array(); $pconfig = array();
$pconfig['name'] = "miniupnpd"; $pconfig['name'] = 'miniupnpd';
$pconfig['description'] = gettext("UPnP Service"); $pconfig['description'] = gettext('Univeral Plug and Play');
$pconfig['description'] = gettext("UPnP Service");
$pconfig['php']['restart'] = array('miniupnpd_stop', 'miniupnpd_start'); $pconfig['php']['restart'] = array('miniupnpd_stop', 'miniupnpd_start');
$pconfig['php']['start'] = array('miniupnpd_start'); $pconfig['php']['start'] = array('miniupnpd_start');
$pconfig['php']['stop'] = array('miniupnpd_stop'); $pconfig['php']['stop'] = array('miniupnpd_stop');
$pconfig['pidfile'] = '/var/run/miniupnpd.pid'; $pconfig['pidfile'] = '/var/run/miniupnpd.pid';
$services[] = $pconfig; $services[] = $pconfig;
}
return $services; return $services;
} }
...@@ -79,13 +85,13 @@ function miniupnpd_configure() ...@@ -79,13 +85,13 @@ function miniupnpd_configure()
function miniupnpd_configure_do() function miniupnpd_configure_do()
{ {
global $config; if (!miniupnpd_enabled()) {
return;
}
if (!empty($config['installedpackages']['miniupnpd']['config'][0]['enable'])) { echo "Starting UPnP service...";
echo gettext("Starting UPnP service... ");
miniupnpd_sync_package(); miniupnpd_sync_package();
echo "done.\n"; echo "done.\n";
}
} }
function miniupnpd_uuid() function miniupnpd_uuid()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment