All the scripts have to inizialize this and set the cleanup trap, so
we're doing it for them in common.sh.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
+CLEANUP=( )
log_error() {
echo "$@" >&2
fi
}
+trap cleanup EXIT
+
DEFAULT_FILE="@sysconfdir@/default/ganeti-instance-debootstrap"
if [ -f "$DEFAULT_FILE" ]; then
. "$DEFAULT_FILE"
. common.sh
-CLEANUP=( )
-
-trap cleanup EXIT
-
if [ "$GENERATE_CACHE" = "yes" -a ! -d "$CACHE_DIR" ]; then
mkdir -p "$CACHE_DIR"
fi
. common.sh
-CLEANUP=( )
-
-trap cleanup EXIT
-
# If the target device is not a real block device we'll first losetup it.
# This is needed for file disks.
if [ ! -b $blockdev ]; then
. common.sh
-CLEANUP=( )
-
-trap cleanup EXIT
-
# If the target device is not a real block device we'll first losetup it.
# This is needed for file disks.
if [ ! -b $blockdev ]; then
. common.sh
-CLEANUP=( )
-
-trap cleanup EXIT
-
TMPDIR=`mktemp -d` || exit 1
CLEANUP+=("rmdir $TMPDIR")