firmware: change CORE_ALTABI to taret ABI detection for #5144

This commit is contained in:
Franco Fichtner 2021-11-09 09:12:24 +01:00
parent 354d5e09f2
commit c4918b4c99
5 changed files with 39 additions and 10 deletions

View File

@ -44,19 +44,15 @@ _CORE_NEXT= ${CORE_ABI:C/\./ /}
.if ${_CORE_NEXT:[2]} == 7 # community .if ${_CORE_NEXT:[2]} == 7 # community
CORE_NEXT!= expr ${_CORE_NEXT:[1]} + 1 CORE_NEXT!= expr ${_CORE_NEXT:[1]} + 1
CORE_NEXT:= ${CORE_NEXT}.1 CORE_NEXT:= ${CORE_NEXT}.1
CORE_ALTABI?= ${CORE_ABI}
.elif ${_CORE_NEXT:[2]} == 10 # business .elif ${_CORE_NEXT:[2]} == 10 # business
CORE_NEXT!= expr ${_CORE_NEXT:[1]} + 1 CORE_NEXT!= expr ${_CORE_NEXT:[1]} + 1
CORE_NEXT:= ${CORE_NEXT}.4 CORE_NEXT:= ${CORE_NEXT}.4
CORE_ALTABI?= ${_CORE_NEXT:[1]}.7
.elif ${_CORE_NEXT:[2]} == 1 # community .elif ${_CORE_NEXT:[2]} == 1 # community
CORE_NEXT= ${_CORE_NEXT:[1]} CORE_NEXT= ${_CORE_NEXT:[1]}
CORE_NEXT:= ${CORE_NEXT}.7 CORE_NEXT:= ${CORE_NEXT}.7
CORE_ALTABI?= ${CORE_ABI}
.elif ${_CORE_NEXT:[2]} == 4 # business .elif ${_CORE_NEXT:[2]} == 4 # business
CORE_NEXT= ${_CORE_NEXT:[1]} CORE_NEXT= ${_CORE_NEXT:[1]}
CORE_NEXT:= ${CORE_NEXT}.10 CORE_NEXT:= ${CORE_NEXT}.10
CORE_ALTABI?= ${_CORE_NEXT:[1]}.1
.else .else
.error Unsupported minor version for CORE_ABI=${CORE_ABI} .error Unsupported minor version for CORE_ABI=${CORE_ABI}
.endif .endif

View File

@ -76,7 +76,6 @@ CORE_SYSLOGNG?= ${_CORE_SYSLOGNG:S/./ /g:[1..2]:tW:S/ /./g}
.endif .endif
REPLACEMENTS= CORE_ABI \ REPLACEMENTS= CORE_ABI \
CORE_ALTABI \
CORE_ARCH \ CORE_ARCH \
CORE_COMMIT \ CORE_COMMIT \
CORE_COPYRIGHT_HOLDER \ CORE_COPYRIGHT_HOLDER \

View File

@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd August 17, 2021 .Dd November 9, 2021
.Dt OPNSENSE-VERSION 8 .Dt OPNSENSE-VERSION 8
.Os .Os
.Sh NAME .Sh NAME
@ -93,8 +93,12 @@ Return the package series.
Return the package version. Return the package version.
.It Fl w .It Fl w
Return the product version website. Return the product version website.
.It Fl a .It Fl x
Return the firmware ALTABI string. Return the required ABI string.
This is necessary for detecting an ABI-crossing that
requires a clean reinstall of all packages and for
manipulating the target ABI going to and away from
the business mirror.
.El .El
.Sh FILES .Sh FILES
.Bl -tag -width Ds .Bl -tag -width Ds

View File

@ -1,6 +1,5 @@
{ {
"product_abi": "%%CORE_ABI%%", "product_abi": "%%CORE_ABI%%",
"product_altabi": "%%CORE_ALTABI%%",
"product_arch": "%%CORE_ARCH%%", "product_arch": "%%CORE_ARCH%%",
"product_copyright_owner": "%%CORE_COPYRIGHT_HOLDER%%", "product_copyright_owner": "%%CORE_COPYRIGHT_HOLDER%%",
"product_copyright_url": "%%CORE_COPYRIGHT_WWW%%", "product_copyright_url": "%%CORE_COPYRIGHT_WWW%%",

View File

@ -25,6 +25,7 @@
DEFAULTS="\${product_name} \${product_version}" DEFAULTS="\${product_name} \${product_version}"
VERSIONDIR="/usr/local/opnsense/version" VERSIONDIR="/usr/local/opnsense/version"
PLUGINCTL="/usr/local/sbin/pluginctl"
OPENSSL="/usr/local/bin/openssl" OPENSSL="/usr/local/bin/openssl"
PKG="/usr/local/sbin/pkg-static" PKG="/usr/local/sbin/pkg-static"
TARGET="core" TARGET="core"
@ -74,7 +75,7 @@ while getopts AacefHiNnsVvwx OPT; do
OUTPUT="${OUTPUT} \${product_website}" OUTPUT="${OUTPUT} \${product_website}"
;; ;;
x) x)
OUTPUT="${OUTPUT} \${product_altabi}" OUTPUT="${OUTPUT} \${target_abi_major}.\${target_abi_minor}"
;; ;;
*) *)
echo "Usage: man ${0##*/}" >&2 echo "Usage: man ${0##*/}" >&2
@ -128,6 +129,36 @@ core)
RESULT=$(${PKG} info -s ${product_id}) RESULT=$(${PKG} info -s ${product_id})
product_size=${RESULT##* } product_size=${RESULT##* }
fi fi
if [ -z "${OUTPUT%%*target_abi*}" -a -f ${PLUGINCTL} ]; then
target_abi_major=${product_abi%%.*}
target_abi_minor=${product_abi#*.}
IS_BUSINESS=$(echo ${product_name} | grep -c -- '-business')
WANT_BUSINESS=$(${PLUGINCTL} -g system.firmware.mirror | \
grep -c 'opnsense-update\.deciso\.com')
if [ "${IS_BUSINESS}${WANT_BUSINESS}" = "01" -o ]; then
case ${target_abi_minor} in
1[0-2])
target_abi_major=$((target_abi_major + 1))
target_abi_minor=$((target_abi_minor - 9))
;;
*)
target_abi_minor=$((target_abi_minor + 3))
;;
esac
elif [ "${IS_BUSINESS}${WANT_BUSINESS}" = "10" ]; then
case ${target_abi_minor} in
[1-3])
target_abi_major=$((target_abi_major - 1))
target_abi_minor=$((target_abi_minor + 9))
;;
*)
target_abi_minor=$((target_abi_minor - 3))
;;
esac
fi
fi
;; ;;
*) *)
if [ -z "${OUTPUT}" ]; then if [ -z "${OUTPUT}" ]; then