diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-11-13 16:02:13 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-11-13 16:02:13 -0500 |
commit | 99e2a6cefbec7153a1d32c3c55fe5d0a6f00b9bf (patch) | |
tree | afed0ec0af6fe898b840ceea071fd6a4087c76f9 /src | |
parent | d729ab36575175901bae2a2d0fd9a93389a8b7ec (diff) | |
download | pfsense-99e2a6cefbec7153a1d32c3c55fe5d0a6f00b9bf.zip pfsense-99e2a6cefbec7153a1d32c3c55fe5d0a6f00b9bf.tar.gz |
Revised base firmware update
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/pkg_mgr_install.php | 98 | ||||
-rw-r--r-- | src/usr/local/www/pkg_mgr_installed.php | 31 | ||||
-rwxr-xr-x | src/usr/local/www/reboot.php | 35 |
3 files changed, 127 insertions, 37 deletions
diff --git a/src/usr/local/www/pkg_mgr_install.php b/src/usr/local/www/pkg_mgr_install.php index 23bae87..3fade0f 100644 --- a/src/usr/local/www/pkg_mgr_install.php +++ b/src/usr/local/www/pkg_mgr_install.php @@ -75,6 +75,7 @@ require_once("pkg-utils.inc"); $sendto = "output"; $start_polling = false; +$firmwareupdate = false; //--------------------------------------------------------------------------------------------------------------------- // After an installation or removal has been started (mwexec(/usr/local/sbin/pfSense-upgrade-GUI.sh . . . )) AJAX calls @@ -242,10 +243,6 @@ if ($_POST) { } } -if($_GET && $_GET['id'] == "firmware") { - print_array(get_system_pkg_version()); -} - $pgtitle = array(gettext("System"),gettext("Package Manager"), $headline); include("head.inc"); @@ -255,6 +252,14 @@ $tab_array[] = array(gettext("Installed packages"), false, "pkg_mgr_installed.ph $tab_array[] = array(gettext("Package Installer"), true, ""); display_top_tabs($tab_array); +if($_GET && $_GET['id'] == "firmware") { + $firmwareupdate = true; + $firmwareversion = get_system_pkg_version(); +} + +if ($input_errors) + print_input_errors($input_errors); + ?> <form action="pkg_mgr_install.php" method="post" class="form-horizontal"> <!-- <h2><?=$headline?></h2> --> @@ -281,7 +286,7 @@ display_top_tabs($tab_array); break; } ?> - <br /> + <br /> <div class="panel panel-default"> <div class="panel-heading"> <?php @@ -293,6 +298,10 @@ display_top_tabs($tab_array); ?> Package: <b><?=$pkgname;?></b> will be upgraded from <b><?=$_GET['from']?></b> to <b><?=$_GET['to']?></b>. <?php + } else if ($firmwareupdate) { +?> + <?=$g['product_name']?> <?=gettext(" system firmware upgrade")?> +<?php } else { ?> Package: <b><?=$pkgname;?></b> will be <?=$pkgtxt;?>. @@ -302,14 +311,63 @@ display_top_tabs($tab_array); </div> <div class="panel-body"> <br /> - <input type="hidden" name="id" value="<?=$pkgname;?>" /> <input type="hidden" name="mode" value="<?=$pkgmode;?>" /> +<?php + if ($firmwareupdate) { +?> + <div class="form-group"> + <label class="col-sm-2 control-label"> + <?=gettext("Installed firmware")?> + </label> + <div class="col-sm-10"> + <?=$firmwareversion['installed_version']?> + </div> + </div> + + <div class="form-group"> + <label class="col-sm-2 control-label"> + <?=gettext("Newest firmware")?> + </label> + <div class="col-sm-10"> + <?=$firmwareversion['version']?> + </div> + </div> +<?php + if ($firmwareversion['version'] != $firmwareversion['installed_version'] ) { +?> + <br /> + <input type="hidden" name="id" value="pfSense-base" /> + <!-- <input type="hidden" name="id" value="pfSense-base" /> --> <input type="submit" class="btn btn-success" name="pkgconfirm" id="pkgconfirm" value="Confirm"/> <input type="submit" class="btn btn-default" name="pkgcancel" id="pkgcancel" value="Cancel"/> +<?php + } else { +?> + <div class="form-group"> + <label class="col-sm-2 control-label"> + </label> + <div class="col-sm-10"> + <?=($firmwareversion) ? gettext("System firmware is up to date") : ""?> + </div> + </div> +<?php + } + } else { +?> + <input type="hidden" name="id" value="<?=$pkgname;?>" /> + <input type="submit" class="btn btn-success" name="pkgconfirm" id="pkgconfirm" value="Confirm"/> + <input type="submit" class="btn btn-default" name="pkgcancel" id="pkgcancel" value="Cancel"/> +<?php + } + ?> </div> </div> <?php endif; +if($firmwareupdate && !$firmwareversion) { + print_info_box(gettext("Unable to retrieve system firmware versions"), danger); +} + if ($_POST['mode'] == 'delete') { $modetxt = gettext("removal"); } else if (($_POST['mode'] == 'reinstallpkg') || ($_POST['mode'] == 'reinstallall')) { @@ -345,11 +403,12 @@ if (!empty($_POST['id']) || $_POST['mode'] == "reinstallall"): </div> <div id="final" class="alert" role="alert" style=":display: none;"></div> + + <div id="clock" style="text-align: center;"></div> + <div id="countdown" style="text-align: center;"></div> <?php endif?> </form> -<div id="clock" style="text-align: center;"></div> -<div id="countdown" style="text-align: center;"></div> <?php ob_flush(); @@ -363,7 +422,7 @@ if ($_POST && ($_POST['completed'] != "true") ) { write_config(gettext("Creating restore point before package installation.")); $progbar = true; - $upgrade_script = "/usr/local/sbin/{$g['product_name']}-upgrade -l {$g['tmp_path']}/webgui-log.txt -p {$g['tmp_path']}/webgui-log.sock"; + $upgrade_script = "/usr/local/sbin/{$g['product_name']}-upgrade -R -l {$g['tmp_path']}/webgui-log.txt -p {$g['tmp_path']}/webgui-log.sock"; switch ($_POST['mode']) { case 'delete': @@ -404,6 +463,18 @@ if ($_POST && ($_POST['completed'] != "true") ) { // that were installed if ($_POST['completed'] == "true") { $pkgid = str_replace(array("<", ">", ";", "&", "'", '"', '.', '/'), "", htmlspecialchars_decode($_POST['id'], ENT_QUOTES | ENT_HTML401)); + + if($pkgid == "pfSense-base") { +?> +<script> +//<![CDATA[ +events.push(function(){ + startCountdown(60); +}); +//]]> +</script> +<?php + } } ?> @@ -474,6 +545,7 @@ function getLogsStatus() { ajaxRequest.done(function (response, textStatus, jqXHR) { var json = new Object; + alert(respone); json = jQuery.parseJSON(response); if (json.log != "not ready") { @@ -529,10 +601,10 @@ function scrollToBottom() { function startCountdown(time) { $('#clock').html('<img src="/321.gif" />'); - + setInterval(function(){ - $('#countdown').html('<h4>Rebooting in ' +time+ ' seconds.</h4>'); - + $('#countdown').html('<h4>Rebooting.<br />Page will reload in ' +time+ ' seconds.</h4>'); + time-- != 0 || (window.location="/index.php"); },1000); } @@ -550,8 +622,6 @@ events.push(function(){ show_success(); setTimeout(scrollToBottom, 200); } - - startCountdown(60); }); //]]> diff --git a/src/usr/local/www/pkg_mgr_installed.php b/src/usr/local/www/pkg_mgr_installed.php index f4ff765..1c74f5c 100644 --- a/src/usr/local/www/pkg_mgr_installed.php +++ b/src/usr/local/www/pkg_mgr_installed.php @@ -99,20 +99,21 @@ if(empty($installed_packages)):?> <?=gettext("There are no packages currently installed.")?> </div> <?php else: ?> - <div class="panel panel-body"> - <div class="table-responsive"> - <table class="table table-striped table-hover table-condensed"> - <thead> - <tr> - <th><!-- Status icon --></th> - <th><?=gettext("Name")?></th> - <th><?=gettext("Category")?></th> - <th><?=gettext("Version")?></th> - <th><?=gettext("Description")?></th> - <th><?=gettext("Actions")?></th> - </tr> - </thead> - <tbody> + <div class="panel panel-default"> + <div class="panel-heading"><h2 class="panel-title"><?=gettext('Installed packages')?></h2></div> + <div class="table-responsive"> + <table class="table table-striped table-hover table-condensed"> + <thead> + <tr> + <th><!-- Status icon --></th> + <th><?=gettext("Name")?></th> + <th><?=gettext("Category")?></th> + <th><?=gettext("Version")?></th> + <th><?=gettext("Description")?></th> + <th><?=gettext("Actions")?></th> + </tr> + </thead> + <tbody> <?php foreach ($installed_packages as $pkg): if(!$pkg['name']) { @@ -125,8 +126,6 @@ if(empty($installed_packages)):?> $missing = false; $vergetstr = ""; - print($name . '<br />'); - if (isset($pkg['broken'])) { // package is configured, but does not exist in the system $txtcolor = "red"; diff --git a/src/usr/local/www/reboot.php b/src/usr/local/www/reboot.php index 4ee7864..c6521ff 100755 --- a/src/usr/local/www/reboot.php +++ b/src/usr/local/www/reboot.php @@ -75,13 +75,6 @@ include("head.inc"); if ($_SERVER['REQUEST_METHOD'] == 'POST') { -?> - <meta http-equiv="refresh" content="70;url=/"> - <div class="alert alert-success" role="alert"> - <?=gettext("The system is rebooting now. This may take one minute or so.")?> - </div> -<?php - if(DEBUG) { print("Not actually rebooting (DEBUG is set true)"); } @@ -90,6 +83,19 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { system_reboot(); print('</pre>'); } + +?> +<div id="clock" style="text-align: center;"></div> +<div id="countdown" style="text-align: center;"></div> + +<script> +//<![CDATA[ +events.push(function(){ + startCountdown(60); +}); +//]]> +</script> +<?php } else { ?> @@ -110,5 +116,20 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { <?php } +?> +<script> +//<![CDATA[ + + function startCountdown(time) { + $('#clock').html('<img src="/321.gif" />'); + setInterval(function(){ + $('#countdown').html('<h4>Rebooting<br />Page will reload in ' +time+ ' seconds.</h4>'); + time-- != 0 || (window.location="/index.php"); + },1000); + } + +//]]> +</script> +<?php include("foot.inc"); |