-# now mount the new partition or if it's a directory do nothing at all
-if [ -n "$DIRECTORY" ] ; then
- einfo "Running grml-debootstrap on a directory, nothing to mount."
-else
- if grep -q $TARGET /proc/mounts ; then
- eerror "$TARGET already mounted, exiting."
- else
- [ -n "$MNTPOINT" ] || MNTPOINT='/mnt/test'
- [ -d "$MNTPOINT" ] || mkdir -p "$MNTPOINT"
- einfo "Mounting $TARGET to $MNTPOINT"
- mount -o rw,suid,dev $TARGET $MNTPOINT
- eend $?
+# we want to execute all the functions only once, simple check for it:
+stage() {
+ if [ -n "$2" ] ; then
+ echo "$2" > "$STAGES/$1"
+ return 0
+ elif grep -q done "$STAGES/$1" 2>/dev/null ; then
+ ewarn "Notice: stage $1 has been executed already, skipping execution therefore." ; eend 0
+ return 1
+ fi
+}
+# }}}
+
+# user should recheck his configuration {{{
+# support full automatic installation:
+checkforrun() {
+ dialog --timeout 10 --title "$0" \
+ --yesno "Do you want to stop at this stage?
+
+Notice: you are running grml-debootstrap in non-interactive mode.
+grml-debootstrap will install Debian ${RELEASE} on ${TARGET}.
+Last chance to quit. Timeout of 10 seconds running....
+
+Do you want to stop now?" 0 0 2>/dev/null
+}
+
+if [ -n "$AUTOINSTALL" ] ; then
+ if checkforrun ; then
+ eerror "Exiting as requested" ; eend 0
+ exit 1
+ fi
+else # if not running automatic installation display configuration and prompt for execution:
+ 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"
+ [ -n "$MIRROR" ] && echo " Using mirror: $MIRROR"
+ 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