+function bailout(){
+ # make sure $TARGET is not mounted when exiting grml-debootstrap
+ if [ -n "$TARGET" ] ; then
+ if grep -q $TARGET /proc/mounts ; then
+ echo "Unmounting $TARGET"
+ umount "$TARGET"
+ fi
+ fi
+ [ -n "$1" ] && EXIT="$1" || EXIT="1"
+ exit "$EXIT"
+}
+
+trap bailout 1 2 3 15
+
+PARTITION=''
+DIRECTORY=''
+
+case $TARGET in
+ /dev/*)
+ PARTITION=1
+ ;;
+ *)
+ # assume we are installing into a directory, don't run mkfs and grub related stuff therefore
+ DIRECTORY=1
+ MNTPOINT="$TARGET"
+ MKFS=''
+ TUNE2FS=''
+ FSCK=''
+ GRUB=''
+ GROOT=''
+ ;;
+esac
+
+# user should recheck his configuration
+einfo "$0 - Please recheck configuration before execution:"
+echo "
+ Target: $TARGET"
+ case "$MNTPOINT" in "$TARGET") ;; *) echo " Mount-point: $MNTPOINT" ;; esac
+ [ -n "$GRUB" ] && echo " Install grub to: $GROOT / $GRUB"
+ case "$MNTPOINT" in "$TARGET") ;; *) echo " Important! Continuing will delete all data from ${TARGET}!" ;; esac
+ echo
+einfon "Is this ok for you? [y/N] "
+
+read a
+if ! [ "$a" = 'y' -o "$a" = 'Y' ] ; then
+ eerror "Exiting as requested." ; eend 1
+ exit 1
+fi
+