firmware: make firmware-upgrade the version file

This commit is contained in:
Franco Fichtner 2018-09-16 23:14:53 +02:00
parent 0cf4fe5e38
commit 8fcda9f8aa
9 changed files with 27 additions and 34 deletions

View File

@ -31,10 +31,6 @@ EOF
cat /etc/rc.shutdown.bak >> /etc/rc.shutdown
rm -f /etc/rc.shutdown.bak
echo "Writing package metadata"
mkdir -p /usr/local/opnsense/version
echo "%%CORE_COMMIT%%" > /usr/local/opnsense/version/opnsense
/usr/local/etc/rc.d/configd start
/usr/local/etc/rc.configure_firmware

1
.gitignore vendored
View File

@ -11,5 +11,4 @@
/src/etc/ssh/**
/src/lib/**
/src/opnsense/changelog
/src/opnsense/firmware-product
/src/www/wpad.dat

View File

@ -153,9 +153,7 @@ want-${WANT}:
mount:
@if [ ! -f ${WRKDIR}/.mount_done ]; then \
echo -n "Enabling core.git live mount..."; \
sed ${SED_REPLACE} ${.CURDIR}/src/opnsense/firmware-product.in > \
${.CURDIR}/src/opnsense/firmware-product; \
echo "${CORE_COMMIT}" > \
sed ${SED_REPLACE} ${.CURDIR}/src/opnsense/version/opnsense.in > \
${.CURDIR}/src/opnsense/version/opnsense; \
mount_unionfs ${.CURDIR}/src ${LOCALBASE}; \
touch ${WRKDIR}/.mount_done; \
@ -168,7 +166,6 @@ umount:
echo -n "Disabling core.git live mount..."; \
umount -f "<above>:${.CURDIR}/src"; \
rm ${.CURDIR}/src/opnsense/version/opnsense; \
rm ${.CURDIR}/src/opnsense/firmware-product; \
rm ${WRKDIR}/.mount_done; \
echo "done"; \
service configd restart; \

2
plist
View File

@ -315,7 +315,6 @@
/usr/local/opnsense/contrib/simplepie/phpunit.xml.dist
/usr/local/opnsense/contrib/tzdata/iso3166.tab
/usr/local/opnsense/contrib/tzdata/zone.tab
/usr/local/opnsense/firmware-product
/usr/local/opnsense/mvc/app/cache/README
/usr/local/opnsense/mvc/app/config/config.php
/usr/local/opnsense/mvc/app/config/loader.php
@ -836,6 +835,7 @@
/usr/local/opnsense/site-python/sqlite3_helper.py
/usr/local/opnsense/site-python/watchers/__init__.py
/usr/local/opnsense/site-python/watchers/dhcpd.py
/usr/local/opnsense/version/opnsense
/usr/local/opnsense/www/api.php
/usr/local/opnsense/www/css/bootstrap-datepicker3.min.css
/usr/local/opnsense/www/css/flags/1x1/ad.svg

View File

@ -30,7 +30,7 @@
*/
/* XXX make this a getter function for traceability */
$g = json_decode(file_get_contents('/usr/local/opnsense/firmware-product'), true);
$g = json_decode(file_get_contents('/usr/local/opnsense/version/opnsense'), true);
openlog($g['product_id'], LOG_ODELAY, LOG_USER);
register_shutdown_function('closelog');

View File

@ -1,29 +1,29 @@
<?php
/**
* Copyright (C) 2015 Deciso B.V.
* All rights reserved.
/*
* Copyright (C) 2015 Deciso B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Base;
@ -187,8 +187,8 @@ class ControllerBase extends ControllerRoot
$this->view->ui_theme = $cnf->object()->theme;
}
// parse firmware-product product properties, use template (.in) when not found
$firmware_product_fn = __DIR__.'/../../../../../firmware-product';
// parse product properties, use template (.in) when not found
$firmware_product_fn = __DIR__.'/../../../../../version/opnsense';
$firmware_product_fn = !is_file($firmware_product_fn) ? $firmware_product_fn .".in" : $firmware_product_fn;
$product_vars = json_decode(file_get_contents($firmware_product_fn), true);
foreach ($product_vars as $product_key => $product_var) {

View File

@ -1 +1,2 @@
!opnsense.in
*

View File

@ -24,7 +24,7 @@
# POSSIBILITY OF SUCH DAMAGE.
PATTERN="s:[^\"]*\"\([^\"]*\)\"[^\"]*\"\([^\"]*\)\".*:\1=\2:"
VERSION="/usr/local/opnsense/firmware-product"
VERSION="/usr/local/opnsense/version/opnsense"
if [ ! -f ${VERSION} ]; then
echo "Missing ${VERSION}" >&2