Commit 5a3ddb94 authored by Ad Schellevis's avatar Ad Schellevis

remove old package support

parent 6bb3ac06
......@@ -265,7 +265,6 @@ function filter_configure_sync($delete_states_if_needed = true)
$rules .= "{$altq_queues}\n";
$rules .= "{$natrules}\n";
$rules .= "{$pfrules}\n";
$rules .= discover_pkg_rules("filter");
unset($aliases, $gateways, $altq_queues, $natrules, $pfrules);
......@@ -1974,7 +1973,6 @@ function filter_nat_rules_generate() {
}
}
$natrules .= discover_pkg_rules("nat");
$natrules .= "# UPnPd rdr anchor\n";
$natrules .= "rdr-anchor \"miniupnpd\"\n";
......@@ -2620,7 +2618,6 @@ function filter_rules_generate()
$pptpdcfg = $config['pptpd'];
$ipfrules = "";
$ipfrules .= discover_pkg_rules("pfearly");
/* relayd */
$ipfrules .= "anchor \"relayd/*\"\n";
......@@ -3563,37 +3560,6 @@ EOD;
return($ipfrules);
}
function discover_pkg_rules($ruletype) {
global $config, $g, $aliases;
/* Bail if there is no pkg directory, or if the package files might be out of sync. */
if(!is_dir("/usr/local/pkg") || file_exists('/conf/needs_package_sync'))
return "";
$rules = "";
$files = glob("/usr/local/pkg/*.inc");
foreach($files as $pkg_inc) {
update_filter_reload_status(sprintf(gettext('Checking for %1$s PF hooks in package %2$s'), $ruletype, $pkg_inc));
$pkg = basename($pkg_inc, ".inc");
$pkg_generate_rules = "{$pkg}_generate_rules";
if (!function_exists($pkg_generate_rules))
require_once($pkg_inc);
if(function_exists($pkg_generate_rules)) {
update_filter_reload_status(sprintf(gettext('Processing early %1$s rules for package %2$s'), $ruletype, $pkg_inc));
$tmprules = $pkg_generate_rules("$ruletype");
file_put_contents('/tmp/rules.test.packages', $aliases . $tmprules);
$status = mwexec('/sbin/pfctl -nf /tmp/rules.test.packages');
if ($status <> 0) {
$errorrules = sprintf(gettext("There was an error while parsing the package filter rules for %s."), $pkg_inc) . "\n";
log_error($errorrules);
file_put_contents("/tmp/rules.packages.{$pkg}", "#{$errorrules}\n{$tmprules}\n");
continue;
}
$rules .= $tmprules;
}
}
return $rules;
}
function filter_get_antilockout_ports($wantarray = false) {
global $config;
......
This diff is collapsed.
......@@ -1170,12 +1170,6 @@ $priv_list['page-system-firmware-manualupdate']['descr'] = gettext("Allow access
$priv_list['page-system-firmware-manualupdate']['match'] = array();
$priv_list['page-system-firmware-manualupdate']['match'][] = "system_firmware.php*";
$priv_list['page-system-firmware-checkforupdate'] = array();
$priv_list['page-system-firmware-checkforupdate']['name'] = gettext("WebCfg - System: Firmware: Check For Update page");
$priv_list['page-system-firmware-checkforupdate']['descr'] = gettext("Allow access to the 'System: Firmware: Check For Update' page.");
$priv_list['page-system-firmware-checkforupdate']['match'] = array();
$priv_list['page-system-firmware-checkforupdate']['match'][] = "system_firmware_auto.php*";
$priv_list['page-system-firmware-autoupdate'] = array();
$priv_list['page-system-firmware-autoupdate']['name'] = gettext("WebCfg - System: Firmware: Auto Update page");
$priv_list['page-system-firmware-autoupdate']['descr'] = gettext("Allow access to the 'System: Firmware: Auto Update' page.");
......
......@@ -331,16 +331,6 @@ function services_dhcpdv4_configure()
if (!is_dhcp_server_enabled())
return 0;
/* if OLSRD is enabled, allow WAN to house DHCP. */
if (!function_exists('is_package_installed'))
require_once('pkg-utils.inc');
if (is_package_installed('olsrd') && isset($config['installedpackages']['olsrd']))
foreach($config['installedpackages']['olsrd']['config'] as $olsrd)
if (isset($olsrd['enable']) && $olsrd['enable'] == "on") {
$is_olsr_enabled = true;
break;
}
if (file_exists("/var/run/booting")) {
/* restore the leases, if we have them */
if (file_exists('/conf/dhcpleases.tgz')) {
......@@ -506,10 +496,6 @@ EOPP;
if (!is_ipaddr($subnet))
continue;
if($is_olsr_enabled == true)
if($dhcpifconf['netmask'])
$subnetmask = gen_subnet_mask($dhcpifconf['netmask']);
$all_pools = array();
$all_pools[] = $dhcpifconf;
if (is_array($dhcpifconf['pool'])) {
......@@ -1098,10 +1084,6 @@ EOD;
$ifcfgsnv6 = get_interface_subnetv6($dhcpv6if);
$subnetv6 = gen_subnetv6($ifcfgipv6, $ifcfgsnv6);
if ($is_olsr_enabled == true) {
if($dhcpv6ifconf['netmask'])
$subnetmask = gen_subnet_maskv6($dhcpv6ifconf['netmask']);
}
$dnscfgv6 = "";
......@@ -2294,18 +2276,19 @@ function upnp_action ($action) {
}
}
function upnp_start() {
global $config;
global $config;
if(!isset($config['installedpackages']['miniupnpd']['config']))
return;
if(!isset($config['installedpackages']['miniupnpd']['config']))
return;
if($config['installedpackages']['miniupnpd']['config'][0]['enable']) {
echo gettext("Starting UPnP service... ");
require_once('/usr/local/pkg/miniupnpd.inc');
sync_package_miniupnpd();
echo "done.\n";
}
if($config['installedpackages']['miniupnpd']['config'][0]['enable']) {
echo gettext("Starting UPnP service... ");
require_once('/usr/local/pkg/miniupnpd.inc');
sync_package_miniupnpd();
echo "done.\n";
}
}
function install_cron_job($command, $active=false, $minute="0", $hour="*", $monthday="*", $month="*", $weekday="*", $who="root") {
......
......@@ -1701,8 +1701,6 @@ function system_reboot_cleanup() {
}
require_once("voucher.inc");
voucher_save_db_to_config();
require_once("pkg-utils.inc");
stop_packages();
}
function system_console_configure()
......
......@@ -372,18 +372,6 @@ prefer_ipv4_or_ipv6();
if (file_exists("/sbin/shutdown.old"))
@unlink("/sbin/shutdown.old");
/* Resync / Reinstall packages if need be */
if(file_exists('/conf/needs_package_sync')) {
if($config['installedpackages'] <> '' && is_array($config['installedpackages']['package'])) {
require_once("pkg-utils.inc");
if($g['platform'] == "pfSense" || $g['platform'] == "nanobsd") {
mark_subsystem_dirty('packagelock');
pkg_reinstall_all();
clear_subsystem_dirty('packagelock');
}
}
@unlink('/conf/needs_package_sync');
}
/* Give syslogd a kick after everything else has been initialized, otherwise it can occasionally
fail to route syslog messages properly on both IPv4 and IPv6 */
......
#!/usr/local/bin/php
<?php
/*
Copyright (C) 2004 Scott Ullrich
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.
*/
require_once("config.inc");
require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
require_once("captiveportal.inc");
require_once("pkg-utils.inc");
require_once("pfsense-utils.inc");
require_once("service-utils.inc");
log_error("Restarting/Starting all packages.");
$rcfiles = glob(RCFILEPREFIX . "*.sh");
if (!$rcfiles)
$rcfiles = array();
else {
$rcfiles = array_flip($rcfiles);
if (!$rcfiles)
$rcfiles = array();
}
if (is_array($config['installedpackages']['package'])) {
foreach($config['installedpackages']['package'] as $pkgid => $package) {
echo " Starting package {$package['name']}...";
sync_package($pkgid);
$internal_name = get_pkg_internal_name($package);
start_service($internal_name);
unset($rcfiles[RCFILEPREFIX . strtolower($internal_name) . ".sh"]);
echo "done.\n";
}
}
$shell = @popen("/bin/sh", "w");
if ($shell) {
foreach ($rcfiles as $rcfile => $number) {
echo " Starting {$rcfile}...";
fwrite($shell, "{$rcfile} start >>/tmp/bootup_messages 2>&1 &");
echo "done.\n";
}
pclose($shell);
}
#!/usr/local/bin/php
<?php
require_once("pkg-utils.inc");
stop_packages();
......@@ -112,12 +112,7 @@ page-services-ntpd=services_ntpd.php*
page-services-ntp-gps=status_ntpd_gps.php*
page-services-ntp-pps=status_ntpd_pps.php*
page-loadbalancer-virtualserver-edit=load_balancer_virtual_server_edit.php*
page-package-settings=pkg.php*
page-package-edit=pkg_edit.php*
page-system-packagemanager=pkg_mgr.php*
page-system-packagemanager-installpackage=pkg_mgr_install.php*
page-system-packagemanager-installed=pkg_mgr_installed.php*
page-pkg-mgr-settings=pkg_mgr_settings.php*
page-diagnostics-rebootsystem=reboot.php*
page-diagnostics-restart-httpd=restart_httpd.php*
page-services-captiveportal=services_captiveportal.php*
......@@ -196,7 +191,6 @@ page-system-camanager=system_camanager.php*
page-system-certmanager=system_certmanager.php*
page-system-crlmanager=system_crlmanager.php*
page-system-firmware-manualupdate=system_firmware.php*
page-system-firmware-checkforupdate=system_firmware_auto.php*
page-system-firmware-autoupdate=system_firmware_check.php*
page-system-firmware-settings=system_firmware_settings.php*
page-system-gatewaygroups=system_gateway_groups.php*
......
......@@ -46,13 +46,6 @@ parameters:
type:script
message:Starting nptd
[reload|restart.packages]
command:/usr/local/etc/rc.start_packages
parameters:
type:script
message:Starting packages
[reload|restart.sshd]
command:/usr/local/etc/rc.sshd
parameters:
......
......@@ -391,7 +391,6 @@ if ($_POST) {
/* this will be picked up by /index.php */
conf_mount_rw();
mark_subsystem_dirty("restore");
touch("/conf/needs_package_sync");
/* remove cache, we will force a config reboot */
@unlink('/tmp/config.cache');
$config = parse_config(true);
......
......@@ -39,7 +39,6 @@ ob_start(null, "1000");
require_once('functions.inc');
require_once('guiconfig.inc');
require_once('notices.inc');
require_once("pkg-utils.inc");
if(isset($_REQUEST['closenotice'])){
close_notice($_REQUEST['closenotice']);
......@@ -135,23 +134,6 @@ if(file_exists("/usr/sbin/swapinfo")) {
if(stristr($swapinfo,'%') == true) $showswap=true;
}
## User recently restored his config.
## If packages are installed lets resync
if(file_exists('/conf/needs_package_sync')) {
if($config['installedpackages'] <> '' && is_array($config['installedpackages']['package'])) {
if($g['platform'] == "pfSense" || $g['platform'] == "nanobsd") {
header('Location: pkg_mgr_install.php?mode=reinstallall');
exit;
}
} else {
conf_mount_rw();
@unlink('/conf/needs_package_sync');
conf_mount_ro();
}
}
## Find out whether there's hardware encryption or not
unset($hwcrypto);
$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
......@@ -461,10 +443,6 @@ echo $jscriptstr;
<div class="row">
<?php
/* Print package server mismatch warning. See https://redmine.pfsense.org/issues/484 */
/*if (!verify_all_package_servers())
print_info_box(package_server_mismatch_message());*/
if ($savemsg)
print_info_box($savemsg);
......
This diff is collapsed.
......@@ -32,7 +32,22 @@ require("guiconfig.inc");
require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
require_once("pkg-utils.inc");
function get_pkg_interfaces_select_source($include_localhost=false) {
$interfaces = get_configured_interface_with_descr();
$ssifs = array();
foreach ($interfaces as $iface => $ifacename) {
$tmp["name"] = $ifacename;
$tmp["value"] = $iface;
$ssifs[] = $tmp;
}
if ($include_localhost) {
$tmp["name"] = "Localhost";
$tmp["value"] = "lo0";
$ssifs[] = $tmp;
}
return $ssifs;
}
/* dummy stubs needed by some code that was MFC'd */
function pfSenseHeader($location) { header("Location: " . $location); }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2009 Jim Pingle <jimp@pfsense.org>
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2005 Colin Smith
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.
*/
ini_set('max_execution_time', '0');
require_once("globals.inc");
require_once("guiconfig.inc");
require_once("pkg-utils.inc");
if ($_POST) {
if (!$input_errors) {
if($_POST['alturlenable'] == "yes") {
$config['system']['altpkgrepo']['enable'] = true;
$config['system']['altpkgrepo']['xmlrpcbaseurl'] = $_POST['pkgrepourl'];
} else {
unset($config['system']['altpkgrepo']['enable']);
}
write_config();
}
}
$curcfg = $config['system']['altpkgrepo'];
$closehead = false;
$pgtitle = array(gettext("System"),gettext("Package Settings"));
include("head.inc");
?>
<script type="text/javascript">
//<![CDATA[
function enable_altpkgrepourl(enable_over) {
if (document.iform.alturlenable.checked || enable_over) {
document.iform.pkgrepourl.disabled = 0;
} else {
document.iform.pkgrepourl.disabled = 1;
}
}
//]]>
</script>
</head>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc");
/* Print package server mismatch warning. See https://redmine.pfsense.org/issues/484 */
/*if (!verify_all_package_servers())
print_info_box(package_server_mismatch_message());*/
/* Print package server SSL warning. See https://redmine.pfsense.org/issues/484 */
if (check_package_server_ssl() === false)
print_info_box(package_server_ssl_failure_message()); ?>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<form action="pkg_mgr_settings.php" method="post" name="iform" id="iform">
<?php if ($savemsg) print_info_box($savemsg); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="package manager settings">
<tr>
<td>
<?php
$version = file_get_contents("/usr/local/opnsense/version/opnsense");
$tab_array = array();
$tab_array[] = array(sprintf(gettext("%s packages"), $version), false, "pkg_mgr.php");
$tab_array[] = array(gettext("Installed Packages"), false, "pkg_mgr_installed.php");
$tab_array[] = array(gettext("Package Settings"), true, "pkg_mgr_settings.php");
display_top_tabs($tab_array);
?>
</td>
</tr>
<tr><td><div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
<tr>
<td colspan="2" valign="top" class="vncell">
<?PHP echo gettext("This page allows an alternate package repository to be configured, primarily for temporary use as a testing mechanism."); ?>
<?PHP echo gettext("The contents of unofficial packages servers cannot be verified and may contain malicious files."); ?>
<?PHP echo gettext("The package server settings should remain at their default values to ensure that verifiable and trusted packages are recevied."); ?>
<br/><br/>
<?PHP echo gettext("A warning is printed on the Dashboard and in the package manager when an unofficial package server is in use."); ?>
<br/><br/>
</td>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Package Repository URL");?></td>
</tr>
<tr>
<td valign="top" class="vncell"><?=gettext("Package Repository URL");?></td>
<td class="vtable">
<input name="alturlenable" type="checkbox" id="alturlenable" value="yes" onclick="enable_altpkgrepourl()" <?php if(isset($curcfg['enable'])) echo "checked=\"checked\""; ?> /> <?=gettext("Use a non-official server for packages");?> <br />
<table summary="alternative URL">
<tr><td><?=gettext("Base URL:");?></td><td><input name="pkgrepourl" type="text" class="formfld url" id="pkgrepourl" size="64" value="<?php if($curcfg['xmlrpcbaseurl']) echo $curcfg['xmlrpcbaseurl']; else echo $g['']; ?>" /></td></tr>
</table>
<span class="vexpl">
<?php printf(gettext("This is where %s will check for packages when the"),$g['product_name']);?>, <a href="pkg_mgr.php"><?=gettext("System: Packages");?></a> <?=gettext("page is viewed.");?>
</span>
</td>
</tr>
<script type="text/javascript">
//<![CDATA[
enable_altpkgrepourl();
//]]>
</script>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
</td>
</tr>
</table></div></td></tr></table>
</form>
<?php include("fend.inc"); ?>
</body>
</html>
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2005, 2008 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2003-2004 Manuel Kasper
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.
*/
$nocsrf = true;
require_once('guiconfig.inc');
require_once('pfsense-utils.inc');
$curcfg = $config['system']['firmware'];
if(isset($curcfg['alturl']['enable']))
$updater_url = "{$config['system']['firmware']['alturl']['firmwareurl']}";
else
$updater_url = $g['update_url'];
if($_POST['backupbeforeupgrade'])
touch("/tmp/perform_full_backup.txt");
$closehead = false;
$pgtitle = array(gettext("Diagnostics"),gettext("Firmware"),gettext("Auto Update"));
include("head.inc");
?>
<body>
<?php include("fbegin.inc"); ?>
<!-- row -->
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<?php
if ($input_errors) print_input_errors($input_errors);
if ($savemsg) print_info_box($savemsg);
?>
<section class="col-xs-12">
<? include('system_firmware_tabs.php'); ?>
<div class="content-box tab-content">
<form action="system_firmware_auto.php" method="post">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="outer">
<tr>
<td class="tabcont">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="inner">
<tr>
<td align="center">
<table width="420" border="0" cellpadding="0" cellspacing="0" summary="images">
<tr>
<td style="background:url('./themes/<?=$g['theme'];?>/images/misc/bar_left.gif')" height="15" width="5"> </td>
<td>
<table id="progholder" style="height:15;colspacing:0" width="410" border="0" cellpadding="0" cellspacing="0" summary="">
<tr><td style="background:url('./themes/<?=$g['theme'];?>/images/misc/bar_gray.gif')" valign="top" align="left">
<img src="./themes/<?=$g['theme'];?>/images/misc/bar_blue.gif" width="0" height="15" name="progressbar" id="progressbar" alt="" />
</td></tr>
</table>
</td>
<td style="background:url('./themes/<?=$g['theme'];?>/images/misc/bar_right.gif')" height="15" width="5"></td>
</tr>
</table>
<br />
<script type="text/javascript">
//<![CDATA[
window.onload=function(){
document.getElementById("status").wrap='hard';
document.getElementById("output").wrap='hard';
}
//]]>
</script>
<!-- status box -->
<textarea cols="90" rows="1" name="status" id="status"><?=gettext("Beginning firmware upgrade"); ?>.</textarea>
<br />
<!-- command output box -->
<textarea cols="90" rows="25" name="output" id="output"></textarea>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</div>
</section>
</div>
</div>
</section>
<?php include("foot.inc"); ?>
<?php
update_status(gettext("Downloading current version information") . "...");
$nanosize = "";
if ($g['platform'] == "nanobsd") {
if (file_exists("/etc/nano_use_vga.txt"))
$nanosize = "-nanobsd-vga-";
else
$nanosize = "-nanobsd-";
$nanosize .= strtolower(trim(file_get_contents("/etc/nanosize.txt")));
}
@unlink("/tmp/{$g['product_name']}_version");
download_file_with_progress_bar("{$updater_url}/version{$nanosize}", "/tmp/{$g['product_name']}_version");
$latest_version = str_replace("\n", "", @file_get_contents("/tmp/{$g['product_name']}_version"));
if(!$latest_version) {
update_output_window(gettext("Unable to check for updates."));
require("fend.inc");
exit;
} else {
$current_installed_buildtime = ''; /* XXX zap */
$current_installed_version = trim(file_get_contents('/usr/local/opnsense/version/opnsense'));
$latest_version = trim(@file_get_contents("/tmp/{$g['product_name']}_version"));
$latest_version_pfsense = strtotime($latest_version);
if(!$latest_version) {
update_output_window(gettext("Unable to check for updates."));
require("fend.inc");
exit;
} else {
if (pfs_version_compare($current_installed_buildtime, $current_installed_version, $latest_version) == -1) {
update_status(gettext("Downloading updates") . "...");
conf_mount_rw();
if ($g['platform'] == "nanobsd") {
$update_filename = "latest{$nanosize}.img.gz";
} else {
$update_filename = "latest.tgz";
}
$status = download_file_with_progress_bar("{$updater_url}/{$update_filename}", "{$g['upload_path']}/latest.tgz", "read_body_firmware");
$status = download_file_with_progress_bar("{$updater_url}/{$update_filename}.sha256", "{$g['upload_path']}/latest.tgz.sha256");
conf_mount_ro();
update_output_window("{$g['product_name']} " . gettext("download complete."));
} else {
update_output_window(gettext("You are on the latest version."));
require("fend.inc");
exit;
}
}
}
/* launch external upgrade helper */
$external_upgrade_helper_text = "/usr/local/etc/rc.firmware pfSenseupgrade {$g['upload_path']}/latest.tgz";
$downloaded_latest_tgz_sha256 = str_replace("\n", "", `/sbin/sha256 -q {$g['upload_path']}/latest.tgz`);
$upgrade_latest_tgz_sha256 = str_replace("\n", "", `/bin/cat {$g['upload_path']}/latest.tgz.sha256 | awk '{ print $4 }'`);
if ($exitstatus) {
update_status($sig_warning);
update_output_window(gettext("Update cannot continue. You can disable this check on the Updater Settings tab."));
require("fend.inc");
exit;
}
if (!verify_gzip_file("{$g['upload_path']}/latest.tgz")) {
update_status(gettext("The image file is corrupt."));
update_output_window(gettext("Update cannot continue"));
if (file_exists("{$g['upload_path']}/latest.tgz")) {
conf_mount_rw();
unlink("{$g['upload_path']}/latest.tgz");
conf_mount_ro();
}
require("fend.inc");
exit;
}
if($downloaded_latest_tgz_sha256 <> $upgrade_latest_tgz_sha256) {
update_status(gettext("Downloading complete but sha256 does not match."));
update_output_window(gettext("Auto upgrade aborted.") . " \n\n" . gettext("Downloaded SHA256") . ": " . $downloaded_latest_tgz_sha256 . "\n\n" . gettext("Needed SHA256") . ": " . $upgrade_latest_tgz_sha256);
} else {
update_output_window($g['product_name'] . " " . gettext("is now upgrading.") . "\\n\\n" . gettext("The firewall will reboot once the operation is completed."));
echo "\n<script type=\"text/javascript\">";
echo "\n//<![CDATA[";
echo "\ndocument.progressbar.style.visibility='hidden';";
echo "\n//]]>";
echo "\n</script>";
mwexec_bg($external_upgrade_helper_text);
}
/*
Helper functions
*/
function read_body_firmware($ch, $string) {
global $fout, $file_size, $downloaded, $counter, $version, $latest_version, $current_installed_version;
$length = strlen($string);
$downloaded += intval($length);
$downloadProgress = round(100 * (1 - $downloaded / $file_size), 0);
$downloadProgress = 100 - $downloadProgress;
$a = $file_size;
$b = $downloaded;
$c = $downloadProgress;
$text = " " . gettext("Auto Update Download Status") . "\\n";
$text .= "----------------------------------------------------\\n";
$text .= " " . gettext("Current Version") . " : {$current_installed_version}\\n";
$text .= " " . gettext("Latest Version") . " : {$latest_version}\\n";
$text .= " " . gettext("File size") . " : {$a}\\n";
$text .= " " . gettext("Downloaded") . " : {$b}\\n";
$text .= " " . gettext("Percent") . " : {$c}%\\n";
$text .= "----------------------------------------------------\\n";
$counter++;
if($counter > 150) {
update_output_window($text);
update_progress_bar($downloadProgress);
$counter = 0;
}
fwrite($fout, $string);
return $length;
}
?>
......@@ -115,7 +115,7 @@ include("head.inc");
<div class="content-box tab-content">
<form action="system_firmware_auto.php" method="post">
<form method="post">
<div class="table table-striped">
......
......@@ -27,7 +27,6 @@
*/
require("guiconfig.inc");
require("pkg-utils.inc");
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_gateways.php');
......
<?php
include("pkg_mgr_installed.php");
?>
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