Commit 76eaa335 authored by Franco Fichtner's avatar Franco Fichtner

src: roll back these changes into a simple test tool

parent 5d400ba7
#!/usr/local/bin/php
<?php
/*
Copyright (C) 2015 Franco Fichtner <franco@opnsense.org>
All rights reserved
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
$pkg_mirror = 'http://pkg.opnsense.org';
$pkg_flavour = 'latest';
if (isset($argv[1])) {
$pkg_flavour = $argv[1];
}
if (isset($argv[2])) {
$pkg_flavour = $argv[2];
}
$pkg_sample = file_get_contents('/usr/local/etc/pkg/repos/OPNsense.conf.sample');
$pkg_sample = explode(PHP_EOL, $pkg_sample);
$pkg_config = '';
foreach ($pkg_sample as $pkg_line) {
if (!strlen($pkg_line)) {
continue;
} elseif (!strncasecmp($pkg_line, ' url:', 6)) {
$pkg_line = sprintf(
' url: "pkg+%s/${ABI}/%s",',
$pkg_mirror,
$pkg_flavour
);
}
$pkg_config .= $pkg_line . PHP_EOL;
}
file_put_contents('/usr/local/etc/pkg/repos/OPNsense.conf', $pkg_config);
......@@ -531,41 +531,6 @@ function rmdir_recursive($path,$follow_links=false) {
return;
}
/*
* check_firmware_version(): Check whether the current firmware installed is the most recently released.
*/
function check_firmware_version($tocheck = "all", $return_php = true)
{
global $config;
$xmlrpcfqdn = preg_replace('(https?://)', '', '/xmlrpc.php');
$ip = gethostbyname($xmlrpcfqdn);
if($ip == $xmlrpcfqdn)
return false;
$version = php_uname('r');
$version = explode('-', $version);
$rawparams = array("firmware" => array("version" => trim(file_get_contents('/usr/local/opnsense/version/opnsense'))),
"kernel" => array("version" => $version[0]),
"base" => array("version" => $version[0]),
"config_version" => $config['version']
);
unset($version);
if($tocheck == "all") {
$params = $rawparams;
} else {
foreach($tocheck as $check) {
$params['check'] = $rawparams['check'];
}
}
if($config['system']['firmware']['branch'])
$params['branch'] = $config['system']['firmware']['branch'];
$versions["current"] = $params;
return $versions;
}
/*
* host_firmware_version(): Return the versions used in this install
*/
......
......@@ -790,44 +790,6 @@ EOD;
return $retval;
}
function system_firmware_configure()
{
global $config;
$pkg_mirror = 'http://pkg.opnsense.org';
$pkg_flavour = 'latest';
if (!file_exists('/usr/local/etc/pkg/repos/OPNsense.conf.sample')) {
return;
}
if (isset($config['system']['firmware']['flavour'])) {
$pkg_flavour = $config['system']['firmware']['flavour'];
}
if (isset($config['system']['firmware']['mirror'])) {
$pkg_mirror = $config['system']['firmware']['mirror'];
}
$pkg_sample = file_get_contents('/usr/local/etc/pkg/repos/OPNsense.conf.sample');
$pkg_sample = explode(PHP_EOL, $pkg_sample);
$pkg_config = '';
foreach ($pkg_sample as $pkg_line) {
if (!strlen($pkg_line)) {
continue;
} elseif (!strncasecmp($pkg_line, ' url:', 6)) {
$pkg_line = sprintf(
' url: "pkg+%s/${ABI}/%s",',
$pkg_mirror,
$pkg_flavour
);
}
$pkg_config .= $pkg_line . PHP_EOL;
}
file_put_contents('/usr/local/etc/pkg/repos/OPNsense.conf', $pkg_config);
}
function system_webgui_start()
{
global $config;
......
......@@ -72,9 +72,6 @@ $pconfig['timeupdateinterval'] = $config['system']['time-update-interval'];
$pconfig['timeservers'] = $config['system']['timeservers'];
$pconfig['theme'] = $config['system']['theme'];
$pconfig['language'] = $config['system']['language'];
if (isset($config['system']['firmware']['flavour'])) {
$pconfig['firmware_flavour'] = $config['system']['firmware']['flavour'];
}
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
......@@ -191,18 +188,6 @@ if ($_POST) {
set_language($config['system']['language']);
}
if (!isset($config['system']['firmware'])) {
$config['system']['firmware'] = array();
}
if ($_POST['firmware_flavour']) {
$config['system']['firmware']['flavour'] = $_POST['firmware_flavour'];
} else {
if (isset($config['system']['firmware']['flavour'])) {
unset($config['system']['firmware']['flavour']);
}
}
system_firmware_configure();
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 */
......@@ -484,25 +469,6 @@ include("head.inc");
</span>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Cryptography");?></td>
<td width="78%" class="vtable">
<select name="firmware_flavour" class="selectpicker" data-style="btn-default" data-width="auto">
<?php
foreach(get_flavour_list() as $fcode => $fdesc) {
$selected = ' selected="selected"';
if ($fcode != $pconfig['firmware_flavour']) {
$selected = '';
}
echo "<option value=\"{$fcode}\"{$selected}>{$fdesc}</option>";
}
?>
</select>
<strong>
<?=gettext("Choose the cryptography library to be used by the system."); ?>
</strong>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Language");?></td>
<td width="78%" class="vtable">
......
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