-if [ "$FSCK" = 'yes' ] ; then
- [ -n "$FSCKTOOL" ] || FSCKTOOL="fsck.${MKFS#mkfs.}"
- einfo "Checking filesystem on $TARGET using $FSCKTOOL"
- $FSCKTOOL $TARGET
- eend $?
-fi
+# unmount $MNTPOINRT {{{
+umount_chroot() {
+ if [ -n "$PARTITION" ] ; then
+ einfo "Unmount $MNTPOINT"
+ umount $MNTPOINT
+ eend $?
+ fi
+}
+# }}}
+
+# execute filesystem check {{{
+fscktool() {
+ if [ "$FSCK" = 'yes' ] ; then
+ [ -n "$FSCKTOOL" ] || FSCKTOOL="fsck.${MKFS#mkfs.}"
+ einfo "Checking filesystem on $TARGET using $FSCKTOOL"
+ $FSCKTOOL $TARGET
+ eend $?
+ fi
+}
+# }}}
+
+# now execute all the functions {{{
+ stage mkfs && mkfs && stage mkfs done
+ stage tunefs && tunefs && stage tunefs done
+ stage mount_target && mount_target && stage mount_target done
+ stage debootstrap_system && debootstrap_system && stage debootstrap_system done
+ stage preparechroot && preparechroot && stage preparechroot done
+ stage chrootscript && chrootscript && stage chrootscript done
+ stage grub_install && grub_install && stage grub_install done
+ stage umount_chroot && umount_chroot && stage umount_chroot done
+ stage fscktool && fscktool && stage fscktool done
+# }}}
+
+# finally remove stages on main system so grml-deboostrap can be reexecuted {{{
+ rm -rf "$STAGES"
+# }}}