diff --git a/Makefile b/Makefile index 4b63aee8b..f5b95c2e5 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2019 Franco Fichtner +# Copyright (c) 2015-2020 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -23,13 +23,11 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -PAGER?= less - -PLUGIN_ABI= 20.1 - all: @cat ${.CURDIR}/README.md | ${PAGER} +.include "Mk/defaults.mk" + CATEGORIES= benchmarks databases devel dns mail misc net-mgmt \ net security sysutils vendor www diff --git a/Mk/defaults.mk b/Mk/defaults.mk new file mode 100644 index 000000000..be747ef1b --- /dev/null +++ b/Mk/defaults.mk @@ -0,0 +1,50 @@ +# Copyright (c) 2016-2020 Franco Fichtner +# +# 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. +# +# 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 BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + +LOCALBASE?= /usr/local +PAGER?= less + +OPENSSL?= ${LOCALBASE}/bin/openssl + +_FLAVOUR!= if [ -f ${OPENSSL} ]; then ${OPENSSL} version; fi +FLAVOUR?= ${_FLAVOUR:[1]} + +PKG!= which pkg || echo true +GIT!= which git || echo true +ARCH!= uname -p + +PLUGIN_ABI?= 20.1 +PLUGIN_ARCH?= ${ARCH} +PLUGIN_FLAVOUR= ${FLAVOUR} + +REPLACEMENTS= PLUGIN_ABI \ + PLUGIN_ARCH \ + PLUGIN_FLAVOUR + +SED_REPLACE= # empty + +.for REPLACEMENT in ${REPLACEMENTS} +SED_REPLACE+= -e "s=%%${REPLACEMENT}%%=${${REPLACEMENT}}=g" +.endfor diff --git a/Mk/plugins.mk b/Mk/plugins.mk index 49d56af91..89b97d398 100644 --- a/Mk/plugins.mk +++ b/Mk/plugins.mk @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2019 Franco Fichtner +# Copyright (c) 2015-2020 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -25,9 +25,7 @@ all: check -LOCALBASE?= /usr/local -PKG!= which pkg || echo true -ARCH!= uname -p +.include "defaults.mk" PLUGIN_ARCH?= ${ARCH} PLUGIN_PHP?= 72 @@ -180,11 +178,17 @@ install: check @(cd ${.CURDIR}/src; find * -type f) | while read FILE; do \ tar -C ${.CURDIR}/src -cpf - $${FILE} | \ tar -C ${DESTDIR}${LOCALBASE} -xpf -; \ + if [ "$${FILE%%.in}" != "$${FILE}" ]; then \ + sed -i '' ${SED_REPLACE} "${DESTDIR}${LOCALBASE}/$${FILE}"; \ + mv "${DESTDIR}${LOCALBASE}/$${FILE}" "${DESTDIR}${LOCALBASE}/$${FILE%%.in}"; \ + fi; \ done @echo "${PLUGIN_PKGVERSION}" > "${DESTDIR}${LOCALBASE}/opnsense/version/${PLUGIN_NAME}" plist: check @(cd ${.CURDIR}/src; find * -type f) | while read FILE; do \ + if [ -f "$${FILE}.in" ]; then continue; fi; \ + FILE="$${FILE%%.in}"; \ echo ${LOCALBASE}/$${FILE}; \ done @echo "${LOCALBASE}/opnsense/version/${PLUGIN_NAME}" diff --git a/vendor/sunnyvalley/+POST_DEINSTALL b/vendor/sunnyvalley/+POST_DEINSTALL deleted file mode 100644 index 98bb7c983..000000000 --- a/vendor/sunnyvalley/+POST_DEINSTALL +++ /dev/null @@ -1,3 +0,0 @@ -REPO_FILE=/usr/local/etc/pkg/repos/SunnyValley.conf - -rm -f "${REPO_FILE}" diff --git a/vendor/sunnyvalley/+POST_INSTALL b/vendor/sunnyvalley/+POST_INSTALL deleted file mode 100644 index 5d7534ec0..000000000 --- a/vendor/sunnyvalley/+POST_INSTALL +++ /dev/null @@ -1,12 +0,0 @@ -OPNSENSE_FLAVOR=$(/usr/local/sbin/opnsense-version -f) -REPO_FILE=/usr/local/etc/pkg/repos/SunnyValley.conf - -case "${OPNSENSE_FLAVOR}" in -OpenSSL|LibreSSL) - echo "Configuring repository for ${OPNSENSE_FLAVOR} flavor" - sed "s/%%FLAVOR%%/${OPNSENSE_FLAVOR}/g" "${REPO_FILE}".template > "${REPO_FILE}" - ;; -*) - echo "Unsupported OPNsense flavor (${OPNSENSE_FLAVOR}), aborting" - ;; -esac diff --git a/vendor/sunnyvalley/src/etc/pkg/repos/SunnyValley.conf.template b/vendor/sunnyvalley/src/etc/pkg/repos/SunnyValley.conf.in similarity index 64% rename from vendor/sunnyvalley/src/etc/pkg/repos/SunnyValley.conf.template rename to vendor/sunnyvalley/src/etc/pkg/repos/SunnyValley.conf.in index 448247ca8..8d6757314 100644 --- a/vendor/sunnyvalley/src/etc/pkg/repos/SunnyValley.conf.template +++ b/vendor/sunnyvalley/src/etc/pkg/repos/SunnyValley.conf.in @@ -1,6 +1,6 @@ SunnyValley: { fingerprints: "/usr/local/etc/pkg/fingerprints/SunnyValley", - url: "https://updates.sunnyvalley.io/opnsense/${ABI}/%%FLAVOR%%/repo", + url: "https://updates.sunnyvalley.io/opnsense/${ABI}/%%PLUGIN_FLAVOUR%%/repo", signature_type: "fingerprints", priority: 7, enabled: yes