restructuring to be continued ...
|
@ -21,49 +21,80 @@
|
||||||
# merge - apply the diff to the local copy
|
# merge - apply the diff to the local copy
|
||||||
#
|
#
|
||||||
# final action:
|
# final action:
|
||||||
# release - the same as "dfsbuild config iso"
|
# release - the same as "dfsbuild config harden iso"
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# problems of this script:
|
# problems of this script:
|
||||||
# - has to run as root, because dfsbuild, config, iso, chroot, devel,
|
# - has to run as root, because dfsbuild, config, iso, chroot, devel,
|
||||||
# revert and release need root privileges
|
# revert and release need root privileges
|
||||||
|
# - 'harden' is strangely integrated
|
||||||
#
|
#
|
||||||
# you may run this script with multiple arguments, e.g.:
|
# you may run this script with multiple arguments, e.g.:
|
||||||
# cb-build.sh dfsbuild config iso qemu
|
# cb-build.sh dfsbuild config iso qemu
|
||||||
#
|
#
|
||||||
# the action "release" does what it says :)
|
# the action "release" does what it says :)
|
||||||
# (all developer's features like sshd, writable templates and
|
# (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
|
set -ue
|
||||||
|
|
||||||
# dfsbuild config
|
# the base directory of your local development files
|
||||||
CONFIG="dfs.cbox.conf"
|
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)
|
# the build directory (will be ERASED without warning)
|
||||||
BUILDDIR="_builddir/cd1"
|
BUILDDIR="$ROOT_DIR/_builddir/cd1"
|
||||||
|
|
||||||
# image directory created by dfsbuild
|
# image directory created by dfsbuild
|
||||||
IMAGE_DIR_ORIG="$BUILDDIR/image"
|
IMAGE_DIR_ORIG="$BUILDDIR/image"
|
||||||
|
|
||||||
# a working copy of the image directory
|
# a working copy of the image directory
|
||||||
IMAGE_DIR="$BUILDDIR/image-working"
|
IMAGE_DIR="$BUILDDIR/image-working"
|
||||||
|
|
||||||
# template directory for cryptobox specific configuration
|
# template directory for cryptobox specific configuration
|
||||||
TEMPLATE_DIR="cryptobox.conf.d"
|
TEMPLATE_DIR="cbox-tree.d"
|
||||||
|
|
||||||
# the iso image
|
# the iso image
|
||||||
IMAGE_FILE="$BUILDDIR/cryptobox.iso"
|
IMAGE_FILE="$BUILDDIR/cryptobox.iso"
|
||||||
|
|
||||||
|
# dfsbuild config
|
||||||
|
CONFIG="dfs.cbox.conf"
|
||||||
|
|
||||||
# temporary directory
|
# temporary directory
|
||||||
TMP_DIR="/tmp/`basename $0`-$$"
|
TMP_DIR="/tmp/`basename $0`-$$"
|
||||||
|
|
||||||
|
# the virtual harddisk image used for qemu
|
||||||
HD_IMAGE="/tmp/`basename $0`-testplatte.img"
|
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"
|
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"
|
CHROOTSTART="/usr/lib/cryptobox/chroot-start.sh"
|
||||||
|
|
||||||
|
# for burning a CD
|
||||||
CDWRITER="0,0,0"
|
CDWRITER="0,0,0"
|
||||||
LOCALCONF_DIR=local.conf.d
|
|
||||||
# for development diffs and merges from a running cryptobox
|
# for development diffs and merges from a running cryptobox
|
||||||
SSH_CONFIG_FILE="$LOCALCONF_DIR/ssh-options"
|
SSH_CONFIG_FILE="$LOCALCONF_DIR/ssh_config"
|
||||||
SSH_HOST=cryptobox
|
|
||||||
REMOTE_COMMAND="/usr/lib/cryptobox/devel-features.sh"
|
# extract the hostname of the cryptobox from the ssh_config file
|
||||||
CUSTOM_CONFIGURE_DIR=$LOCALCONF_DIR/custom-configure.d
|
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()
|
function run_dfsbuild()
|
||||||
|
@ -186,7 +217,7 @@ function upload2devel()
|
||||||
echo "Copying local files to the cryptobox ... "
|
echo "Copying local files to the cryptobox ... "
|
||||||
if scp -F "$SSH_CONFIG_FILE" -rpq "$TMP_DIR/." cryptobox:/tmp/mirror
|
if scp -F "$SSH_CONFIG_FILE" -rpq "$TMP_DIR/." cryptobox:/tmp/mirror
|
||||||
then echo "Set the base for future diffs to current state ..."
|
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!'
|
else echo 'ERROR: copying failed!'
|
||||||
fi
|
fi
|
||||||
rm -rf "$TMP_DIR"
|
rm -rf "$TMP_DIR"
|
||||||
|
@ -199,13 +230,13 @@ function merge_from_devel()
|
||||||
{
|
{
|
||||||
check_ssh_defaults
|
check_ssh_defaults
|
||||||
echo "Check for collisions ... (dry-run)"
|
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
|
then echo
|
||||||
echo "Applying diff ..."
|
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
|
||||||
echo "Set the base for future diffs to current state ..."
|
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!"
|
else echo "Merging will fail - do it manually!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -241,7 +272,7 @@ while [ $# -gt 0 ]
|
||||||
diff )
|
diff )
|
||||||
# get a diff from a running development cryptobox
|
# get a diff from a running development cryptobox
|
||||||
check_ssh_defaults
|
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 )
|
||||||
merge_from_devel
|
merge_from_devel
|
||||||
|
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 51 B After Width: | Height: | Size: 51 B |