device: allow for device-specific extras; closes #31

This commit is contained in:
Franco Fichtner 2016-05-06 06:55:01 +02:00
parent ddd58223cb
commit 45e845451e
4 changed files with 43 additions and 8 deletions

View File

@ -25,6 +25,7 @@ NAME?= OPNsense
TYPE?= opnsense
FLAVOUR?= OpenSSL
SETTINGS?= 16.1
DEVICE?= a10
MIRRORS?= https://opnsense.c0urier.net \
http://mirrors.nycbug.org/pub/opnsense \
http://mirror.wdc1.us.leaseweb.net/opnsense \
@ -75,6 +76,6 @@ ${STEP}: lint
-f ${FLAVOUR} -n ${NAME} -v ${VERSION} -s ${SETTINGS} \
-S ${SRCDIR} -P ${PORTSDIR} -p ${PLUGINSDIR} -T ${TOOLSDIR} \
-C ${COREDIR} -R ${PORTSREFDIR} -t ${TYPE} -k ${PRIVKEY} \
-K ${PUBKEY} -l "${SIGNCHK}" -L "${SIGNCMD}" \
-K ${PUBKEY} -l "${SIGNCHK}" -L "${SIGNCMD}" -d ${DEVICE} \
-m ${MIRRORS:Ox:[1]} -o "${STAGEDIRPREFIX}" ${${STEP}_ARGS}
.endfor

View File

@ -35,17 +35,21 @@ usage()
echo "Usage: ${0} -f flavour -n name -v version -R freebsd-ports.git" >&2
echo " -C core.git -P ports.git -S src.git -T tools.git -t type" >&2
echo " -k /path/to/privkey -K /path/to/pubkey -m web_mirror" >&2
echo " [ -l customsigncheck -L customsigncommand ]" >&2
echo " -d device [ -l customsigncheck -L customsigncommand ]" >&2
echo " [ -o stagedirprefix ] [...]" >&2
exit 1
}
while getopts C:f:K:k:L:l:m:n:o:P:p:R:S:s:T:t:v: OPT; do
while getopts C:d:f:K:k:L:l:m:n:o:P:p:R:S:s:T:t:v: OPT; do
case ${OPT} in
C)
export COREDIR=${OPTARG}
SCRUB_ARGS=${SCRUB_ARGS};shift;shift
;;
d)
export PRODUCT_DEVICE=${PORTARG}
SCRUB_ARGS=${SCRUB_ARGS};shift;shift
;;
f)
export PRODUCT_FLAVOUR=${OPTARG}
SCRUB_ARGS=${SCRUB_ARGS};shift;shift
@ -130,6 +134,7 @@ if [ -z "${PRODUCT_NAME}" -o \
-z "${PRODUCT_MIRROR}" -o \
-z "${PRODUCT_PRIVKEY}" -o \
-z "${PRODUCT_PUBKEY}" -o \
-z "${PRODUCT_DEVICE}" -o \
-z "${TOOLSDIR}" -o \
-z "${PLUGINSDIR}" -o \
-z "${PORTSDIR}" -o \
@ -162,6 +167,7 @@ export TARGETARCH=${ARCH}
# define target directories
export CONFIGDIR="${TOOLSDIR}/config/${PRODUCT_SETTINGS}"
export STAGEDIR="${STAGEDIRPREFIX}${CONFIGDIR}/${PRODUCT_FLAVOUR}"
export DEVICEDIR="${TOOLSDIR}/device"
export IMAGESDIR="/tmp/images"
export SETSDIR="/tmp/sets"
export PACKAGESDIR="/.pkg"
@ -566,7 +572,7 @@ setup_packages()
clean_packages ${1}
}
setup_extras()
_setup_extras_generic()
{
if [ ! -f ${CONFIGDIR}/extras.conf ]; then
return
@ -581,6 +587,27 @@ setup_extras()
fi
}
_setup_extras_device()
{
if [ ! -f ${DEVICEDIR}/${PRODUCT_DEVICE}.conf ]; then
return
fi
. ${DEVICEDIR}/${PRODUCT_DEVICE}.conf
if [ -n "$(type ${2}_hook 2> /dev/null)" ]; then
echo ">>> Begin ${PRODUCT_DEVICE} extra: ${2}_hook"
${2}_hook ${1}
echo ">>> End ${PRODUCT_DEVICE} extra: ${2}_hook"
fi
}
setup_extras()
{
_setup_extras_generic ${@}
_setup_extras_device ${@}
}
setup_mtree()
{
echo ">>> Creating mtree summary of files present..."

View File

@ -12,8 +12,6 @@ EOF
sed -i '' -e "s:</system>:${SERIAL_CONFIG}<use_mfs_tmpvar/></system>:" \
${STAGEDIR}${CONFIG_XML}
sed -i "" -Ee 's:^ttyu0:ttyu0 "/usr/libexec/getty std.9600" cons25 on secure:' ${STAGEDIR}/etc/ttys
}
serial_hook()
@ -28,6 +26,4 @@ comconsole_speed="${SERIAL_SPEED}"
EOF
sed -i '' -e "s:</system>:${SERIAL_CONFIG}</system>:" ${STAGEDIR}${CONFIG_XML}
sed -i '' -Ee 's:^ttyu0:ttyu0 "/usr/libexec/getty std.9600" cons25 on secure:' ${STAGEDIR}/etc/ttys
}

11
device/a10.conf Normal file
View File

@ -0,0 +1,11 @@
# https://www.deciso.com/netboard-a10/
nano_hook()
{
sed -i '' -Ee 's:^ttyu0:ttyu0 "/usr/libexec/getty std.9600" cons25 on secure:' ${STAGEDIR}/etc/ttys
}
serial_hook()
{
sed -i '' -Ee 's:^ttyu0:ttyu0 "/usr/libexec/getty std.9600" cons25 on secure:' ${STAGEDIR}/etc/ttys
}