diff --git a/plist b/plist index 089d8fb56..0317b60c4 100644 --- a/plist +++ b/plist @@ -709,7 +709,6 @@ /usr/local/opnsense/scripts/firmware/security.sh /usr/local/opnsense/scripts/firmware/sets.sh /usr/local/opnsense/scripts/firmware/sync.sh -/usr/local/opnsense/scripts/firmware/type.sh /usr/local/opnsense/scripts/firmware/unlock.sh /usr/local/opnsense/scripts/firmware/upgrade.sh /usr/local/opnsense/scripts/interfaces/dhclient-script 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 915044922..529120a53 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php @@ -396,23 +396,23 @@ class FirmwareController extends ApiControllerBase public function upgradeAction() { $config = Config::getInstance()->object(); - $type_want = 'opnsense'; + $type = 'opnsense'; if (!empty($config->system->firmware->type)) { - $type_want .= '-' . (string)$config->system->firmware->type; + $type .= '-' . (string)$config->system->firmware->type; } $this->sessionClose(); // long running action, close session $backend = new Backend(); $response = array(); if ($this->request->hasPost('upgrade')) { - $response['status'] = 'ok'; if ($this->request->getPost('upgrade') == 'maj') { $action = 'firmware upgrade maj'; } elseif ($this->request->getPost('upgrade') == 'rel') { - $action = 'firmware type install ' . escapeshellarg($type_want); + $action = 'firmware upgrade ' . escapeshellarg($type); } else { $action = 'firmware upgrade all'; } $response['msg_uuid'] = trim($backend->configdRun($action, true)); + $response['status'] = 'ok'; } else { $response['status'] = 'failure'; } diff --git a/src/opnsense/scripts/firmware/launcher.sh b/src/opnsense/scripts/firmware/launcher.sh index a2d7799ed..6aa45c09f 100755 --- a/src/opnsense/scripts/firmware/launcher.sh +++ b/src/opnsense/scripts/firmware/launcher.sh @@ -38,7 +38,6 @@ remove resync security sync -type unlock upgrade " diff --git a/src/opnsense/scripts/firmware/type.sh b/src/opnsense/scripts/firmware/type.sh deleted file mode 100755 index cff3dad33..000000000 --- a/src/opnsense/scripts/firmware/type.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2017 Franco Fichtner -# -# 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 BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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} - -# Truncate upgrade progress file -: > ${PKG_PROGRESS_FILE} - -echo "***GOT REQUEST FOR TYPE: ${PACKAGE}***" >> ${PKG_PROGRESS_FILE} -# change the release type -opnsense-update -t ${PACKAGE} >> ${PKG_PROGRESS_FILE} 2>&1 -# restart the web server -/usr/local/etc/rc.restart_webgui >> ${PKG_PROGRESS_FILE} 2>&1 -echo '***DONE***' >> ${PKG_PROGRESS_FILE} diff --git a/src/opnsense/scripts/firmware/upgrade.sh b/src/opnsense/scripts/firmware/upgrade.sh index 53d333c25..43e6cc02c 100755 --- a/src/opnsense/scripts/firmware/upgrade.sh +++ b/src/opnsense/scripts/firmware/upgrade.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2015-2017 Franco Fichtner +# Copyright (C) 2015-2021 Franco Fichtner # Copyright (C) 2014 Deciso B.V. # All rights reserved. # @@ -61,7 +61,10 @@ elif [ "${PACKAGE}" == "maj" ]; then # second half reboots multiple times, # but will snap the GUI back when done else - echo "Cannot update ${PACKAGE}" >> ${PKG_PROGRESS_FILE} + # change the release type + opnsense-update -t ${PACKAGE} >> ${PKG_PROGRESS_FILE} 2>&1 + # restart the web server + /usr/local/etc/rc.restart_webgui >> ${PKG_PROGRESS_FILE} 2>&1 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 41d2c4787..04196d5eb 100644 --- a/src/opnsense/service/conf/actions.d/actions_firmware.conf +++ b/src/opnsense/service/conf/actions.d/actions_firmware.conf @@ -42,12 +42,6 @@ parameters:%s type:script_output message:Viewing license for %s -[type.install] -command:/usr/sbin/daemon -f /usr/local/opnsense/scripts/firmware/launcher.sh type -parameters:%s -type:script -message:Installing release type %s - [audit] command:/usr/sbin/daemon -f /usr/local/opnsense/scripts/firmware/launcher.sh security parameters: @@ -76,7 +70,7 @@ message:retrieve firmware execution status command: /usr/sbin/daemon -f /usr/local/opnsense/scripts/firmware/launcher.sh upgrade parameters:%s type:script -message:upgrading %s +message:Upgrading %s [reinstall] command: /usr/sbin/daemon -f /usr/local/opnsense/scripts/firmware/launcher.sh reinstall