Added snapshot for debootstrap completion and when system is updated with extra packages before Whonix is installed for debugging only (SNAPSHOT must be set to "1"

Tweaked Whonix configurations some more so it should now run without errors
pull/1/head
Jason Mehring 10 years ago
parent 1334b8ae50
commit 4e2a9158a8

@ -10,15 +10,15 @@
# ------------------------------------------------------------------------------
# Configurations
# ------------------------------------------------------------------------------
INSTALLDIR="$(readlink -m mnt)"
umount_kill "$INSTALLDIR" || :
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
set -x
else
set -e
fi
INSTALLDIR="$(readlink -m mnt)"
umount_kill "$INSTALLDIR" || :
# ------------------------------------------------------------------------------
# Execute any custom pre configuration scripts
# ------------------------------------------------------------------------------

@ -13,10 +13,10 @@
################################################################################
# ------------------------------------------------------------------------------
# Return if DEBUG is not "1"
# Return if SNAPSHOT is not "1"
# ------------------------------------------------------------------------------
# This script is only used if DEBUG is set
if [ ! "$DEBUG" == "1" ]; then
# This script is only used if SNAPSHOT is set
if [ ! "$SNAPSHOT" == "1" ]; then
exit 0
fi
@ -39,10 +39,10 @@ INSTALLDIR="$(readlink -m mnt)"
umount_kill "$INSTALLDIR" || :
# ------------------------------------------------------------------------------
# Use an already prepared debian image to install Whonix (for DEBUGGING)
# Use a snapshot of the debootstraped debian image to install Whonix (for DEBUGGING)
# ------------------------------------------------------------------------------
splitPath "$IMG" path_parts
PREPARED_IMG="${path_parts[dir]}${path_parts[base]}-prepared${path_parts[dotext]}"
PREPARED_IMG="${path_parts[dir]}${path_parts[base]}-debootstrap${path_parts[dotext]}"
if [ -f "$PREPARED_IMG" ]; then
warn "Copying $PREPARED_IMG to $IMG"

@ -2,10 +2,10 @@
# vim: set ts=4 sw=4 sts=4 et :
# ------------------------------------------------------------------------------
# Return if DEBUG is not "1"
# Return if SNAPSHOT is not "1"
# ------------------------------------------------------------------------------
# This script is only used if DEBUG is set
if [ ! "$DEBUG" == "1" ]; then
# This script is only used if SNAPSHOT is set
if [ ! "$SNAPSHOT" == "1" ]; then
exit 0
fi
@ -25,10 +25,10 @@ else
fi
# ------------------------------------------------------------------------------
# Create a copy of an already prepared bootstraped image if it does not exist
# Create a snapshot of the already debootstraped image
# ------------------------------------------------------------------------------
splitPath "$IMG" path_parts
PREPARED_IMG="${path_parts[dir]}${path_parts[base]}-prepared${path_parts[dotext]}"
PREPARED_IMG="${path_parts[dir]}${path_parts[base]}-debootstrap${path_parts[dotext]}"
if ! [ -f "$PREPARED_IMG" ]; then
umount_kill "$INSTALLDIR" || :

@ -16,6 +16,24 @@ else
set -e
fi
# ------------------------------------------------------------------------------
# XXX: Create a snapshot - Only for DEBUGGING!
# ------------------------------------------------------------------------------
# Only execute if SNAPSHOT is set
if [ "$SNAPSHOT" == "1" ]; then
splitPath "$IMG" path_parts
PREPARED_IMG="${path_parts[dir]}${path_parts[base]}-updated${path_parts[dotext]}"
if ! [ -f "$PREPARED_IMG" ]; then
umount_kill "$INSTALLDIR" || :
warn "Copying $IMG to $PREPARED_IMG"
cp -f "$IMG" "$PREPARED_IMG"
mount -o loop "$IMG" "$INSTALLDIR" || exit 1
for fs in /dev /dev/pts /proc /sys /run; do mount -B $fs "$INSTALLDIR/$fs"; done
fi
fi
# ------------------------------------------------------------------------------
# chroot Whonix build script (Make sure set -e is not set)
# ------------------------------------------------------------------------------
@ -166,16 +184,17 @@ if ! [ -f "$INSTALLDIR/tmp/.prepared_whonix" ]; then
# Patch anon-meta-packages to not depend on grub-pc
# XXX: Seems like the error disappears, but then whonix updates to original code?
pushd "$WHONIX_DIR/packages/anon-meta-packages/debian"
pushd "$WHONIX_DIR"
{
sed -i 's/ grub-pc,//g' control || :;
sed -i 's/grub-pc//g' grml_packages || :;
su $USER -c "git commit -am 'removed grub-pc depend'" || :;
}
popd
pushd "$WHONIX_DIR"
pushd "$WHONIX_DIR/packages/anon-meta-packages/debian"
{
sed -i 's/grub-pc//g' grml_packages || :;
sed -i 's/ grub-pc,//g' control || :;
su $USER -c "dpkg-source --commit" || :;
su $USER -c "git commit -am 'removed grub-pc depend'" || :;
}
popd
@ -183,6 +202,7 @@ if ! [ -f "$INSTALLDIR/tmp/.prepared_whonix" ]; then
pushd "$WHONIX_DIR/packages/anon-shared-build-fix-grub/usr/lib/anon-dist/chroot-scripts-post.d"
{
sed -i 's/update-grub/:/g' 85_update_grub || :;
su $USER -c "dpkg-source --commit" || :;
su $USER -c "git commit -am 'removed grub-pc depend'" || :;
}
popd

Loading…
Cancel
Save