+ # mount the root partition if it's found
+ if [ "$mntpt" = "/" ]; then
+ mount "$img" "${mount_point_root}" -o loop,offset=$partition_start -t $fstype
+ fi
+
+ i=$((i + 1))
+ done
+
+ # mount the rest of the partitions (working around /boot coming before /)
+ sed -ne 's/^LABEL=//p' configs/${CONFIG_TYPE}/fstab-ext3 | \
+ while read name mntpt fstype extra; do
+
+ # / is already mounted
+ if [ "$mntpt" = "/" ]; then
+ continue
+ fi
+
+ # if $mntpt doesn't start with '/', don't mount it
+ if [ "${mntpt##/}" = "$mntpt" ]; then
+ continue
+ fi
+
+ # parted 1.8 added --machine for easier parsing; however,
+ # debian still has 1.7 in unstable.
+ partition_start=$(parted -s "$img" "unit B" "print" | sed -ne "s/^ $i[[:space:]]\+//p" | cut -dB -f1)
+
+ [ -d "${mount_point_root}${mntpt}" ] || mkdir -p "${mount_point_root}${mntpt}"
+ mount "$img" "${mount_point_root}${mntpt}" -o loop,offset=$partition_start -t $fstype
+ done
+