cryptonas-archive/deb-live_v0.3.5/config/cnas-active-settings

93 lines
2.9 KiB
Text
Raw Normal View History

#!/bin/sh
#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.
#This file also contains a hack to write the scoreboard
#file.
# 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_".
#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
#Include files in "cnas-custom-settings.d" directory
if [ -d ${CNAS_CONFIG_DIR}/cnas-custom-settings.d ]
then
for include_file in `find ${CNAS_CONFIG_DIR}/cnas-custom-settings.d -maxdepth 1 -type f -print`
do
. "$include_file"
done
fi
#Include "cnas-custom-settings" IFF this file exists. Variables here can
#override those in "cnas-custom-settings.d" directory.
[ -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 "
_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
#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
#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
#Update the scoreboard file from the current shell vars
echo "CryptoNAS: updating scoreboard file..."
set | grep -e "^CNAS_" >> ${_CNAS_SCOREBOARD}
#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