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
68261332
Commit
68261332
authored
Jul 29, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
system: add firmware mirror and flavour selection
parent
d4aa07ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
system_general.php
src/www/system_general.php
+96
-0
No files found.
src/www/system_general.php
View file @
68261332
...
...
@@ -50,6 +50,34 @@ function get_locale_list()
return
$locales
;
}
function
get_firmware_mirrors
()
{
$mirrors
=
array
();
$mirrors
[
'default'
]
=
'(default)'
;
$mirrors
[
'https://opnsense.c0urier.net'
]
=
'c0urier.net (Lund, SE)'
;
$mirrors
[
'https://fleximus.org/mirror/opnsense'
]
=
'Fleximus (Roubaix, FR)'
;
$mirrors
[
'http://mirror.ams1.nl.leaseweb.net/opnsense'
]
=
'LeaseWeb (Amsterdam, NL)'
;
$mirrors
[
'http://mirror.fra10.de.leaseweb.net/opnsense'
]
=
'LeaseWeb (Frankfurt, DE)'
;
$mirrors
[
'http://mirror.sfo12.us.leaseweb.net/opnsense'
]
=
'LeaseWeb (San Francisco, US)'
;
$mirrors
[
'http://mirror.wdc1.us.leaseweb.net/opnsense'
]
=
'LeaseWeb (Washington, D.C., US)'
;
$mirrors
[
'http://mirrors.nycbug.org/pub/opnsense'
]
=
'NYC*BUG (New York, US)'
;
$mirrors
[
'http://pkg.opnsense.org'
]
=
'OPNsense (Amsterdam, NL)'
;
return
$mirrors
;
}
function
get_firmware_flavours
()
{
$flavours
=
array
();
$flavours
[
'default'
]
=
'(default)'
;
$flavours
[
'libressl'
]
=
'LibreSSL'
;
$flavours
[
'latest'
]
=
'OpenSSL'
;
return
$flavours
;
}
$pconfig
[
'hostname'
]
=
$config
[
'system'
][
'hostname'
];
$pconfig
[
'domain'
]
=
$config
[
'system'
][
'domain'
];
if
(
isset
(
$config
[
'system'
][
'dnsserver'
]))
{
...
...
@@ -105,6 +133,16 @@ if (empty($pconfig['timezone']))
if
(
empty
(
$pconfig
[
'timeservers'
]))
$pconfig
[
'timeservers'
]
=
"pool.ntp.org"
;
$pconfig
[
'mirror'
]
=
'default'
;
if
(
isset
(
$config
[
'system'
][
'firmware'
][
'mirror'
]))
{
$pconfig
[
'mirror'
]
=
$config
[
'system'
][
'firmware'
][
'mirror'
];
}
$pconfig
[
'flavour'
]
=
'default'
;
if
(
isset
(
$config
[
'system'
][
'firmware'
][
'flavour'
]))
{
$pconfig
[
'flavour'
]
=
$config
[
'system'
][
'firmware'
][
'flavour'
];
}
$changedesc
=
gettext
(
"System"
)
.
": "
;
$changecount
=
0
;
...
...
@@ -208,6 +246,26 @@ if ($_POST) {
set_language
(
$config
[
'system'
][
'language'
]);
}
if
(
!
isset
(
$config
[
'system'
][
'firmware'
]))
{
$config
[
'system'
][
'firmware'
]
=
array
();
}
if
(
$_POST
[
'mirror'
]
==
'default'
&&
isset
(
$config
[
'system'
][
'firmware'
][
'mirror'
]))
{
/* default does not set anything for backwards compat */
unset
(
$config
[
'system'
][
'firmware'
][
'mirror'
]);
}
else
{
/* XXX create a proper backend call */
mwexecf
(
'/usr/local/sbin/opnsense-update -sm %s'
,
str_replace
(
'/'
,
'\/'
,
$_POST
[
'mirror'
]));
$config
[
'system'
][
'firmware'
][
'mirror'
]
=
$_POST
[
'mirror'
];
}
if
(
$_POST
[
'flavour'
]
==
'default'
&&
isset
(
$config
[
'system'
][
'firmware'
][
'flavour'
]))
{
/* default does not set anything for backwards compat */
unset
(
$config
[
'system'
][
'firmware'
][
'flavour'
]);
}
else
{
/* XXX create a proper backend call */
mwexecf
(
'/usr/local/sbin/opnsense-update -sn %s'
,
str_replace
(
'/'
,
'\/'
,
$_POST
[
'flavour'
]));
$config
[
'system'
][
'firmware'
][
'flavour'
]
=
$_POST
[
'flavour'
];
}
update_if_changed
(
"System Theme"
,
$config
[
'theme'
],
$_POST
[
'theme'
]);
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
...
...
@@ -530,6 +588,44 @@ include("head.inc");
</strong>
</td>
</tr>
<tr>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Firmware Mirror"
);
?>
</td>
<td
width=
"78%"
class=
"vtable"
>
<select
name=
"mirror"
class=
"selectpicker"
data-style=
"btn-default"
data-width=
"auto"
>
<?php
foreach
(
get_firmware_mirrors
()
as
$mcode
=>
$mdesc
)
{
$selected
=
' selected="selected"'
;
if
(
$mcode
!=
$pconfig
[
'mirror'
])
{
$selected
=
''
;
}
echo
"<option value=
\"
{
$mcode
}
\"
{
$selected
}
>
{
$mdesc
}
</option>"
;
}
?>
</select>
<strong>
<?=
gettext
(
"Select an alternate firmware mirror."
);
?>
</strong>
</td>
</tr>
<tr>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Firmware Flavour"
);
?>
</td>
<td
width=
"78%"
class=
"vtable"
>
<select
name=
"flavour"
class=
"selectpicker"
data-style=
"btn-default"
data-width=
"auto"
>
<?php
foreach
(
get_firmware_flavours
()
as
$fcode
=>
$fdesc
)
{
$selected
=
' selected="selected"'
;
if
(
$fcode
!=
$pconfig
[
'flavour'
])
{
$selected
=
''
;
}
echo
"<option value=
\"
{
$fcode
}
\"
{
$selected
}
>
{
$fdesc
}
</option>"
;
}
?>
</select>
<strong>
<?=
gettext
(
"Select the firmware cryptography flavour."
);
?>
</strong>
</td>
</tr>
<tr>
<td
width=
"22%"
valign=
"top"
>
</td>
<td
width=
"78%"
>
...
...
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