build/plugins: add the plugins pass for packages

This commit is contained in:
Franco Fichtner 2015-07-09 14:32:50 +02:00
parent 5f3253b564
commit d9ce7a0bd9
5 changed files with 74 additions and 8 deletions

View File

@ -1,5 +1,5 @@
STEPS= base kernel ports core iso memstick nano \ STEPS= base kernel ports core iso memstick nano \
regress clean release skim checkout regress clean release skim checkout plugins
.PHONY: ${STEPS} .PHONY: ${STEPS}
PAGER?= less PAGER?= less
@ -21,6 +21,7 @@ SETTINGS?= latest
_VERSION!= date '+%Y%m%d%H%M' _VERSION!= date '+%Y%m%d%H%M'
VERSION?= ${_VERSION} VERSION?= ${_VERSION}
PORTSREFDIR?= /usr/freebsd-ports PORTSREFDIR?= /usr/freebsd-ports
PLUGINSDIR?= /usr/plugins
TOOLSDIR?= /usr/tools TOOLSDIR?= /usr/tools
PORTSDIR?= /usr/ports PORTSDIR?= /usr/ports
COREDIR?= /usr/core COREDIR?= /usr/core
@ -29,7 +30,7 @@ SRCDIR?= /usr/src
# A couple of meta-targets for easy use: # A couple of meta-targets for easy use:
source: base kernel source: base kernel
packages: ports core packages: ports core plugins
sets: source packages sets: source packages
images: iso memstick nano images: iso memstick nano
everything: sets images everything: sets images
@ -51,6 +52,6 @@ ${TARGET}: ${_TARGET}
${STEP}: ${STEP}:
@cd build && sh ./${.TARGET}.sh \ @cd build && sh ./${.TARGET}.sh \
-f ${FLAVOUR} -n ${NAME} -v ${VERSION} -s ${SETTINGS} \ -f ${FLAVOUR} -n ${NAME} -v ${VERSION} -s ${SETTINGS} \
-S ${SRCDIR} -P ${PORTSDIR} -T ${TOOLSDIR} \ -S ${SRCDIR} -P ${PORTSDIR} -p ${PLUGINSDIR} -T ${TOOLSDIR} \
-C ${COREDIR} -R ${PORTSREFDIR} ${${STEP}_ARGS} -C ${COREDIR} -R ${PORTSREFDIR} ${${STEP}_ARGS}
.endfor .endfor

View File

@ -1,8 +1,8 @@
About the OPNsense tools About the OPNsense tools
======================== ========================
In conjunction with src.git, ports.git and core.git they create In conjunction with src.git, ports.git, core.git and plugins.git they
sets, packages and images for the OPNsense project. The license create sets, packages and images for the OPNsense project. The license
is a standard BSD 2-Clause as reproduced here for your convenience: is a standard BSD 2-Clause as reproduced here for your convenience:
Copyright (c) 2014-2015 Franco Fichtner <franco@opnsense.org> Copyright (c) 2014-2015 Franco Fichtner <franco@opnsense.org>
@ -45,6 +45,7 @@ src):
# pkg install git # pkg install git
# cd /usr # cd /usr
# rm -rf src ports # rm -rf src ports
# git clone https://github.com/opnsense/plugins
# git clone https://github.com/opnsense/ports # git clone https://github.com/opnsense/ports
# git clone https://github.com/opnsense/tools # git clone https://github.com/opnsense/tools
# git clone https://github.com/opnsense/core # git clone https://github.com/opnsense/core
@ -96,6 +97,10 @@ Wrap up our core as a package:
# make core # make core
Build additional plugins if needed:
# make plugins
A cdrom live image is created using: A cdrom live image is created using:
# make iso # make iso

View File

