firmware: also show not installed not orphaned missing #1663

This commit is contained in:
Franco Fichtner 2020-02-20 20:32:23 +01:00
parent 6f73ec2073
commit 2ad9300a32
3 changed files with 22 additions and 8 deletions

View File

@ -1,7 +1,7 @@
<?php
/*
* Copyright (c) 2015-2019 Franco Fichtner <franco@opnsense.org>
* Copyright (c) 2015-2020 Franco Fichtner <franco@opnsense.org>
* Copyright (c) 2015-2018 Deciso B.V.
* All rights reserved.
*
@ -872,6 +872,20 @@ class FirmwareController extends ApiControllerBase
$response['package'][] = $package;
}
foreach ($configPlugins as $missing) {
if (!array_key_exists($missing, $plugins)) {
$plugins[$missing] = [];
foreach ($keys as $key) {
$plugins[$missing][$key] = gettext('N/A');
}
$plugins[$missing]['path'] = gettext('N/A');
$plugins[$missing]['configured'] = "1";
$plugins[$missing]['installed'] = "0";
$plugins[$missing]['provided'] = "0";
$plugins[$missing]['name'] = $missing;
}
}
uasort($plugins, function ($a, $b) {
return strnatcasecmp(
($a['configured'] ? '0' : '1') . ($a['installed'] ? '0' : '1') . $a['name'],

View File

@ -1,5 +1,5 @@
{#
# Copyright (c) 2015-2019 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2015-2020 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2015-2018 Deciso B.V.
# All rights reserved.
#
@ -445,11 +445,11 @@
bold_off = '</b>';
} else if (row['installed'] == "0" && row['configured'] == "1") {
status_text = ' ({{ lang._('missing') }})';
bold_on = '<b class="text-warning plugin_missing">';
bold_off = '</b>';
bold_on = '<span class="text-danger plugin_missing">';
bold_off = '</span>';
missing_plugin_count += 1;
}
if (row['provided'] == "0") {
if (row['provided'] == "0" && row['installed'] == "1") {
// this state overwrites installed on purpose
status_text = ' ({{ lang._('orphaned') }})';
}

View File

@ -26,7 +26,6 @@
# POSSIBILITY OF SUCH DAMAGE.
PKG_PROGRESS_FILE=/tmp/pkg_upgrade.progress
# XXX the issue here is we do get all plugins, but some are already installed
PACKAGES=$(/usr/local/sbin/pluginctl -g system.firmware.plugins | /usr/bin/sed 's/,/ /g')
# Truncate upgrade progress file
@ -34,8 +33,9 @@ PACKAGES=$(/usr/local/sbin/pluginctl -g system.firmware.plugins | /usr/bin/sed '
echo "***GOT REQUEST TO SYNC: ${PACKAGES}***" >> ${PKG_PROGRESS_FILE}
for PACKAGE in ${PACKAGES}; do
# XXX check which we really need to sync :)
pkg install -y ${PACKAGE} >> ${PKG_PROGRESS_FILE} 2>&1
if ! pkg query %n ${PACKAGE} > /dev/null; then
pkg install -y ${PACKAGE} >> ${PKG_PROGRESS_FILE} 2>&1
fi
done
pkg autoremove -y >> ${PKG_PROGRESS_FILE} 2>&1
echo '***DONE***' >> ${PKG_PROGRESS_FILE}