firmware: clear license file if no subscription key is set

Tweak the external wording and position.  Seems convenient to
append to version, but ideally we add dynamic elements to the
bottom.
This commit is contained in:
Franco Fichtner 2022-09-29 08:23:05 +02:00
parent 6c43407860
commit 58f81a2064
3 changed files with 15 additions and 11 deletions

View File

@ -770,6 +770,11 @@ function system_firmware_configure($verbose = false)
/* rewrite the config via the defaults and possible arguments */
mwexec('/usr/local/sbin/opnsense-update -sd ' . join(' ', $args));
/* clear the license file when no subscription key is set */
if (empty(trim(shell_exec('/usr/local/sbin/opnsense-update -K')))) {
@unlink('/usr/local/opnsense/version/core.license');
}
if ($verbose) {
echo "done.\n";
}

View File

@ -842,12 +842,6 @@
<td id="product_version"></td>
<td></td>
</tr>
<tr style='display:none'>
<td style="width: 20px;"></td>
<td style="width: 150px;">{{ lang._('License valid to') }}</td>
<td id="product_license_valid_to"></td>
<td></td>
</tr>
<tr>
<td style="width: 20px;"></td>
<td style="width: 150px;">{{ lang._('Architecture') }}</td>
@ -890,6 +884,12 @@
<td id="product_time_check"></td>
<td></td>
</tr>
<tr style='display:none'>
<td style="width: 20px;"></td>
<td style="width: 150px;">{{ lang._('Licensed until') }}</td>
<td id="product_license_valid_to"></td>
<td></td>
</tr>
<tr>
<td style="width: 20px;"></td>
<td style="width: 150px;"></td>

View File

@ -158,14 +158,13 @@ function system_api_versions($product)
$result = [];
$result[] = sprintf('%s %s-%s', $product['product_name'], $product['product_version'], $product['product_arch']);
if (!empty($product['product_license']['valid_to'])) {
$result[] = sprintf(gettext('(licensed until %s)'), $product['product_license']['valid_to']);
}
$result[] = php_uname('s') . ' ' . php_uname('r');
$result[] = trim(shell_exec('/usr/local/bin/openssl version'));
if (!empty($product['product_license']['valid_to'])) {
$result[] = gettext('Licensed until') . ' ' . $product['product_license']['valid_to'];
}
return $result;
}