@ -29,7 +29,7 @@ set -e
. ./common.sh && $(${SCRUB_ARGS}) . ./common.sh && $(${SCRUB_ARGS})
for GITDIR in ${SRCDIR} ${PORTSDIR} ${COREDIR}; do for GITDIR in ${SRCDIR} ${PORTSDIR} ${COREDIR} ${PLUGINS}; do
echo ">>> Updating ${GITDIR}:" echo ">>> Updating ${GITDIR}:"
git_update ${GITDIR} ${1} git_update ${GITDIR} ${1}
done done

View File

@ -36,7 +36,7 @@ usage()
exit 1 exit 1
} }
while getopts C:f:n:P:R:S:s:T:v: OPT; do while getopts C:f:n:P:p:R:S:s:T:v: OPT; do
case ${OPT} in case ${OPT} in
C) C)
export COREDIR=${OPTARG} export COREDIR=${OPTARG}
@ -54,6 +54,10 @@ while getopts C:f:n:P:R:S:s:T:v: OPT; do
export PORTSDIR=${OPTARG} export PORTSDIR=${OPTARG}
SCRUB_ARGS=${SCRUB_ARGS};shift;shift SCRUB_ARGS=${SCRUB_ARGS};shift;shift
;; ;;
p)
export PLUGINSDIR=${OPTARG}
SCRUB_ARGS=${SCRUB_ARGS};shift;shift
;;
R) R)
export PORTSREFDIR=${OPTARG} export PORTSREFDIR=${OPTARG}
SCRUB_ARGS=${SCRUB_ARGS};shift;shift SCRUB_ARGS=${SCRUB_ARGS};shift;shift
@ -85,6 +89,7 @@ if [ -z "${PRODUCT_NAME}" -o \
-z "${PRODUCT_VERSION}" -o \ -z "${PRODUCT_VERSION}" -o \
-z "${PRODUCT_SETTINGS}" -o \ -z "${PRODUCT_SETTINGS}" -o \
-z "${TOOLSDIR}" -o \ -z "${TOOLSDIR}" -o \
-z "${PLUGINSDIR}" -o \
-z "${PORTSDIR}" -o \ -z "${PORTSDIR}" -o \
-z "${PORTSREFDIR}" -o \ -z "${PORTSREFDIR}" -o \
-z "${COREDIR}" -o \ -z "${COREDIR}" -o \
@ -381,7 +386,7 @@ setup_stage()
{ {
echo ">>> Setting up stage in ${1}" echo ">>> Setting up stage in ${1}"
local MOUNTDIRS="/dev /usr/src /usr/ports /usr/core" local MOUNTDIRS="/dev ${SRCDIR} ${PORTSDIR} ${COREDIR} ${PLUGINSDIR}"
# might have been a chroot # might have been a chroot
for DIR in ${MOUNTDIRS}; do for DIR in ${MOUNTDIRS}; do

55
build/plugins.sh Normal file
View File

@ -0,0 +1,55 @@
#!/bin/sh
# Copyright (c) 2015 Franco Fichtner <franco@opnsense.org>
#
# 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.
set -e
. ./common.sh && $(${SCRUB_ARGS})
setup_stage ${STAGEDIR}
setup_base ${STAGEDIR}
setup_clone ${STAGEDIR} ${PLUGINSDIR}
extract_packages ${STAGEDIR}
install_packages ${STAGEDIR}
PLUGINS=$(make -C ${PLUGINSDIR} list)
for PLUGIN in ${PLUGINS}; do
chroot ${STAGEDIR} /bin/sh -es << EOF
# clear the internal staging area
rm -rf ${STAGEDIR}
mkdir ${STAGEDIR}
make -C ${PLUGINSDIR}/${PLUGIN} DESTDIR=${STAGEDIR} manifest > ${STAGEDIR}/+MANIFEST
make -C ${PLUGINSDIR}/${PLUGIN} DESTDIR=${STAGEDIR} install > ${STAGEDIR}/plist
echo -n ">>> Creating custom package for plugin ${PLUGIN}... "
pkg create -m ${STAGEDIR} -r ${STAGEDIR} -p ${STAGEDIR}/plist -o ${PACKAGESDIR}/All
echo "done"
EOF
done
bundle_packages ${STAGEDIR}