+# unpack iso/squashfs {{{
+extract_iso() {
+if [ -n "$EXTRACT_ISO_NAME" ]; then
+ log "Unpacking ISO from ${EXTRACT_ISO_NAME}"
+ einfo "Unpacking ISO from ${EXTRACT_ISO_NAME}"
+ local mountpoint=$(mktemp -d)
+ local rc=0
+ mount -o loop "${EXTRACT_ISO_NAME}" "$mountpoint" ; rc=$?
+ if [ "$rc" != 0 ]; then
+ rmdir "$mountpoint"
+ log "mount failed"
+ eerror "mount failed"
+ eend 1
+ bailout 1
+ fi
+ unsquashfs -d "${CHROOT_OUTPUT}" "${mountpoint}"/live/*.squashfs ; rc=$?
+ umount "$mountpoint"
+ rmdir "$mountpoint"
+ if [ "$rc" != 0 ]; then
+ log "unsquashfs failed"
+ eerror "unsquashfs failed"
+ eend 1
+ bailout 1
+ fi
+fi
+}
+extract_iso
+# }}}
+