From ef0f86a346c27b6ec909609f39044dcdfcd720ac Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 3 Aug 2017 09:14:13 +0200 Subject: [PATCH] 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. --- src/etc/inc/system.inc | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index f9db5c988..72d90dc79 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -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')) . '/' : '' + )) ); }