Renamed umount_image to umount_kill as to better shuit its purpose
This commit is contained in:
parent
574668f7d9
commit
c27d84cc80
@ -11,7 +11,7 @@ RETCODE=0
|
||||
: ${DIST=fc14}
|
||||
|
||||
. ./builder_setup >/dev/null
|
||||
. ./umount.sh >/dev/null
|
||||
. ./umount_kill.sh >/dev/null
|
||||
|
||||
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
|
||||
set -x
|
||||
@ -51,7 +51,7 @@ fi
|
||||
|
||||
mkdir -p "$INSTALLDIR"
|
||||
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"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@ -66,6 +66,6 @@ echo "-> Installing package groups..."
|
||||
trap - EXIT
|
||||
|
||||
echo "-> Unmounting prepared_image..."
|
||||
umount_image "$(readlink -m $INSTALLDIR)" || :
|
||||
umount_kill "$(readlink -m $INSTALLDIR)" || :
|
||||
|
||||
exit $RETCODE
|
||||
|
@ -8,7 +8,7 @@ export NAME="$2"
|
||||
export LC_ALL=POSIX
|
||||
|
||||
. ./builder_setup >/dev/null
|
||||
. ./umount.sh >/dev/null
|
||||
. ./umount_kill.sh >/dev/null
|
||||
|
||||
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
|
||||
set -x
|
||||
@ -46,7 +46,7 @@ fi
|
||||
# Cleanup function
|
||||
# ------------------------------------------------------------------------------
|
||||
function cleanup() {
|
||||
umount_image "$PWD/mnt" || :
|
||||
umount_kill "$PWD/mnt" || :
|
||||
}
|
||||
trap cleanup ERR
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configurations
|
||||
# ------------------------------------------------------------------------------
|
||||
. ./umount.sh >/dev/null
|
||||
. ./umount_kill.sh >/dev/null
|
||||
|
||||
INSTALLDIR="$(readlink -m mnt)"
|
||||
umount_image "$INSTALLDIR" || :
|
||||
umount_kill "$INSTALLDIR" || :
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set debug display
|
||||
@ -39,7 +39,7 @@ if [ -f "$IMG" ]; then
|
||||
fi
|
||||
|
||||
# Umount image; don't fail if its already umounted
|
||||
umount_image "$INSTALLDIR" || :
|
||||
umount_kill "$INSTALLDIR" || :
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -7,7 +7,7 @@
|
||||
set -x
|
||||
|
||||
. $SCRIPTSDIR/vars.sh
|
||||
. ./umount.sh >/dev/null
|
||||
. ./umount_kill.sh >/dev/null
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# If .prepared_debootstrap has not been completed, don't continue
|
||||
@ -34,7 +34,7 @@ if ! [ -f "$INSTALLDIR/tmp/.prepared_groups" ]; then
|
||||
function error() {
|
||||
echo "--> Install groups error and umount"
|
||||
rm -f "$INSTALLDIR/usr/sbin/policy-rc.d"
|
||||
umount_image "$INSTALLDIR" || :
|
||||
umount_kill "$INSTALLDIR" || :
|
||||
exit 1
|
||||
}
|
||||
trap error ERR
|
||||
@ -172,7 +172,7 @@ EOF
|
||||
# Kill all processes and umount all mounts within $INSTALLDIR,
|
||||
# but not $INSTALLDIR itself (extra '/' prevents $INSTALLDIR from being
|
||||
# umounted itself)
|
||||
umount_image "$INSTALLDIR/" || :
|
||||
umount_kill "$INSTALLDIR/" || :
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -10,7 +10,7 @@ set -x
|
||||
# Source external scripts
|
||||
# ------------------------------------------------------------------------------
|
||||
. $SCRIPTSDIR/vars.sh
|
||||
. ./umount.sh >/dev/null
|
||||
. ./umount_kill.sh >/dev/null
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# If .prepared_groups has not been completed, don't continue
|
||||
@ -131,20 +131,20 @@ EOF
|
||||
# --------------------------------------------------------------------------
|
||||
# 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
|
||||
# --------------------------------------------------------------------------
|
||||
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
||||
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
|
||||
# --------------------------------------------------------------------------
|
||||
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"
|
||||
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
|
||||
# $INSTALLDIR itself (extra '/' prevents $INSTALLDIR from being umounted itself)
|
||||
# ------------------------------------------------------------------------------
|
||||
umount_image "$INSTALLDIR/" || :
|
||||
umount_kill "$INSTALLDIR/" || :
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Configurations
|
||||
# ------------------------------------------------------------------------------
|
||||
. $SCRIPTSDIR/vars.sh
|
||||
. ./umount.sh >/dev/null
|
||||
. ./umount_kill.sh >/dev/null
|
||||
|
||||
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
|
||||
set -x
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Configurations
|
||||
# ------------------------------------------------------------------------------
|
||||
. $SCRIPTSDIR/vars.sh
|
||||
. ./umount.sh >/dev/null
|
||||
. ./umount_kill.sh >/dev/null
|
||||
|
||||
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
|
||||
set -x
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Configurations
|
||||
# ------------------------------------------------------------------------------
|
||||
. $SCRIPTSDIR/vars.sh
|
||||
. ./umount.sh >/dev/null
|
||||
. ./umount_kill.sh >/dev/null
|
||||
|
||||
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
|
||||
set -x
|
||||
@ -112,7 +112,7 @@ EOF
|
||||
# ------------------------------------------------------------------------------
|
||||
function error() {
|
||||
echo "--> Whonix error; umounting $INSTALLDIR to prevent further writes"
|
||||
umount_image "$INSTALLDIR" || :
|
||||
umount_kill "$INSTALLDIR" || :
|
||||
exit 1
|
||||
}
|
||||
trap error ERR
|
||||
|
@ -15,17 +15,17 @@
|
||||
# To kill all processes and mounts within 'chroot-jessie' but keep
|
||||
# 'chroot-jessie' mounted:
|
||||
#
|
||||
# ./umount.sh chroot-jessie/
|
||||
# ./umount_kill.sh chroot-jessie/
|
||||
#
|
||||
# To kill all processes and mounts within 'chroot-jessie' AND also
|
||||
# umount 'chroot-jessie' mount:
|
||||
#
|
||||
# ./umount.sh chroot-jessie
|
||||
# ./umount_kill.sh chroot-jessie
|
||||
#
|
||||
|
||||
# $1 = full path to mount;
|
||||
# $2 = if set will not umount; only kill processes in mount
|
||||
umount_image() {
|
||||
umount_kill() {
|
||||
MOUNTDIR="$1"
|
||||
|
||||
# We need absolute paths here so we don't kill everything
|
||||
@ -56,9 +56,9 @@ umount_image() {
|
||||
}
|
||||
|
||||
kill_processes_in_mount() {
|
||||
umount_image $1 "false" || :
|
||||
umount_kill $1 "false" || :
|
||||
}
|
||||
|
||||
if [ $(basename "$0") == "umount.sh" -a "$1" ]; then
|
||||
umount_image "$1"
|
||||
if [ $(basename "$0") == "umount_kill.sh" -a "$1" ]; then
|
||||
umount_kill "$1"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user