diff --git a/src/opnsense/firmware-message b/src/opnsense/firmware-message
index ce1f88551..577311eab 100644
--- a/src/opnsense/firmware-message
+++ b/src/opnsense/firmware-message
@@ -5,10 +5,10 @@ upgrade to the new 16.1 series is seamless, except for the following
points:
- The FreeBSD version changes from 10.1 to 10.2, mainly for driver
updates and general sanity. If you're running Hyper-V, your installed
-disk will change from /dev/ada0 to /dev/da0 and the system
+disk may change from /dev/ada0 to /dev/da0 and the system
will not boot as a consequence. You can fix this by manually editing
-/etc/fstab. A reinstall using the import configuration and quick/easy
-install will work just as well.
+/etc/fstab before performing the major upgrade. A reinstall using the
+import configuration and quick/easy install will work just as well.
- The captive portal implementation has been completely rewritten.
Your old setup won't be converted and thus will not come back
up. Reconfiguring the captive portal, however, will be relatively
diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php b/src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php
index 6b232d185..4dc1b678d 100644
--- a/src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php
+++ b/src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php
@@ -122,20 +122,19 @@ class FirmwareController extends ApiControllerBase
public function upgradestatusAction()
{
$backend = new Backend();
- $result = array("status"=>"running");
- $cmd_result = trim($backend->configdRun("firmware upgrade_status"));
+ $result = array('status' => 'running');
+ $cmd_result = trim($backend->configdRun('firmware status'));
$result['log'] = $cmd_result;
- if (trim($cmd_result) == "Execute error") {
- $result["status"] = "error";
+ if (trim($cmd_result) == 'Execute error') {
+ $result['status'] = 'error';
} elseif (strpos($cmd_result, '***DONE***') !== false) {
- $result["status"] = "done";
+ $result['status'] = 'done';
} elseif (strpos($cmd_result, '***REBOOT***') !== false) {
- $result["status"] = "reboot";
+ $result['status'] = 'reboot';
}
-
return $result;
}
diff --git a/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt b/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
index 2c2fd15af..f23f80c22 100644
--- a/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
+++ b/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
@@ -175,13 +175,14 @@ POSSIBILITY OF SUCH DAMAGE.
ajaxGet('/api/core/firmware/info', {}, function (data, status) {
$("#packageslist").html("
| {{ lang._('Name') }} | " +
"{{ lang._('Version') }} | {{ lang._('Size') }} | " +
- "{{ lang._('Comment') }} |
");
+ "{{ lang._('Comment') }} | {{ lang._('Action') }} | ");
$.each(data['local'], function(index, row) {
$('#packageslist').append('' +
'| ' + row['name'] + ' | ' +
'' + row['version'] + ' | ' +
'' + row['flatsize'] + ' | ' +
'' + row['comment'] + ' | ' +
+ 'reinstall | ' +
'
');
});
});
diff --git a/src/opnsense/scripts/firmware/reinstall.sh b/src/opnsense/scripts/firmware/reinstall.sh
new file mode 100755
index 000000000..4a3be0188
--- /dev/null
+++ b/src/opnsense/scripts/firmware/reinstall.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# Copyright (C) 2015 Franco Fichtner
+# 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_PROGRESS_FILE=/tmp/pkg_upgrade.progress
+PACKAGE=$1
+
+# Check if another pkg process is already running
+if [ -n "$(pgrep pkg)" ]; then
+ exit 0
+fi
+
+# Truncate upgrade progress file
+: > ${PKG_PROGRESS_FILE}
+
+echo "***GOT REQUEST TO REINSTALL: $PACKAGE***" >> ${PKG_PROGRESS_FILE}
+echo '***STARTING REINSTALL***' >> ${PKG_PROGRESS_FILE}
+pkg install -yf $PACKAGE >> ${PKG_PROGRESS_FILE}
+pkg autoremove -y >> ${PKG_PROGRESS_FILE}
+pkg clean -ya >> ${PKG_PROGRESS_FILE}
+echo '***DONE***' >> ${PKG_PROGRESS_FILE}
diff --git a/src/opnsense/scripts/pkg_upgrade.sh b/src/opnsense/scripts/firmware/upgrade.sh
similarity index 66%
rename from src/opnsense/scripts/pkg_upgrade.sh
rename to src/opnsense/scripts/firmware/upgrade.sh
index 95bed8de3..e2de58755 100755
--- a/src/opnsense/scripts/pkg_upgrade.sh
+++ b/src/opnsense/scripts/firmware/upgrade.sh
@@ -1,5 +1,6 @@
#!/bin/sh
+# Copyright (C) 2015 Franco Fichtner
# Copyright (C) 2014 Deciso B.V.
# All rights reserved.
#
@@ -24,39 +25,37 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
-package=$1
-# Check if another pkg process is already running
-pkg_running=`ps -x | grep "pkg " | grep -v "grep" | grep -v "pkg_upgrade.sh"`
-
PKG_PROGRESS_FILE=/tmp/pkg_upgrade.progress
+PACKAGE=$1
REBOOT=
+# Check if another pkg process is already running
+if [ -n "$(pgrep pkg)" ]; then
+ exit 0
+fi
+
# Truncate upgrade progress file
: > ${PKG_PROGRESS_FILE}
-echo "***GOT REQUEST TO UPGRADE: $package***" >> ${PKG_PROGRESS_FILE}
+echo "***GOT REQUEST TO UPGRADE: $PACKAGE***" >> ${PKG_PROGRESS_FILE}
-if [ -z "$pkg_running" ]; then
- echo '***STARTING UPGRADE***' >> ${PKG_PROGRESS_FILE}
- if [ "$package" == "all" ]; then
- # update all installed packages
- opnsense-update -p >> ${PKG_PROGRESS_FILE}
- # restart the web server
- /usr/local/etc/rc.restart_webgui >> ${PKG_PROGRESS_FILE}
- # if we can update base, we'll do that as well
- if opnsense-update -c; then
- if opnsense-update -bk >> ${PKG_PROGRESS_FILE}; then
- REBOOT=1
- fi
+echo '***STARTING UPGRADE***' >> ${PKG_PROGRESS_FILE}
+if [ "$PACKAGE" == "all" ]; then
+ # update all installed packages
+ opnsense-update -p >> ${PKG_PROGRESS_FILE}
+ # restart the web server
+ /usr/local/etc/rc.restart_webgui >> ${PKG_PROGRESS_FILE}
+ # if we can update base, we'll do that as well
+ if opnsense-update -c; then
+ if opnsense-update -bk >> ${PKG_PROGRESS_FILE}; then
+ REBOOT=1
fi
- elif [ "$package" == "pkg" ]; then
- pkg upgrade -y $package >> ${PKG_PROGRESS_FILE}
- echo "*** PLEASE CHECK FOR MORE UPGRADES"
- else
- echo "Cannot update $package" >> ${PKG_PROGRESS_FILE}
fi
+elif [ "$PACKAGE" == "pkg" ]; then
+ pkg upgrade -y $PACKAGE >> ${PKG_PROGRESS_FILE}
+ echo "*** PLEASE CHECK FOR MORE UPGRADES"
else
- echo 'Upgrade already in progress' >> ${PKG_PROGRESS_FILE}
+ echo "Cannot update $PACKAGE" >> ${PKG_PROGRESS_FILE}
fi
if [ -n "${REBOOT}" ]; then
diff --git a/src/opnsense/service/conf/actions.d/actions_firmware.conf b/src/opnsense/service/conf/actions.d/actions_firmware.conf
index d2f927733..d24fbd232 100644
--- a/src/opnsense/service/conf/actions.d/actions_firmware.conf
+++ b/src/opnsense/service/conf/actions.d/actions_firmware.conf
@@ -5,12 +5,18 @@ type:script_output
message:retrieve package status
[upgrade]
-command: /usr/sbin/daemon -f /usr/local/opnsense/scripts/pkg_upgrade.sh
+command: /usr/sbin/daemon -f /usr/local/opnsense/scripts/firmware/upgrade.sh
parameters:%s
type:script
-message:perform upgrade %s
+message:upgrading %s
-[upgrade_status]
+[reinstall]
+command: /usr/sbin/daemon -f /usr/local/opnsense/scripts/firmware/reinstall.sh
+parameters:%s
+type:script
+message: reinstalling firmware package %s
+
+[status]
command:cat /tmp/pkg_upgrade.progress 2>&1
parameters:
type:script_output