From e398089922dfc5010ec969bff0be37784cde4daf Mon Sep 17 00:00:00 2001 From: Jos Schellevis Date: Mon, 29 Dec 2014 15:20:03 +0000 Subject: [PATCH 1/4] Redirect standard in out on firmware update --- src/www/system_firmware_check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/www/system_firmware_check.php b/src/www/system_firmware_check.php index 07577b53c..c1fc1deae 100644 --- a/src/www/system_firmware_check.php +++ b/src/www/system_firmware_check.php @@ -52,7 +52,7 @@ if($_POST['action'] == 'pkg_upgrade') { $shell_output = array(); $shell = new OPsense\Core\Shell(); // execute shell command and collect (only valid) info into named array - $shell->exec("/usr/local/opnsense/scripts/pkg_upgrade.sh&",false,false,$shell_output); + $shell->exec("/usr/local/opnsense/scripts/pkg_upgrade.sh > /dev/null 2 > /dev/null < /dev/null &",false,false,$shell_output); } if($_POST['action'] == 'update_status' ) { From 971a7c506c6c95da03af470293a3977e2eeaa5e7 Mon Sep 17 00:00:00 2001 From: Jos Schellevis Date: Mon, 29 Dec 2014 15:24:14 +0000 Subject: [PATCH 2/4] More upgrade enhancements --- src/opnsense/scripts/pkg_upgrade.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/opnsense/scripts/pkg_upgrade.sh b/src/opnsense/scripts/pkg_upgrade.sh index 857ab7b9d..c5323b3d2 100755 --- a/src/opnsense/scripts/pkg_upgrade.sh +++ b/src/opnsense/scripts/pkg_upgrade.sh @@ -1,5 +1,29 @@ #!/bin/sh +# Copyright (C) 2014 Deciso B.V. +# 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_running=`ps -x | grep "pkg " | grep -v "grep"` if [ "$pkg_running" == "" ]; then if [ -f /tmp/pkg_upgrade.progress ]; then @@ -12,4 +36,5 @@ if [ "$pkg_running" == "" ]; then else echo 'Upgrade already in progress' echo '***DONE***' + /usr/local/opnsense/scripts/pkg_updatecheck.sh& fi From 753bb32ea3d6d879da80c5e78581ff3d08274574 Mon Sep 17 00:00:00 2001 From: Jos Schellevis Date: Mon, 29 Dec 2014 15:31:31 +0000 Subject: [PATCH 3/4] And more upgrade stuff... --- src/opnsense/scripts/pkg_upgrade.sh | 3 ++- src/www/system_firmware_check.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/opnsense/scripts/pkg_upgrade.sh b/src/opnsense/scripts/pkg_upgrade.sh index c5323b3d2..6cdaa343a 100755 --- a/src/opnsense/scripts/pkg_upgrade.sh +++ b/src/opnsense/scripts/pkg_upgrade.sh @@ -31,7 +31,8 @@ if [ "$pkg_running" == "" ]; then rm /tmp/pkg_upgrade.progress fi # start pkg upgrade - pkg upgrade -y > /tmp/pkg_upgrade.progress + echo '***STARTING UPGRADE***' > /tmp/pkg_upgrade.progress + pkg upgrade -y >> /tmp/pkg_upgrade.progress echo '***DONE***' >> /tmp/pkg_upgrade.progress else echo 'Upgrade already in progress' diff --git a/src/www/system_firmware_check.php b/src/www/system_firmware_check.php index c1fc1deae..3918c0a7e 100644 --- a/src/www/system_firmware_check.php +++ b/src/www/system_firmware_check.php @@ -50,7 +50,7 @@ if($_POST['action'] == 'pkg_update') { if($_POST['action'] == 'pkg_upgrade') { /* Setup Shell variables */ $shell_output = array(); - $shell = new OPsense\Core\Shell(); + $shell = new OPNsense\Core\Shell(); // execute shell command and collect (only valid) info into named array $shell->exec("/usr/local/opnsense/scripts/pkg_upgrade.sh > /dev/null 2 > /dev/null < /dev/null &",false,false,$shell_output); } From e52ff000a5831e806618baacd0b7cded4c3298ca Mon Sep 17 00:00:00 2001 From: Jos Schellevis Date: Mon, 29 Dec 2014 15:35:20 +0000 Subject: [PATCH 4/4] do not run updatecheck in background after upgrade --- src/opnsense/scripts/pkg_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opnsense/scripts/pkg_upgrade.sh b/src/opnsense/scripts/pkg_upgrade.sh index 6cdaa343a..354bf7678 100755 --- a/src/opnsense/scripts/pkg_upgrade.sh +++ b/src/opnsense/scripts/pkg_upgrade.sh @@ -37,5 +37,5 @@ if [ "$pkg_running" == "" ]; then else echo 'Upgrade already in progress' echo '***DONE***' - /usr/local/opnsense/scripts/pkg_updatecheck.sh& + /usr/local/opnsense/scripts/pkg_updatecheck.sh fi