diff options
author | Steve Beaver <sbeaver@netgate.com> | 2016-12-09 11:35:13 -0500 |
---|---|---|
committer | Steve Beaver <sbeaver@netgate.com> | 2016-12-09 11:41:35 -0500 |
commit | 8638429a3f1eda3d52d48a691447724f1f2bc0fe (patch) | |
tree | 4bed17b153547f5eedd33f61a28186ff6a351ea3 /src/usr | |
parent | 803c97685fef85f35a6cf781143259458486c34a (diff) | |
download | pfsense-8638429a3f1eda3d52d48a691447724f1f2bc0fe.zip pfsense-8638429a3f1eda3d52d48a691447724f1f2bc0fe.tar.gz |
Fix log file deletion
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/local/www/pkg_mgr_install.php | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/usr/local/www/pkg_mgr_install.php b/src/usr/local/www/pkg_mgr_install.php index 2429d49..8c2765b 100644 --- a/src/usr/local/www/pkg_mgr_install.php +++ b/src/usr/local/www/pkg_mgr_install.php @@ -109,16 +109,17 @@ if ($_REQUEST['ajax']) { // When we do a reinstallall, it is technically possible that we might catch the system in-between // packages, hence the de-bounce here + for ($idx=0;$idx<5 && !isvalidpid($pidfile); $idx++) { + usleep(200000); + } + if (!isvalidpid($pidfile)) { - usleep(100000); - if (!isvalidpid($pidfile)) { - $running = "stopped"; - // The log files may not be complete when the process terminates so we need wait until we see the - // exit status (__RC=x) - waitfor_string_in_file($_REQUEST['logfilename'] . '.txt', "__RC=", 10); - filter_configure(); - send_event("service restart packages"); - } + $running = "stopped"; + // The log files may not be complete when the process terminates so we need wait until we see the + // exit status (__RC=x) + waitfor_string_in_file($_REQUEST['logfilename'] . '.txt', "__RC=", 10); + filter_configure(); + send_event("service restart packages"); } $pidarray = array('pid' => $running); @@ -452,7 +453,7 @@ if ($confirmed): </div> <div class="panel-body"> - <textarea rows="15" class="form-control" id="output" name="output"><?=$_POST['output']?></textarea> + <textarea rows="15" class="form-control" id="output" name="output"><?=($completed ? $_POST['output'] : gettext("Please wait while the update system initializes"))?></textarea> </div> </div> <?php @@ -471,6 +472,10 @@ if ($confirmed && !$completed) { $progbar = true; $upgrade_script = "/usr/local/sbin/{$g['product_name']}-upgrade -y -l {$logfilename}.txt -p {$g['tmp_path']}/{$g['product_name']}-upgrade.sock"; + // Remove the log file before starting + + unlink_if_exists($logfilename . ".txt"); + switch ($pkgmode) { case 'delete': mwexec_bg("{$upgrade_script} -r {$pkgname}"); @@ -572,7 +577,7 @@ function show_info() { $('#final').addClass("alert-info"); if ("<?=$pkgmode?>" != "reinstallall") { $('#final').html("<p><?=$pkg_wait_txt?>" + "</p><p>" + - "<?=gettext("This may take several minutes!")?>" + "</p>"); + "<?=gettext("This may take several minutes. Do not leave or refresh the page!")?>" + "</p>"); } else { $('#final').html("<p><?=gettext('Please wait while the reinstallation of all packages completes.')?>" + "</p><p>" + "<?=gettext("This may take several minutes!")?>" + "</p>"); @@ -613,6 +618,8 @@ function get_firmware_versions() $('#confirmlabel').text( "<?=$confirmlabel?>"); $('#pkgconfirm').show(); } + } else { + $('#uptodate').html('<span class="text-danger">' + 'Unable to check for updates' + "</span>"); } }); } @@ -734,7 +741,7 @@ function startCountdown() { events.push(function() { if ("<?=$start_polling?>") { - setTimeout(getLogsStatus, 1000); + setTimeout(getLogsStatus, 3000); show_info(); } |