firmware: s/(?:family|core)/type/g

Consistent naming and a tiny bit of polish.
This commit is contained in:
Franco Fichtner 2017-12-12 06:03:17 +00:00
parent 16bac7c867
commit de19a915b2
6 changed files with 47 additions and 43 deletions

2
plist
View File

@ -578,7 +578,6 @@
/usr/local/opnsense/scripts/firmware/audit.sh
/usr/local/opnsense/scripts/firmware/changelog.sh
/usr/local/opnsense/scripts/firmware/check.sh
/usr/local/opnsense/scripts/firmware/core.sh
/usr/local/opnsense/scripts/firmware/hotfix.sh
/usr/local/opnsense/scripts/firmware/install.sh
/usr/local/opnsense/scripts/firmware/launcher.sh
@ -588,6 +587,7 @@
/usr/local/opnsense/scripts/firmware/reinstall.sh
/usr/local/opnsense/scripts/firmware/remove.sh
/usr/local/opnsense/scripts/firmware/running.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/list_arp.py

View File

@ -64,26 +64,26 @@ class FirmwareController extends ApiControllerBase
public function statusAction()
{
$config = Config::getInstance()->object();
$core_want = 'opnsense';
if (!empty($config->system->firmware->family)) {
$core_want .= '-' . (string)$config->system->firmware->family;
$type_want = 'opnsense';
if (!empty($config->system->firmware->type)) {
$type_want .= '-' . (string)$config->system->firmware->type;
}
$this->sessionClose(); // long running action, close session
$backend = new Backend();
$core_have = trim($backend->configdRun('firmware core name'));
$type_have = trim($backend->configdRun('firmware type name'));
$backend->configdRun('firmware changelog fetch');
if (!empty($core_have) && $core_have !== $core_want) {
$core_ver = trim($backend->configdRun('firmware core version ' . escapeshellarg($core_want)));
if (!empty($type_have) && $type_have !== $type_want) {
$type_ver = trim($backend->configdRun('firmware type version ' . escapeshellarg($type_want)));
return array(
'status_msg' => gettext('The release family requires an update.'),
'all_packages' => array($core_want => array(
'status_msg' => gettext('The release type requires an update.'),
'all_packages' => array($type_want => array(
'reason' => gettext('new'),
'old' => gettext('N/A'),
'name' => $core_want,
'new' => $core_ver,
'name' => $type_want,
'new' => $type_ver,
)),
'status_upgrade_action' => 'rel',
'status' => 'ok',
@ -345,9 +345,9 @@ class FirmwareController extends ApiControllerBase
public function upgradeAction()
{
$config = Config::getInstance()->object();
$core_want = 'opnsense';
if (!empty($config->system->firmware->family)) {
$core_want .= '-' . (string)$config->system->firmware->family;
$type_want = 'opnsense';
if (!empty($config->system->firmware->type)) {
$type_want .= '-' . (string)$config->system->firmware->type;
}
$this->sessionClose(); // long running action, close session
$backend = new Backend();
@ -359,7 +359,7 @@ class FirmwareController extends ApiControllerBase
} elseif ($this->request->getPost('upgrade') == 'maj') {
$action = 'firmware upgrade maj';
} elseif ($this->request->getPost('upgrade') == 'rel') {
$action = 'firmware core switch ' . escapeshellarg($core_want);
$action = 'firmware type install ' . escapeshellarg($type_want);
} else {
$action = 'firmware upgrade all';
}
@ -769,15 +769,15 @@ class FirmwareController extends ApiControllerBase
$result = array();
$result['flavour'] = '';
$result['family'] = '';
$result['mirror'] = '';
$result['type'] = '';
if (!empty($config->system->firmware->flavour)) {
$result['flavour'] = (string)$config->system->firmware->flavour;
}
if (!empty($config->system->firmware->family)) {
$result['family'] = (string)$config->system->firmware->family;
if (!empty($config->system->firmware->type)) {
$result['type'] = (string)$config->system->firmware->type;
}
if (!empty($config->system->firmware->mirror)) {
@ -802,7 +802,7 @@ class FirmwareController extends ApiControllerBase
$selectedMirror = filter_var($this->request->getPost("mirror", null, ""), FILTER_SANITIZE_URL);
$selectedFlavour = filter_var($this->request->getPost("flavour", null, ""), FILTER_SANITIZE_URL);
$selectedFamily = filter_var($this->request->getPost("family", null, ""), FILTER_SANITIZE_URL);
$selectedType = filter_var($this->request->getPost("type", null, ""), FILTER_SANITIZE_URL);
$selSubscription = filter_var($this->request->getPost("subscription", null, ""), FILTER_SANITIZE_URL);
// config data without model, prepare xml structure and write data
@ -831,12 +831,16 @@ class FirmwareController extends ApiControllerBase
unset($config->system->firmware->flavour);
}
if (!isset($config->system->firmware->family)) {
$config->system->firmware->addChild('family');
if (!isset($config->system->firmware->type)) {
$config->system->firmware->addChild('type');
}
$config->system->firmware->family = $selectedFamily;
if (empty($config->system->firmware->family)) {
unset($config->system->firmware->family);
$config->system->firmware->type = $selectedType;
if (empty($config->system->firmware->type)) {
unset($config->system->firmware->type);
}
if (!@count($config->system->firmware->children())) {
unset($config->system->firmware);
}
Config::getInstance()->save();

View File

@ -111,7 +111,7 @@ POSSIBILITY OF SUCH DAMAGE.
$('#updatelist').hide();
$('#update_status').show();
$('#updatetab > a').tab('show');
$('#updatestatus').html("{{ lang._('Upgrading, please wait...') }}");
$('#updatestatus').html("{{ lang._('Updating, please wait...') }}");
$("#audit").attr("style","display:none");
maj_suffix = '';
if ($.upgrade_action == 'maj') {
@ -606,17 +606,17 @@ POSSIBILITY OF SUCH DAMAGE.
$.each(firmwareoptions.families, function(key, value) {
var selected = false;
if (key == firmwareconfig['family']) {
if (key == firmwareconfig['type']) {
selected = true;
}
$("#firmware_family").append($("<option/>")
$("#firmware_type").append($("<option/>")
.attr("value",key)
.text(value)
.prop('selected', selected)
);
});
$("#firmware_family").selectpicker('refresh');
$("#firmware_family").change();
$("#firmware_type").selectpicker('refresh');
$("#firmware_type").change();
});
});
@ -647,7 +647,7 @@ POSSIBILITY OF SUCH DAMAGE.
var confopt = {};
confopt.mirror = $("#firmware_mirror_value").val();
confopt.flavour = $("#firmware_flavour_value").val();
confopt.family = $("#firmware_family").val();
confopt.type = $("#firmware_type").val();
if ($("#firmware_mirror option:selected").data("has_subscription") == true) {
confopt.subscription = $("#firmware_mirror_subscription").val();
} else {
@ -769,12 +769,12 @@ POSSIBILITY OF SUCH DAMAGE.
<td></td>
</tr>
<tr>
<td><a id="help_for_family" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> {{ lang._('Release Family') }}</td>
<td><a id="help_for_type" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> {{ lang._('Release Type') }}</td>
<td>
<select class="selectpicker" id="firmware_family">
<select class="selectpicker" id="firmware_type">
</select>
<div class="hidden" for="help_for_family">
{{ lang._('Select the release family. Use with care.') }}
<div class="hidden" for="help_for_type">
{{ lang._('Select the release type. Use with care.') }}
</div>
</td>
<td></td>

View File

@ -29,12 +29,12 @@ LOCKFILE="/tmp/pkg_upgrade.progress"
FLOCK="/usr/local/bin/flock -n -o"
COMMANDS="
audit
core
hotfix
install
lock
reinstall
remove
type
unlock
upgrade
"

View File

@ -31,6 +31,6 @@ PACKAGE=${1}
# Truncate upgrade progress file
: > ${PKG_PROGRESS_FILE}
echo "***GOT REQUEST TO SWITCH: ${PACKAGE}***" >> ${PKG_PROGRESS_FILE}
echo "***GOT REQUEST FOR TYPE: ${PACKAGE}***" >> ${PKG_PROGRESS_FILE}
opnsense-update -t ${PACKAGE} >> ${PKG_PROGRESS_FILE} 2>&1
echo '***DONE***' >> ${PKG_PROGRESS_FILE}

View File

@ -35,23 +35,23 @@ parameters:%s
type:script_output
message:Viewing license for %s
[core.name]
[type.name]
command:opnsense-update -T
parameters:
type:script_output
message:Probing core package name
message:Probing release type name
[core.version]
[type.version]
command:pkg rquery %v
parameters:%s
type:script_output
message:Probing core package version
message:Probing release type version
[core.switch]
command:/usr/sbin/daemon -f /usr/local/opnsense/scripts/firmware/launcher.sh core
[type.install]
command:/usr/sbin/daemon -f /usr/local/opnsense/scripts/firmware/launcher.sh type
parameters:%s
type:script
message:Switching core package
message:Installing release type %s
[audit]
command:/usr/sbin/daemon -f /usr/local/opnsense/scripts/firmware/launcher.sh audit