|
|
|
@ -21,49 +21,80 @@
|
|
|
|
|
# merge - apply the diff to the local copy
|
|
|
|
|
#
|
|
|
|
|
# final action:
|
|
|
|
|
# release - the same as "dfsbuild config iso"
|
|
|
|
|
# release - the same as "dfsbuild config harden iso"
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# problems of this script:
|
|
|
|
|
# - has to run as root, because dfsbuild, config, iso, chroot, devel,
|
|
|
|
|
# revert and release need root privileges
|
|
|
|
|
# - 'harden' is strangely integrated
|
|
|
|
|
#
|
|
|
|
|
# you may run this script with multiple arguments, e.g.:
|
|
|
|
|
# cb-build.sh dfsbuild config iso qemu
|
|
|
|
|
#
|
|
|
|
|
# the action "release" does what it says :)
|
|
|
|
|
# (all developer's features like sshd, writable templates and
|
|
|
|
|
# the test-suite are deactivated)
|
|
|
|
|
# the test-suite are deactivated, some packages get removed)
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set -ue
|
|
|
|
|
|
|
|
|
|
# dfsbuild config
|
|
|
|
|
CONFIG="dfs.cbox.conf"
|
|
|
|
|
# the base directory of your local development files
|
|
|
|
|
ROOT_DIR=$(dirname "$0")
|
|
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
|
|
|
|
|
|
# the build directory (will be ERASED without warning)
|
|
|
|
|
BUILDDIR="_builddir/cd1"
|
|
|
|
|
BUILDDIR="$ROOT_DIR/_builddir/cd1"
|
|
|
|
|
|
|
|
|
|
# image directory created by dfsbuild
|
|
|
|
|
IMAGE_DIR_ORIG="$BUILDDIR/image"
|
|
|
|
|
|
|
|
|
|
# a working copy of the image directory
|
|
|
|
|
IMAGE_DIR="$BUILDDIR/image-working"
|
|
|
|
|
|
|
|
|
|
# template directory for cryptobox specific configuration
|
|
|
|
|
TEMPLATE_DIR="cryptobox.conf.d"
|
|
|
|
|
TEMPLATE_DIR="cbox-tree.d"
|
|
|
|
|
|
|
|
|
|
# the iso image
|
|
|
|
|
IMAGE_FILE="$BUILDDIR/cryptobox.iso"
|
|
|
|
|
|
|
|
|
|
# dfsbuild config
|
|
|
|
|
CONFIG="dfs.cbox.conf"
|
|
|
|
|
|
|
|
|
|
# temporary directory
|
|
|
|
|
TMP_DIR="/tmp/`basename $0`-$$"
|
|
|
|
|
|
|
|
|
|
# the virtual harddisk image used for qemu
|
|
|
|
|
HD_IMAGE="/tmp/`basename $0`-testplatte.img"
|
|
|
|
|
# mkisofs options (the option "-U" is not clean, but it prevents long filenames from getting mapped)
|
|
|
|
|
|
|
|
|
|
# mkisofs options (the option "-U" is not clean, but it prevents long
|
|
|
|
|
# filenames from getting mapped)
|
|
|
|
|
MKISOFS_OPTIONS="-allow-multidot -U -D -iso-level 3 -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 1 -boot-info-table -pad -R"
|
|
|
|
|
|
|
|
|
|
# the chroot-wrapper within the cryptobox
|
|
|
|
|
CHROOTSTART="/usr/lib/cryptobox/chroot-start.sh"
|
|
|
|
|
|
|
|
|
|
# for burning a CD
|
|
|
|
|
CDWRITER="0,0,0"
|
|
|
|
|
LOCALCONF_DIR=local.conf.d
|
|
|
|
|
|
|
|
|
|
# for development diffs and merges from a running cryptobox
|
|
|
|
|
SSH_CONFIG_FILE="$LOCALCONF_DIR/ssh-options"
|
|
|
|
|
SSH_HOST=cryptobox
|
|
|
|
|
REMOTE_COMMAND="/usr/lib/cryptobox/devel-features.sh"
|
|
|
|
|
CUSTOM_CONFIGURE_DIR=$LOCALCONF_DIR/custom-configure.d
|
|
|
|
|
SSH_CONFIG_FILE="$LOCALCONF_DIR/ssh_config"
|
|
|
|
|
|
|
|
|
|
# extract the hostname of the cryptobox from the ssh_config file
|
|
|
|
|
SSH_HOST=$(grep "^Host " $SSH_CONFIG_FILE | head -1 | sed 's/^Host *\(.*\)$/\1/')
|
|
|
|
|
|
|
|
|
|
# the script within the box, that does the development 'diff'
|
|
|
|
|
DEVEL_FEATURES_SCRIPT="/usr/lib/cryptobox/devel-features.sh"
|
|
|
|
|
|
|
|
|
|
# local configuration directory - contains scripts to be executed after
|
|
|
|
|
# 'configure'
|
|
|
|
|
CUSTOM_CONFIGURE_DIR="$ROOT_DIR/configure-local.d"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function run_dfsbuild()
|
|
|
|
@ -186,7 +217,7 @@ function upload2devel()
|
|
|
|
|
echo "Copying local files to the cryptobox ... "
|
|
|
|
|
if scp -F "$SSH_CONFIG_FILE" -rpq "$TMP_DIR/." cryptobox:/tmp/mirror
|
|
|
|
|
then echo "Set the base for future diffs to current state ..."
|
|
|
|
|
ssh -F "$SSH_CONFIG_FILE" $SSH_HOST $REMOTE_COMMAND set_diff_base
|
|
|
|
|
ssh -F "$SSH_CONFIG_FILE" $SSH_HOST $DEVEL_FEATURES_SCRIPT set_diff_base
|
|
|
|
|
else echo 'ERROR: copying failed!'
|
|
|
|
|
fi
|
|
|
|
|
rm -rf "$TMP_DIR"
|
|
|
|
@ -199,13 +230,13 @@ function merge_from_devel()
|
|
|
|
|
{
|
|
|
|
|
check_ssh_defaults
|
|
|
|
|
echo "Check for collisions ... (dry-run)"
|
|
|
|
|
if ssh -F "$SSH_CONFIG_FILE" $SSH_HOST $REMOTE_COMMAND diff | patch --dry-run -p1 -d "$TEMPLATE_DIR"
|
|
|
|
|
if ssh -F "$SSH_CONFIG_FILE" $SSH_HOST $DEVEL_FEATURES_SCRIPT diff | patch --dry-run -p1 -d "$TEMPLATE_DIR"
|
|
|
|
|
then echo
|
|
|
|
|
echo "Applying diff ..."
|
|
|
|
|
ssh -F "$SSH_CONFIG_FILE" $SSH_HOST $REMOTE_COMMAND diff | patch -p1 -d "$TEMPLATE_DIR"
|
|
|
|
|
ssh -F "$SSH_CONFIG_FILE" $SSH_HOST $DEVEL_FEATURES_SCRIPT diff | patch -p1 -d "$TEMPLATE_DIR"
|
|
|
|
|
echo
|
|
|
|
|
echo "Set the base for future diffs to current state ..."
|
|
|
|
|
ssh -F "$SSH_CONFIG_FILE" $SSH_HOST $REMOTE_COMMAND set_diff_base
|
|
|
|
|
ssh -F "$SSH_CONFIG_FILE" $SSH_HOST $DEVEL_FEATURES_SCRIPT set_diff_base
|
|
|
|
|
else echo "Merging will fail - do it manually!"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
@ -241,7 +272,7 @@ while [ $# -gt 0 ]
|
|
|
|
|
diff )
|
|
|
|
|
# get a diff from a running development cryptobox
|
|
|
|
|
check_ssh_defaults
|
|
|
|
|
ssh -F "$SSH_CONFIG_FILE" $SSH_HOST $REMOTE_COMMAND diff
|
|
|
|
|
ssh -F "$SSH_CONFIG_FILE" $SSH_HOST $DEVEL_FEATURES_SCRIPT diff
|
|
|
|
|
;;
|
|
|
|
|
merge )
|
|
|
|
|
merge_from_devel
|
|
|
|
|