ec818dbbc3
commit includes the default configuration files, which don't work with Debian "etch".
88 lines
2.7 KiB
PHP
88 lines
2.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
|
|
}
|
|
|
|
function chroot_image()
|
|
{
|
|
MNT_SRC=$IMAGE_DIR/opt/dfsruntime/runtimerd
|
|
MNT_DST=$IMAGE_DIR/opt/dfsruntime/runtimemnt
|
|
TMP_DIR=/tmp/cryptobox-chroot-$(basename $0)-$$
|
|
[ -d "$TMP_DIR" ] && rm -rf "$TMP_DIR"
|
|
|
|
cp -a "$MNT_SRC/." "$TMP_DIR"
|
|
mount --bind "$TMP_DIR" "$MNT_DST"
|
|
|
|
[ ! -e "$TMP_DIR/dev/null" ] && mknod "$TMP_DIR/dev/null" c 1 3 && chmod 666 "$TMP_DIR/dev/null"
|
|
[ ! -e "$TMP_DIR/dev/urandom" ] && mknod "$TMP_DIR/dev/urandom" c 1 9 && chmod 444 "$TMP_DIR/dev/urandom"
|
|
[ ! -e "$TMP_DIR/dev/console" ] && mknod "$TMP_DIR/dev/console" c 1 5 && chmod 660 "$TMP_DIR/dev/console"
|
|
|
|
# remember, if proc was mounted before (e.g. because of a running chroot)
|
|
local PROC_WAS_MOUNTED=no
|
|
mount -t proc proc "$IMAGE_DIR/proc" 2>/dev/null || PROC_WAS_MOUNTED=yes
|
|
|
|
# default language setting - prevents dpkg error messages
|
|
# set default terminal (good if you are running in a screen session)
|
|
LANG=C TERM=linux chroot "$IMAGE_DIR" /bin/bash
|
|
|
|
umount "$MNT_DST"
|
|
[ "$PROC_WAS_MOUNTED" = "no" ] && umount "$IMAGE_DIR/proc"
|
|
rm -r "$TMP_DIR"
|
|
}
|
|
|
|
################### 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"
|
|
|
|
# the chroot-wrapper within the cryptobox
|
|
CHROOT_START="/usr/lib/cryptobox-cd/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/target
|
|
IMAGEZ_DIR=$BUILD_DIR/target.z
|
|
IMAGEZ_FILE="${IMAGE_FILE%.iso}_compressed.iso"
|
|
UNCOMPRESSED_ITEMS="_offline autorun.inf start.html boot opt boot.catalog"
|
|
|
|
HD_IMAGE=$ROOT_DIR/test.img
|
|
HD_IMAGE_SIZE=256
|
|
|