-# get main packages from a debian-mirror
-if [ -n "$ARCH" ] ; then
- ARCHCMD="--arch $ARCH"
- ARCHINFO=" (${ARCH})"
-fi
-einfo "Running $DEBOOTSTRAP for release ${RELEASE}${ARCHINFO} using mirror $MIRROR"
-$DEBOOTSTRAP $ARCHCMD $RELEASE $MNTPOINT $MIRROR
-eend $?
+# mount the new partition or if it's a directory do nothing at all {{{
+mount_target() {
+ 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 $?
+ fi
+ fi
+}
+# }}}
+
+# install main chroot {{{
+debootstrap_system() {
+ einfo "Running $DEBOOTSTRAP for release ${RELEASE}${ARCHINFO} using mirror $MIRROR"
+ $DEBOOTSTRAP $ARCHCMD $RELEASE $MNTPOINT $MIRROR
+ eend $?
+}
+# }}}