mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
firmware: remove type.install, bring code closer together #4500
This commit is contained in:
parent
10eab0ae68
commit
9679c969f6
1
plist
1
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
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -38,7 +38,6 @@ remove
|
||||
resync
|
||||
security
|
||||
sync
|
||||
type
|
||||
unlock
|
||||
upgrade
|
||||
"
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2017 Franco Fichtner <franco@opnsense.org>
|
||||
#
|
||||
# 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}
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2015-2017 Franco Fichtner <franco@opnsense.org>
|
||||
# Copyright (C) 2015-2021 Franco Fichtner <franco@opnsense.org>
|
||||
# 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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user