#!/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 cnas-custom-settings IFF this file exists [ -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 " #FIXME: refine regexp, try remembering during a rebuild...? # -regex '[^~]+' " # \( -name 'common -o -name 'bootstrap' -o -name 'chroot' -o -name 'binary' -o -name 'source' -o -name 'cnas-default-settings' -o -name 'cnas-custom-settings' -o -name 'cnas-active-settings' \) " #echo ${_CNAS_FIND} #_CNAS_FOUND=`${_CNAS_FIND}` _CNAS_SCOREBOARD="config/chroot_local-includes/usr/lib/cryptobox-cd/etc-scoreboard" #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 #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