cryptonas/scripts/common.sh.inc
2005-11-30 01:10:32 +00:00

63 lines
1.7 KiB
PHP

#
# common settings and functions for cryptobox scripts
#
#################### some functions ####################
# get the path of a configuration file - local configuration files
# supersede default files
# parameter: base name of the configuration file
function get_config_file()
{
[ -e "$LOCALCONF_DIR/$1" ] && echo "$LOCALCONF_DIR/$1" && return 0
[ -e "$DEFAULTCONF_DIR/$1" ] && echo "$DEFAULTCONF_DIR/$1" && return 0
echo "configuration file ($1) not found!" >&2
exit 1
}
function error_die()
{
echo "$2" >&2
exit $1
}
################### general settings ###################
# the base directory of your local development files
ROOT_DIR=$(dirname "$0")/..
ROOT_DIR=$(cd "$ROOT_DIR"; pwd)
# the template (default) configuration directory
DEFAULTCONF_DIR="$ROOT_DIR/etc-defaults.d"
# your local configuration directory (existing files supersede the defaults)
LOCALCONF_DIR="$ROOT_DIR/etc-local.d"
# local configuration directory - contains scripts to be executed after
# 'configure'
CUSTOM_CONFIGURE_DIR="$ROOT_DIR/configure-local.d"
# template directory for cryptobox specific configuration
TEMPLATE_DIR="cbox-tree.d"
# the chroot-wrapper within the cryptobox
CHROOT_START="/usr/lib/cryptobox/chroot-start.sh"
############# include local configuration ##############
if [ -e "$(get_config_file cbox-dev.conf)" ]
then source "$(get_config_file cbox-dev.conf)"
else echo "local cbox-dev.conf ($(get_config_file cbox-dev.conf)) does not exist!" >&2
exit 1
fi
# image directory created by dfsbuild
# the BUILD_DIR is defined in the local cbox-dev.conf
IMAGE_DIR="$BUILD_DIR/image"
IMAGEZ_DIR="$BUILD_DIR/image.z"
IMAGEZ_FILE="${IMAGE_FILE/\.iso/_compressed.iso}"
UNCOMPRESSED_ITEMS="_offline autorun.inf start.html var boot opt"