-# unpack chroot {{{
-if [ -n "${UNPACK_CHROOT}" ]; then
- log "Unpacking chroot from ${UNPACK_CHROOT}"
- einfo "Unpacking chroot from ${UNPACK_CHROOT}"
- [ -d "$CHROOT_OUTPUT" ] || mkdir -p "${CHROOT_OUTPUT}"
- tar -xf "${UNPACK_CHROOT}" -C "${CHROOT_OUTPUT}/" --strip-components 1 ; RC=$?
- if [ "$RC" != 0 ] ; then
+# 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"