Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
c1628bbf
Commit
c1628bbf
authored
Nov 13, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miniupnpd: add enabled helper
parent
78945ce0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
22 deletions
+28
-22
miniupnpd.inc
src/etc/inc/plugins.inc.d/miniupnpd.inc
+28
-22
No files found.
src/etc/inc/plugins.inc.d/miniupnpd.inc
View file @
c1628bbf
...
...
@@ -26,34 +26,40 @@
POSSIBILITY OF SUCH DAMAGE.
*/
function
miniupnpd_
firewall
(
$fw
)
function
miniupnpd_
enabled
(
)
{
global
$config
;
if
(
isset
(
$config
[
'installedpackages'
][
'miniupnpd'
][
'config'
][
0
][
'enable'
]))
{
$fw
->
registerAnchor
(
"miniupnpd/*"
,
"rdr"
);
$fw
->
registerAnchor
(
"miniupnpd/*"
,
"fw"
);
return
isset
(
$config
[
'installedpackages'
][
'miniupnpd'
][
'config'
][
0
][
'enable'
]);
}
function
miniupnpd_firewall
(
$fw
)
{
if
(
!
miniupnpd_enabled
())
{
return
;
}
$fw
->
registerAnchor
(
'miniupnpd/*'
,
'rdr'
);
$fw
->
registerAnchor
(
'miniupnpd/*'
,
'fw'
);
}
function
miniupnpd_services
()
{
global
$config
;
$services
=
array
();
if
(
isset
(
$config
[
'installedpackages'
][
'miniupnpd'
][
'config'
][
0
][
'enable'
]))
{
$pconfig
=
array
();
$pconfig
[
'name'
]
=
"miniupnpd"
;
$pconfig
[
'description'
]
=
gettext
(
"UPnP Service"
);
$pconfig
[
'description'
]
=
gettext
(
"UPnP Service"
);
$pconfig
[
'php'
][
'restart'
]
=
array
(
'miniupnpd_stop'
,
'miniupnpd_start'
);
$pconfig
[
'php'
][
'start'
]
=
array
(
'miniupnpd_start'
);
$pconfig
[
'php'
][
'stop'
]
=
array
(
'miniupnpd_stop'
);
$pconfig
[
'pidfile'
]
=
'/var/run/miniupnpd.pid'
;
$services
[]
=
$pconfig
;
if
(
!
miniupnpd_enabled
())
{
return
$services
;
}
$pconfig
=
array
();
$pconfig
[
'name'
]
=
'miniupnpd'
;
$pconfig
[
'description'
]
=
gettext
(
'Univeral Plug and Play'
);
$pconfig
[
'php'
][
'restart'
]
=
array
(
'miniupnpd_stop'
,
'miniupnpd_start'
);
$pconfig
[
'php'
][
'start'
]
=
array
(
'miniupnpd_start'
);
$pconfig
[
'php'
][
'stop'
]
=
array
(
'miniupnpd_stop'
);
$pconfig
[
'pidfile'
]
=
'/var/run/miniupnpd.pid'
;
$services
[]
=
$pconfig
;
return
$services
;
}
...
...
@@ -79,13 +85,13 @@ function miniupnpd_configure()
function
miniupnpd_configure_do
()
{
global
$config
;
if
(
!
empty
(
$config
[
'installedpackages'
][
'miniupnpd'
][
'config'
][
0
][
'enable'
]))
{
echo
gettext
(
"Starting UPnP service... "
);
miniupnpd_sync_package
();
echo
"done.
\n
"
;
if
(
!
miniupnpd_enabled
())
{
return
;
}
echo
"Starting UPnP service..."
;
miniupnpd_sync_package
();
echo
"done.
\n
"
;
}
function
miniupnpd_uuid
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment