2008-07-04 07:33:24 +02:00
|
|
|
#!/bin/sh
|
2008-06-19 09:35:37 +02:00
|
|
|
#CryptoNAS Live include file
|
|
|
|
#$BUILD_DIR/config/cnas-active-settings
|
|
|
|
#This file includes the config files in the correct order.
|
|
|
|
#It can be included by scripts both in the bootstrap and
|
|
|
|
#chroot environments. Variable assignments in later
|
|
|
|
#includes override earlier ones.
|
2008-07-04 07:33:24 +02:00
|
|
|
#This file also contains a hack to write the scoreboard
|
|
|
|
#file.
|
2008-06-19 09:35:37 +02:00
|
|
|
|
2008-07-04 07:33:24 +02:00
|
|
|
# Variable and function names starting with underscore
|
|
|
|
# are NOT intended to be used for user customization of builds.
|
|
|
|
# In addition, the names of variables to be included in the
|
|
|
|
# scoreboard file must begin with "CNAS_".
|
2008-06-19 09:35:37 +02:00
|
|
|
|
2008-07-04 07:33:24 +02:00
|
|
|
#This file is included by:
|
|
|
|
# config/common
|
|
|
|
# config/bootstrap
|
|
|
|
# config/chroot
|
|
|
|
# config/binary
|
|
|
|
# config/source
|
|
|
|
|
|
|
|
CNAS_CONFIG_DIR="config"
|
|
|
|
|
|
|
|
. ${CNAS_CONFIG_DIR}/cnas-default-settings
|
2008-06-19 09:35:37 +02:00
|
|
|
|
2009-01-12 01:12:07 +01:00
|
|
|
#Include files in "cnas-custom-settings.d" directory
|
|
|
|
if [ -d ${CNAS_CONFIG_DIR}/cnas-custom-settings.d ]
|
|
|
|
then
|
2009-01-21 08:02:26 +01:00
|
|
|
for include_file in `find ${CNAS_CONFIG_DIR}/cnas-custom-settings.d -maxdepth 1 -type f -print`
|
2009-01-12 01:12:07 +01:00
|
|
|
do
|
|
|
|
. "$include_file"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
#Include "cnas-custom-settings" IFF this file exists. Variables here can
|
|
|
|
#override those in "cnas-custom-settings.d" directory.
|
2008-07-04 07:33:24 +02:00
|
|
|
[ -f ${CNAS_CONFIG_DIR}/cnas-custom-settings ] && . ${CNAS_CONFIG_DIR}/cnas-custom-settings
|
|
|
|
|
|
|
|
|
|
|
|
#The stage file tracks when the scoreboard update code
|
|
|
|
#needs to run. The path is relative to the build dir.
|
|
|
|
_CNAS_STAGE_DIR=".stage/"
|
|
|
|
_CNAS_STAGE=".stage/chroot_cnas-scoreboard"
|
|
|
|
|
|
|
|
|
|
|
|
#Search in the top level of config for settings files CryptoNAS
|
|
|
|
#depends on. If any of them changed more recently than
|
|
|
|
#the settings scoreboard file, update it.
|
|
|
|
_CNAS_FIND="find config -regextype posix-extended -maxdepth 1 -type f -newer ${_CNAS_STAGE} -true "
|
|
|
|
|
|
|
|
|
2008-08-18 02:24:32 +02:00
|
|
|
_CNAS_SCOREBOARD="config/chroot_local-includes/usr/share/cryptonas-live/etc-scoreboard"
|
|
|
|
|
|
|
|
#supporting unnecessary synonyms complicates change control
|
|
|
|
if [ "$CNAS_HARDNESS" == "hard" ] || [ "$CNAS_HARDNESS" == "normal" ]
|
|
|
|
then
|
|
|
|
echo "warning: \$CNAS_HARDNESS settings `hard' and `normal' deprecated; use `secure' or `devel' instead"
|
|
|
|
fi
|
2008-07-04 07:33:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
#Only run the scoreboard hack if the ".stage" directory exists
|
|
|
|
if [ -d ${_CNAS_STAGE_DIR} ]
|
|
|
|
then
|
|
|
|
#If the scoreboard file needs updating, update it:
|
|
|
|
|
|
|
|
#If the stage file does not exist or the "find" found something
|
|
|
|
if [ ! -f "${_CNAS_STAGE}" ] || [ -n "`${_CNAS_FIND}`" ]
|
|
|
|
then
|
2008-08-18 02:24:32 +02:00
|
|
|
#Add explanatory banner to scoreboard file
|
|
|
|
cat > ${_CNAS_SCOREBOARD} <<EOF
|
|
|
|
#/usr/share/cryptonas-live/etc-scoreboard
|
|
|
|
# This file is used by the CryptoNAS Live system to pass
|
|
|
|
# configuration settings within the build system and to
|
|
|
|
# the Debian Live runtime. It should NOT be checked in to
|
|
|
|
# the CryptoNAS project's SVN repository.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2008-07-04 07:33:24 +02:00
|
|
|
#Update the scoreboard file from the current shell vars
|
|
|
|
echo "CryptoNAS: updating scoreboard file..."
|
2008-08-18 02:24:32 +02:00
|
|
|
set | grep -e "^CNAS_" >> ${_CNAS_SCOREBOARD}
|
2008-07-04 07:33:24 +02:00
|
|
|
|
|
|
|
#If we updated the scoreboard, touch the .stage/...
|
|
|
|
#file we use for time stamping.
|
|
|
|
touch "${_CNAS_STAGE}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi # .stage directory exists
|
|
|
|
|
|
|
|
#Unconditionally return success
|
|
|
|
/bin/true
|