firmware: automatically support "other" flavours

We always have an internal ABI prefix now, if the flavour is a short
keyword, we should always use the ABI on it so "experimental" becomes
"17.7/experimental".  If a path is set "17.7/MINT/17.7/LibreSSL" we
detect the slash and assume the explicit ABI was selected.

This may eventually support things such as "nightly" or others without
fiddling through this code every time something else is added.
This commit is contained in:
Franco Fichtner 2017-08-03 09:14:13 +02:00
parent 930f7974e6
commit ef0f86a346

View File

@ -981,21 +981,14 @@ function system_firmware_configure($verbose = false)
}
if (!empty($config['system']['firmware']['flavour'])) {
$osabi = '';
switch ($config['system']['firmware']['flavour']) {
case 'libressl':
case 'latest':
/* if this is known flavour we treat it with ABI prefix */
$osabi = trim(file_get_contents('/usr/local/opnsense/version/opnsense.abi')) . '/';
break;
default:
break;
}
mwexecf(
'/usr/local/sbin/opnsense-update %s %s',
array('-sn', str_replace('/', '\/', $osabi . $config['system']['firmware']['flavour']))
'/usr/local/sbin/opnsense-update -sn %s',
str_replace('/', '\/', sprintf(
"%s{$config['system']['firmware']['flavour']}",
/* if there is no directory slash we always treat it with default ABI prefix */
strstr($config['system']['firmware']['flavour'], '/') === false ?
trim(file_get_contents('/usr/local/opnsense/version/opnsense.abi')) . '/' : ''
))
);
}