firmware: for check also figure out release type shift #4500

This commit is contained in:
Franco Fichtner 2021-02-12 21:58:05 +01:00
parent 65f212b537
commit 64640958df
3 changed files with 13 additions and 13 deletions

View File

@ -67,19 +67,12 @@ class FirmwareController extends ApiControllerBase
*/
public function checkAction()
{
$response = array();
$config = Config::getInstance()->object();
$type = 'opnsense';
if (!empty($config->system->firmware->type)) {
$type .= '-' . (string)$config->system->firmware->type;
}
$this->sessionClose(); // long running action, close session
$response = [];
if ($this->request->isPost()) {
$backend = new Backend();
$response['msg_uuid'] = trim($backend->configdpRun('firmware check', [ $type ], true));
$response['msg_uuid'] = trim($backend->configdRun('firmware check', true));
$response['status'] = 'ok';
} else {
$response['status'] = 'failure';

View File

@ -40,7 +40,6 @@
JSONFILE="/tmp/pkg_upgrade.json"
LOCKFILE="/tmp/pkg_upgrade.progress"
OUTFILE="/tmp/pkg_update.out"
PACKAGE=${1}
TEE="/usr/bin/tee -a"
UPSTREAM="OPNsense"
@ -66,6 +65,12 @@ product_version=$(opnsense-version -v)
os_version=$(uname -sr)
last_check=$(date)
SUFFIX="-$(pluginctl -g system.firmware.type)"
if [ "${SUFFIX}" = "-" ]; then
SUFFIX=
fi
PACKAGE=opnsense${SUFFIX}
echo "***GOT REQUEST TO CHECK FOR UPDATES***" >> ${LOCKFILE}
echo -n "Fetching changelog information, please wait... " >> ${LOCKFILE}
@ -73,9 +78,11 @@ if /usr/local/opnsense/scripts/firmware/changelog.sh fetch >> ${LOCKFILE} 2>&1;
echo "done" >> ${LOCKFILE}
fi
if [ -n "${PACKAGE}" -a "${product_name}" = "${PACKAGE}" ]; then
if [ "${product_name}" = "${PACKAGE}" ]; then
echo "A release type change is not required." >> ${LOCKFILE}
PACKAGE=
else
echo "Targeting new release type: ${PACKAGE}" >> ${LOCKFILE}
fi
: > ${OUTFILE}

View File

@ -1,8 +1,8 @@
[check]
command:daemon -f /usr/local/opnsense/scripts/firmware/launcher.sh check
parameters:%s
parameters:
type:script
message:Retrieve %s firmware update status
message:Retrieve firmware update status
[changelog.fetch]
command: /usr/local/opnsense/scripts/firmware/changelog.sh fetch