Renamed umount_image to umount_kill as to better shuit its purpose

This commit is contained in:
Jason Mehring 2014-10-14 17:04:42 -04:00
parent 574668f7d9
commit c27d84cc80
9 changed files with 26 additions and 26 deletions

View File

@ -11,7 +11,7 @@ RETCODE=0
: ${DIST=fc14} : ${DIST=fc14}
. ./builder_setup >/dev/null . ./builder_setup >/dev/null
. ./umount.sh >/dev/null . ./umount_kill.sh >/dev/null
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
set -x set -x
@ -51,7 +51,7 @@ fi
mkdir -p "$INSTALLDIR" mkdir -p "$INSTALLDIR"
mount -o loop "$IMG" "$INSTALLDIR" || exit 1 mount -o loop "$IMG" "$INSTALLDIR" || exit 1
trap "umount_image $(readlink -m $INSTALLDIR)" EXIT trap "umount_kill $(readlink -m $INSTALLDIR)" EXIT
"$SCRIPTSDIR/01_install_core.sh" "$SCRIPTSDIR/01_install_core.sh"
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -66,6 +66,6 @@ echo "-> Installing package groups..."
trap - EXIT trap - EXIT
echo "-> Unmounting prepared_image..." echo "-> Unmounting prepared_image..."
umount_image "$(readlink -m $INSTALLDIR)" || : umount_kill "$(readlink -m $INSTALLDIR)" || :
exit $RETCODE exit $RETCODE

View File

@ -8,7 +8,7 @@ export NAME="$2"
export LC_ALL=POSIX export LC_ALL=POSIX
. ./builder_setup >/dev/null . ./builder_setup >/dev/null
. ./umount.sh >/dev/null . ./umount_kill.sh >/dev/null
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
set -x set -x
@ -46,7 +46,7 @@ fi
# Cleanup function # Cleanup function
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
function cleanup() { function cleanup() {
umount_image "$PWD/mnt" || : umount_kill "$PWD/mnt" || :
} }
trap cleanup ERR trap cleanup ERR

View File

@ -4,10 +4,10 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Configurations # Configurations
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
. ./umount.sh >/dev/null . ./umount_kill.sh >/dev/null
INSTALLDIR="$(readlink -m mnt)" INSTALLDIR="$(readlink -m mnt)"
umount_image "$INSTALLDIR" || : umount_kill "$INSTALLDIR" || :
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Set debug display # Set debug display
@ -39,7 +39,7 @@ if [ -f "$IMG" ]; then
fi fi
# Umount image; don't fail if its already umounted # Umount image; don't fail if its already umounted
umount_image "$INSTALLDIR" || : umount_kill "$INSTALLDIR" || :
fi fi
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
set -x set -x
. $SCRIPTSDIR/vars.sh . $SCRIPTSDIR/vars.sh
. ./umount.sh >/dev/null . ./umount_kill.sh >/dev/null
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# If .prepared_debootstrap has not been completed, don't continue # If .prepared_debootstrap has not been completed, don't continue
@ -34,7 +34,7 @@ if ! [ -f "$INSTALLDIR/tmp/.prepared_groups" ]; then
function error() { function error() {
echo "--> Install groups error and umount" echo "--> Install groups error and umount"
rm -f "$INSTALLDIR/usr/sbin/policy-rc.d" rm -f "$INSTALLDIR/usr/sbin/policy-rc.d"
umount_image "$INSTALLDIR" || : umount_kill "$INSTALLDIR" || :
exit 1 exit 1
} }
trap error ERR trap error ERR
@ -172,7 +172,7 @@ EOF
# Kill all processes and umount all mounts within $INSTALLDIR, # Kill all processes and umount all mounts within $INSTALLDIR,
# but not $INSTALLDIR itself (extra '/' prevents $INSTALLDIR from being # but not $INSTALLDIR itself (extra '/' prevents $INSTALLDIR from being
# umounted itself) # umounted itself)
umount_image "$INSTALLDIR/" || : umount_kill "$INSTALLDIR/" || :
fi fi
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -10,7 +10,7 @@ set -x
# Source external scripts # Source external scripts
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
. $SCRIPTSDIR/vars.sh . $SCRIPTSDIR/vars.sh
. ./umount.sh >/dev/null . ./umount_kill.sh >/dev/null
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# If .prepared_groups has not been completed, don't continue # If .prepared_groups has not been completed, don't continue
@ -131,20 +131,20 @@ EOF
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Update system; exit is not successful # Update system; exit is not successful
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
chroot "$INSTALLDIR" apt-get update || { umount_image "$INSTALLDIR"; exit 1; } chroot "$INSTALLDIR" apt-get update || { umount_kill "$INSTALLDIR"; exit 1; }
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Install Qubes packages # Install Qubes packages
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
chroot "$INSTALLDIR" apt-get -y --force-yes install `cat $SCRIPTSDIR/packages_qubes.list` || \ chroot "$INSTALLDIR" apt-get -y --force-yes install `cat $SCRIPTSDIR/packages_qubes.list` || \
{ umount_image "$INSTALLDIR"; exit 1; } { umount_kill "$INSTALLDIR"; exit 1; }
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Remove Quebes repo from sources.list.d # Remove Quebes repo from sources.list.d
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
rm -f "$INSTALLDIR"/etc/apt/sources.list.d/qubes*.list rm -f "$INSTALLDIR"/etc/apt/sources.list.d/qubes*.list
umount_image "$INSTALLDIR/tmp/qubes_repo" umount_kill "$INSTALLDIR/tmp/qubes_repo"
rm -f "$INSTALLDIR/etc/apt/sources.list.d/qubes-builder.list" rm -f "$INSTALLDIR/etc/apt/sources.list.d/qubes-builder.list"
chroot "$INSTALLDIR" apt-get update || exit 1 chroot "$INSTALLDIR" apt-get update || exit 1
@ -198,5 +198,5 @@ customStep "$0" "post"
# Kill all processes and umount all mounts within $INSTALLDIR, but not # Kill all processes and umount all mounts within $INSTALLDIR, but not
# $INSTALLDIR itself (extra '/' prevents $INSTALLDIR from being umounted itself) # $INSTALLDIR itself (extra '/' prevents $INSTALLDIR from being umounted itself)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
umount_image "$INSTALLDIR/" || : umount_kill "$INSTALLDIR/" || :

View File

@ -5,7 +5,7 @@
# Configurations # Configurations
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
. $SCRIPTSDIR/vars.sh . $SCRIPTSDIR/vars.sh
. ./umount.sh >/dev/null . ./umount_kill.sh >/dev/null
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
set -x set -x

View File

@ -5,7 +5,7 @@
# Configurations # Configurations
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
. $SCRIPTSDIR/vars.sh . $SCRIPTSDIR/vars.sh
. ./umount.sh >/dev/null . ./umount_kill.sh >/dev/null
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
set -x set -x

View File

@ -5,7 +5,7 @@
# Configurations # Configurations
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
. $SCRIPTSDIR/vars.sh . $SCRIPTSDIR/vars.sh
. ./umount.sh >/dev/null . ./umount_kill.sh >/dev/null
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
set -x set -x
@ -112,7 +112,7 @@ EOF
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
function error() { function error() {
echo "--> Whonix error; umounting $INSTALLDIR to prevent further writes" echo "--> Whonix error; umounting $INSTALLDIR to prevent further writes"
umount_image "$INSTALLDIR" || : umount_kill "$INSTALLDIR" || :
exit 1 exit 1
} }
trap error ERR trap error ERR

View File

@ -15,17 +15,17 @@
# To kill all processes and mounts within 'chroot-jessie' but keep # To kill all processes and mounts within 'chroot-jessie' but keep
# 'chroot-jessie' mounted: # 'chroot-jessie' mounted:
# #
# ./umount.sh chroot-jessie/ # ./umount_kill.sh chroot-jessie/
# #
# To kill all processes and mounts within 'chroot-jessie' AND also # To kill all processes and mounts within 'chroot-jessie' AND also
# umount 'chroot-jessie' mount: # umount 'chroot-jessie' mount:
# #
# ./umount.sh chroot-jessie # ./umount_kill.sh chroot-jessie
# #
# $1 = full path to mount; # $1 = full path to mount;
# $2 = if set will not umount; only kill processes in mount # $2 = if set will not umount; only kill processes in mount
umount_image() { umount_kill() {
MOUNTDIR="$1" MOUNTDIR="$1"
# We need absolute paths here so we don't kill everything # We need absolute paths here so we don't kill everything
@ -56,9 +56,9 @@ umount_image() {
} }
kill_processes_in_mount() { kill_processes_in_mount() {
umount_image $1 "false" || : umount_kill $1 "false" || :
} }
if [ $(basename "$0") == "umount.sh" -a "$1" ]; then if [ $(basename "$0") == "umount_kill.sh" -a "$1" ]; then
umount_image "$1" umount_kill "$1"
fi fi