Debian Bug report logs - #643585
integrate ubuntu cloud-provider support

version graph

Package: live-build; Maintainer for live-build is Live Systems Maintainers <debian-live@lists.debian.org>; Source for live-build is src:live-build.

Reported by: Ben Howard <ben.howard@canonical.com>

Date: Tue, 27 Sep 2011 20:30:01 UTC

Severity: normal

Tags: patch

Fixed in version live-build/3.0~a36-1

Done: daniel.baumann@progress-technologies.net

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, ben.howard@canonical.com, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Tue, 27 Sep 2011 20:30:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Howard <ben.howard@canonical.com>:
New Bug report received and forwarded. Copy sent to ben.howard@canonical.com, Debian Live Project <debian-live@lists.debian.org>.

Your message had a Version: pseudo-header with an invalid package version:

3.0_a31-1

please either use found or fixed to the control server with a correct version, or reply to this report indicating the correct version so the maintainer (or someone else) can correct it for you.

(Tue, 27 Sep 2011 20:30:04 GMT) Full text and rfc822 format available.


Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Ben Howard <ben.howard@canonical.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: live-build: [patch] Add support for building file system images suitable for cloud-provider use and cross-building ARM on Intel
Date: Tue, 27 Sep 2011 14:26:29 -0600
Package: live-build
Version: 3.0_a31-1
Severity: wishlist
Tags: patch

>From 0f897bef7673ff16a2c27e070de361c7c89f4720 Mon Sep 17 00:00:00 2001
From: Ben Howard <ben.howard@canonical.com>
Date: Tue, 27 Sep 2011 14:09:53 -0600
Subject: [PATCH]
    - Added the ability to use "qemu-*static" to cross build
         images on   non-native hardware.
    - Added the ability to generate preconfigured images which are
      live file-systems suitable for use in cloud provider (i.e. AWS,
      Openstack) systems
        - Added scripts/build/lb_image* for creating images.
        - Images are a single, unparitioned file
          system within a file.
        - Images are generated from the chroot and can be build along-side
          binary and source images.
    - Added packages/ubunut-cloud-* package list definitions for generating
      Ubuntu Cloud Images.
    - Added several options to scripts/build/lb_config for generating
      Ubuntu Cloud Images configuration easily.
    - Added the ability to skip installation of live-config-* for use with
      generating images.

---
 functions/architectures.sh               |   33 +++-
 functions/arguments.sh                   |    7 +-
 functions/defaults.sh                    |   55 +++++-
 scripts/build/lb                         |    2 +-
 scripts/build/lb_binary                  |    2 +-
 scripts/build/lb_binary_checksums        |    2 +-
 scripts/build/lb_binary_chroot           |    2 +-
 scripts/build/lb_binary_debian-installer |    2 +-
 scripts/build/lb_binary_disk             |    2 +-
 scripts/build/lb_binary_grub             |    2 +-
 scripts/build/lb_binary_grub2            |    2 +-
 scripts/build/lb_binary_hooks            |    2 +-
 scripts/build/lb_binary_includes         |    2 +-
 scripts/build/lb_binary_iso              |    2 +-
 scripts/build/lb_binary_linux-image      |    2 +-
 scripts/build/lb_binary_local-includes   |    2 +-
 scripts/build/lb_binary_manifest         |    2 +-
 scripts/build/lb_binary_memtest          |    2 +-
 scripts/build/lb_binary_net              |    2 +-
 scripts/build/lb_binary_packagelists     |    2 +-
 scripts/build/lb_binary_rootfs           |    2 +-
 scripts/build/lb_binary_silo             |    2 +-
 scripts/build/lb_binary_syslinux         |    2 +-
 scripts/build/lb_binary_tar              |    2 +-
 scripts/build/lb_binary_usb              |    2 +-
 scripts/build/lb_binary_virtual-hdd      |    2 +-
 scripts/build/lb_binary_win32-loader     |    2 +-
 scripts/build/lb_binary_yaboot           |    2 +-
 scripts/build/lb_bootstrap               |    2 +-
 scripts/build/lb_bootstrap_cache         |    2 +-
 scripts/build/lb_bootstrap_cdebootstrap  |    2 +-
 scripts/build/lb_bootstrap_copy          |    2 +-
 scripts/build/lb_bootstrap_debootstrap   |   39 +++--
 scripts/build/lb_build                   |   18 ++-
 scripts/build/lb_chroot                  |    5 +-
 scripts/build/lb_chroot_apt              |    3 +-
 scripts/build/lb_chroot_archives         |  317 +++++++++++++++---------------
 scripts/build/lb_chroot_cache            |   35 ++--
 scripts/build/lb_chroot_debianchroot     |    2 +-
 scripts/build/lb_chroot_devpts           |   19 +-
 scripts/build/lb_chroot_dpkg             |    2 +-
 scripts/build/lb_chroot_hacks            |    2 +-
 scripts/build/lb_chroot_hooks            |    2 +-
 scripts/build/lb_chroot_hostname         |    2 +-
 scripts/build/lb_chroot_hosts            |    4 +-
 scripts/build/lb_chroot_includes         |    2 +-
 scripts/build/lb_chroot_install-packages |    2 +-
 scripts/build/lb_chroot_interactive      |    2 +-
 scripts/build/lb_chroot_linux-image      |    2 +-
 scripts/build/lb_chroot_live-packages    |    2 +-
 scripts/build/lb_chroot_local-patches    |    2 +-
 scripts/build/lb_chroot_local-preseed    |    2 +-
 scripts/build/lb_chroot_package-lists    |    2 +-
 scripts/build/lb_chroot_preseed          |    2 +-
 scripts/build/lb_chroot_proc             |   31 ++--
 scripts/build/lb_chroot_resolv           |   29 ++--
 scripts/build/lb_chroot_selinuxfs        |   29 ++--
 scripts/build/lb_chroot_sysfs            |   27 ++--
 scripts/build/lb_chroot_sysv-rc          |   23 ++-
 scripts/build/lb_chroot_task-lists       |   49 +++---
 scripts/build/lb_chroot_tmpfs            |    2 +-
 scripts/build/lb_chroot_upstart          |    2 +-
 scripts/build/lb_clean                   |    2 +-
 scripts/build/lb_config                  |  154 ++++++++++++++-
 scripts/build/lb_source                  |    2 +-
 scripts/build/lb_source_checksums        |    2 +-
 scripts/build/lb_source_debian           |    2 +-
 scripts/build/lb_source_debian-live      |    2 +-
 scripts/build/lb_source_disk             |    2 +-
 scripts/build/lb_source_iso              |    2 +-
 scripts/build/lb_source_net              |    2 +-
 scripts/build/lb_source_tar              |    2 +-
 scripts/build/lb_source_usb              |    2 +-
 scripts/build/lb_source_virtual-hdd      |    2 +-
 scripts/build/lb_testroot                |    2 +-
 75 files changed, 627 insertions(+), 364 deletions(-)

diff --git a/functions/architectures.sh b/functions/architectures.sh
index 53d925b..79a9da5 100755
--- a/functions/architectures.sh
+++ b/functions/architectures.sh
@@ -20,6 +20,19 @@ Check_architectures ()
                        VALID="true"
                        break
                fi
+
+        # Allow port (QEMU) execution if PORTS arch is equal to arch and
+        # LB_PORTS_QEMU_STATIC is executable
+        if [ "${ARCHITECTURE}" = "${LB_PORTS_ARCHITECTURES}" ]
+        then
+
+            if [ -x "${LB_PORTS_QEMU_STATIC}" ]
+            then
+               VALID="true"
+               break
+            fi
+        fi
+
        done

        if [ "${VALID}" = "false" ]
@@ -52,7 +65,25 @@ Check_crossarchitectures ()
                        ;;
        esac

-       Check_architectures "${CROSS}"
+    # For foreign bootstraps done via static qemu, we don't need do the check,
just make
+    #     sure that the static qemu binary and executable exist
+    if [ "${LB_ARCHITECTURES}" = "${LB_PORTS_ARCHITECTURES}" ];
+    then
+        # Look for binary for static qemu binary
+        if [ ! -e "${LB_PORTS_QEMU_STATIC}" ]
+        then
+            Echo_warning "skipping %s, foreign architecture(s); qemu-static
binary was not found " "${0}"
+        fi
+
+        # Make sure it is executable
+        if [ ! -x "${LB_PORTS_QEMU_STATIC}" ]
+        then
+            Echo_warning "skipping %s, foreign architecture(s); qemu-static
binary is not executable." "${0}"
+        fi
+    else
+       Check_architectures "${CROSS}"
+    fi
+
 }

 Check_multiarchitectures ()
diff --git a/functions/arguments.sh b/functions/arguments.sh
index 9a675e6..944e91d 100755
--- a/functions/arguments.sh
+++ b/functions/arguments.sh
@@ -10,7 +10,7 @@

 Arguments ()
 {
-       ARGUMENTS="$(getopt --longoptions
breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version
--name=${PROGRAM} --options c:huv --shell sh -- "${@}")"
+       ARGUMENTS="$(getopt --longoptions
breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version,image
--name=${PROGRAM} --options c:huv --shell sh -- "${@}")"

        if [ "${?}" != "0" ]
        then
@@ -68,6 +68,11 @@ Arguments ()
                                shift
                                ;;

+            --image)
+                _TARGET="image"
+                shift
+                ;;
+
                        --)
                                shift
                                break
diff --git a/functions/defaults.sh b/functions/defaults.sh
index 643123c..08bb47f 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -639,11 +639,17 @@ Set_defaults ()
        # Setting linux flavour string
        case "${LB_ARCHITECTURES}" in
                armel)
-                       # armel will have special images: one rootfs image and
many additional kernel images.
-                       # therefore we default to all available armel flavours
-                       LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-iop32x ixp4xx
kirkwood orion5x versatile}"
-                       ;;
-
+            case "${LB_MODE}" in
+                ubuntu|kubuntu)
+                    LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-omap}"
+                    ;;
+                *)
+                               # armel will have special images: one rootfs
image and many additional kernel images.
+                               # therefore we default to all available armel
flavours
+                               LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-iop32x
ixp4xx kirkwood orion5x versatile}"
+                               ;;
+            esac
+            ;;
                amd64)
                        case "${LB_MODE}" in
                                ubuntu|kubuntu)
@@ -1223,4 +1229,43 @@ Check_defaults ()
                fi
        fi

+    # Build file system image
+    LB_BUILD_IMAGE="${LB_BUILD_IMAGE:-false"}"
+
+    # Build binary images with live-config
+    LB_BUILD_BINARY="${LB_BUILD_BINARY:-true}"
+
+    # Build source image
+    LB_BUILD_SOURCE="${LB_BUILD_SOURCE:-true}"
+
+    # Set image file system type, defualt is EXT4
+    LB_IMAGE_FILESYTEM="${LB_IMAGE_FILESYSTEM:-ext4}"
+
+    # Set image file system default size in MB default is 2048M (2G)
+    LB_IMAGE_ROOT_SIZE="${LB_IMAGE_ROOT_SIZE:-2048}"
+
+    # Set image file system label, default is "live-image"
+    LB_IMAGE_FILESYSTEM_LABEL="${LB_IMAGE_FILESYSTEM_LABEL:-live-image}"
+
+    # Packages to install to the image file system
+    LB_IMAGE_PACKAGES="${LB_IMAGE_PACKAGES:-}"
+
+    # Tasks to install to the image file system
+    LB_IMAGE_TASKSEL="${LB_IMAGE_TASKSEL:-}"
+
+    # Bootstrap to use for ports
+    LB_PORTS_BOOTSTRAP="${LB_PORTS_BOOTSTRAP:-}"
+
+    # Architectures to use foriegn bootstrap for
+    LB_PORTS_ARCHITECTURES="${LB_PORTS_ARCHITECTURES:-}"
+
+    # Packages to exclude for the foriegn/ports bootstrapping
+    LB_PORTS_BOOTSTRAP_EXCLUDE="${LB_PORTS_BOOTSTRAP_EXCLUDE:-}"
+
+    # Ports using foriegn bootstrap need a working qemu-*-system. This is the
location it
+    LB_PORTS_QEMU_STATIC="${LB_PORTS_QEMU_STATIC:-}"
+
+    # Set installation passes for chroot
+    LB_CHROOT_PASSES="${LB_CHROOT_PASSES:-install live}"
+
 }
diff --git a/scripts/build/lb b/scripts/build/lb
index 58c1d12..9726571 100755
--- a/scripts/build/lb
+++ b/scripts/build/lb
@@ -52,7 +52,7 @@ case "${1}" in
                then
                        LB=1 exec "${COMMAND}" "${@}"
                else
-                       Echo_error "no such script"
+                       Echo_error "no such script ${COMMAND}"
                        exit 1
                fi
                ;;
diff --git a/scripts/build/lb_binary b/scripts/build/lb_binary
index 0598a84..ad35911 100755
--- a/scripts/build/lb_binary
+++ b/scripts/build/lb_binary
@@ -28,7 +28,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Setup cleanup function
diff --git a/scripts/build/lb_binary_checksums
b/scripts/build/lb_binary_checksums
index d900a2c..73b4cac 100755
--- a/scripts/build/lb_binary_checksums
+++ b/scripts/build/lb_binary_checksums
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_CHECKSUMS}" = "none" ] || [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ]
diff --git a/scripts/build/lb_binary_chroot b/scripts/build/lb_binary_chroot
index f5ac80f..506f325 100755
--- a/scripts/build/lb_binary_chroot
+++ b/scripts/build/lb_binary_chroot
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin copying chroot..."
diff --git a/scripts/build/lb_binary_debian-installer b/scripts/build
/lb_binary_debian-installer
index 12e072a..51f7f9a 100755
--- a/scripts/build/lb_binary_debian-installer
+++ b/scripts/build/lb_binary_debian-installer
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ]
diff --git a/scripts/build/lb_binary_disk b/scripts/build/lb_binary_disk
index 1dc8d82..088778f 100755
--- a/scripts/build/lb_binary_disk
+++ b/scripts/build/lb_binary_disk
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 case "${LB_BINARY_IMAGES}" in
diff --git a/scripts/build/lb_binary_grub b/scripts/build/lb_binary_grub
index 39aca30..540f8d3 100755
--- a/scripts/build/lb_binary_grub
+++ b/scripts/build/lb_binary_grub
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BOOTLOADER}" != "grub" ]
diff --git a/scripts/build/lb_binary_grub2 b/scripts/build/lb_binary_grub2
index b029891..5929541 100755
--- a/scripts/build/lb_binary_grub2
+++ b/scripts/build/lb_binary_grub2
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BOOTLOADER}" != "grub2" ]
diff --git a/scripts/build/lb_binary_hooks b/scripts/build/lb_binary_hooks
index 32cf5a0..07202cb 100755
--- a/scripts/build/lb_binary_hooks
+++ b/scripts/build/lb_binary_hooks
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin executing hooks..."
diff --git a/scripts/build/lb_binary_includes
b/scripts/build/lb_binary_includes
index ecf8e59..4d31e29 100755
--- a/scripts/build/lb_binary_includes
+++ b/scripts/build/lb_binary_includes
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_INCLUDES}" = "none" ]
diff --git a/scripts/build/lb_binary_iso b/scripts/build/lb_binary_iso
index a6b7d77..4d23161 100755
--- a/scripts/build/lb_binary_iso
+++ b/scripts/build/lb_binary_iso
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 case "${LB_BINARY_IMAGES}" in
diff --git a/scripts/build/lb_binary_linux-image b/scripts/build
/lb_binary_linux-image
index 43e09a9..0a8fade 100755
--- a/scripts/build/lb_binary_linux-image
+++ b/scripts/build/lb_binary_linux-image
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] || [ "${LB_LINUX_PACKAGES}" =
"none" ]
diff --git a/scripts/build/lb_binary_local-includes b/scripts/build
/lb_binary_local-includes
index 6ec33ac..701a9b7 100755
--- a/scripts/build/lb_binary_local-includes
+++ b/scripts/build/lb_binary_local-includes
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin copying binary local includes..."
diff --git a/scripts/build/lb_binary_manifest
b/scripts/build/lb_binary_manifest
index e1177ea..fd8bcd7 100755
--- a/scripts/build/lb_binary_manifest
+++ b/scripts/build/lb_binary_manifest
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ]
diff --git a/scripts/build/lb_binary_memtest b/scripts/build/lb_binary_memtest
index 8155b14..37b23a5 100755
--- a/scripts/build/lb_binary_memtest
+++ b/scripts/build/lb_binary_memtest
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] || [ "${LB_MEMTEST}" = "false" ]
|| [ "${LB_MEMTEST}" = "none" ]
diff --git a/scripts/build/lb_binary_net b/scripts/build/lb_binary_net
index 133a203..1b2286f 100755
--- a/scripts/build/lb_binary_net
+++ b/scripts/build/lb_binary_net
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if ! In_list net "${LB_BINARY_IMAGES}"
diff --git a/scripts/build/lb_binary_packagelists
b/scripts/build/lb_binary_packagelists
index 5f2c64b..1db96f5 100755
--- a/scripts/build/lb_binary_packagelists
+++ b/scripts/build/lb_binary_packagelists
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin installing local package lists..."
diff --git a/scripts/build/lb_binary_rootfs b/scripts/build/lb_binary_rootfs
index 692a28d..bda3c79 100755
--- a/scripts/build/lb_binary_rootfs
+++ b/scripts/build/lb_binary_rootfs
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin building root filesystem image..."
diff --git a/scripts/build/lb_binary_silo b/scripts/build/lb_binary_silo
index 5834a0b..23a5b31 100755
--- a/scripts/build/lb_binary_silo
+++ b/scripts/build/lb_binary_silo
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BOOTLOADER}" != "silo" ]
diff --git a/scripts/build/lb_binary_syslinux
b/scripts/build/lb_binary_syslinux
index e6f1378..03b5237 100755
--- a/scripts/build/lb_binary_syslinux
+++ b/scripts/build/lb_binary_syslinux
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BOOTLOADER}" != "syslinux" ]
diff --git a/scripts/build/lb_binary_tar b/scripts/build/lb_binary_tar
index bcbfe58..fe80391 100755
--- a/scripts/build/lb_binary_tar
+++ b/scripts/build/lb_binary_tar
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if ! In_list tar "${LB_BINARY_IMAGES}"
diff --git a/scripts/build/lb_binary_usb b/scripts/build/lb_binary_usb
index 228827d..1538f0b 100755
--- a/scripts/build/lb_binary_usb
+++ b/scripts/build/lb_binary_usb
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if ! In_list usb-hdd "${LB_BINARY_IMAGES}"
diff --git a/scripts/build/lb_binary_virtual-hdd b/scripts/build
/lb_binary_virtual-hdd
index 5cbea89..7864c66 100755
--- a/scripts/build/lb_binary_virtual-hdd
+++ b/scripts/build/lb_binary_virtual-hdd
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if ! In_list virtual-hdd "${LB_BINARY_IMAGES}"
diff --git a/scripts/build/lb_binary_win32-loader
b/scripts/build/lb_binary_win32-loader
index 41f7865..aca9969 100755
--- a/scripts/build/lb_binary_win32-loader
+++ b/scripts/build/lb_binary_win32-loader
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_WIN32_LOADER}" != "true" ] || [ "${LB_BINARY_IMAGES}" = "virtual-
hdd" ]
diff --git a/scripts/build/lb_binary_yaboot b/scripts/build/lb_binary_yaboot
index 4613b8a..f9c5fd2 100755
--- a/scripts/build/lb_binary_yaboot
+++ b/scripts/build/lb_binary_yaboot
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BOOTLOADER}" != "yaboot" ]
diff --git a/scripts/build/lb_bootstrap b/scripts/build/lb_bootstrap
index f9a195f..528bcb4 100755
--- a/scripts/build/lb_bootstrap
+++ b/scripts/build/lb_bootstrap
@@ -28,7 +28,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Setup cleanup function
diff --git a/scripts/build/lb_bootstrap_cache
b/scripts/build/lb_bootstrap_cache
index 86cb18f..6491ee1 100755
--- a/scripts/build/lb_bootstrap_cache
+++ b/scripts/build/lb_bootstrap_cache
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Check architecture
diff --git a/scripts/build/lb_bootstrap_cdebootstrap
b/scripts/build/lb_bootstrap_cdebootstrap
index 42031ac..1f8cc14 100755
--- a/scripts/build/lb_bootstrap_cdebootstrap
+++ b/scripts/build/lb_bootstrap_cdebootstrap
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BOOTSTRAP}" != "cdebootstrap" ] && [ "${LB_BOOTSTRAP}" !=
"cdebootstrap-static" ]
diff --git a/scripts/build/lb_bootstrap_copy b/scripts/build/lb_bootstrap_copy
index d213c77..92fe6d7 100755
--- a/scripts/build/lb_bootstrap_copy
+++ b/scripts/build/lb_bootstrap_copy
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BOOTSTRAP}" != "copy" ]
diff --git a/scripts/build/lb_bootstrap_debootstrap
b/scripts/build/lb_bootstrap_debootstrap
index 1b5f5fe..e6d7a97 100755
--- a/scripts/build/lb_bootstrap_debootstrap
+++ b/scripts/build/lb_bootstrap_debootstrap
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BOOTSTRAP}" != "debootstrap" ]
@@ -120,24 +120,37 @@ then
                        cp cache/packages_bootstrap/*.deb
chroot/var/cache/apt/archives
                fi

-               Echo_breakage "Running debootstrap (download-only)... "
-               ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS}
--download-only "${LB_PARENT_DISTRIBUTION}" chroot
"${LB_PARENT_MIRROR_BOOTSTRAP}"
+        if [ "${LB_PORTS_ARCHITECTURES}" != "${LB_ARCHITECTURES}" ]; then
+               Echo_breakage "Running debootstrap (download-only)... "
+           ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-
only "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"

-               if [ -n "${LB_ROOT_COMMAND}" ]
-               then
-                       ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot
-               fi
+               if [ -n "${LB_ROOT_COMMAND}" ]
+               then
+                       ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot
+               fi

-               # Removing old cache
-               rm -f cache/packages_bootstrap/*.deb
+               # Removing old cache
+               rm -f cache/packages_bootstrap/*.deb

-               # Saving new cache
-               mkdir -p cache/packages_bootstrap
-               cp chroot/var/cache/apt/archives/*.deb cache/packages_bootstrap
+                   # Saving new cache
+               mkdir -p cache/packages_bootstrap
+               cp chroot/var/cache/apt/archives/*.deb cache/packages_bootstrap
+        fi
        fi

        Echo_breakage "Running debootstrap... "
-       ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS}
"${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"
+
+    # Run appropriate bootstrap, i.e. foriegn or regular bootstrap
+    if [ "${LB_PORTS_ARCHITECTURES}" = "${LB_ARCHITECTURES}" ]; then
+        Echo_message "Bootstrap will be foreign"
+        ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign
"${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"
+
+        Echo_message "Running debootstrap second stage under QEMU"
+        cp ${LB_PORTS_QEMU_STATIC} chroot/usr/bin
+        Chroot chroot /debootstrap/debootstrap --second-stage
+    else
+        ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS}
"${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"
+    fi

        if [ -n "${LB_ROOT_COMMAND}" ]
        then
diff --git a/scripts/build/lb_build b/scripts/build/lb_build
index 16f1da2..eab16d1 100755
--- a/scripts/build/lb_build
+++ b/scripts/build/lb_build
@@ -58,7 +58,7 @@ then
 fi

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/binary config/common config/bootstrap
config/chroot config/image config/source config/ports
 Set_defaults

 # Checking defaults
@@ -70,8 +70,20 @@ lb bootstrap ${*}
 # Customizing chroot
 lb chroot ${*}

+# Build image
+if [ "${LB_BUILD_IMAGE}" = "true" ]; then
+    Echo_message "Building file system image"
+    lb image ${*}
+fi
+
 # Building binary images
-lb binary ${*}
+if [ "${LB_BUILD_BINARY}" = "true" ]; then
+    Echo_message "Building binary live-config image"
+    lb binary ${*}
+fi

 # Building source images
-lb source ${*}
+if [ "${LB_BUILD_SOURCE}" = "true" ]; then
+    Echo_message "Building source image"
+    lb source ${*}
+fi
diff --git a/scripts/build/lb_chroot b/scripts/build/lb_chroot
index 5711244..bf6c9b6 100755
--- a/scripts/build/lb_chroot
+++ b/scripts/build/lb_chroot
@@ -28,7 +28,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Setup cleanup function
@@ -56,8 +56,9 @@ lb chroot_linux-image ${*}
 lb chroot_preseed ${*}
 lb chroot_local-preseed ${*}

-for _PASS in install live
+for _PASS in ${LB_CHROOT_PASSES}
 do
+
        lb chroot_package-lists ${_PASS} ${*}
        lb chroot_install-packages ${_PASS} ${*}
        lb chroot_task-lists ${_PASS} ${*}
diff --git a/scripts/build/lb_chroot_apt b/scripts/build/lb_chroot_apt
index 6414701..a847be6 100755
--- a/scripts/build/lb_chroot_apt
+++ b/scripts/build/lb_chroot_apt
@@ -19,9 +19,10 @@ HELP=""
 USAGE="${PROGRAM} {install|install-binary|remove} [--force]"

 Arguments "${@}"
+_TARGET="${_TARGET:-chroot}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Requiring stage file
diff --git a/scripts/build/lb_chroot_archives
b/scripts/build/lb_chroot_archives
index 327ee69..fb77cf2 100755
--- a/scripts/build/lb_chroot_archives
+++ b/scripts/build/lb_chroot_archives
@@ -22,9 +22,10 @@ _PASS="${1}"
 shift

 Arguments "${@}"
+_TARGET="${_TARGET:-chroot}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/ports config/binary config/source
 Set_defaults

 # Requiring stage file
@@ -37,7 +38,7 @@ case "${1}" in
                Echo_message "Configuring file /etc/apt/sources.list"

                # Checking stage file
-               Check_stagefile .stage/chroot_archives
+               Check_stagefile .stage/${_TARGET}_archives

                # Checking lock file
                Check_lockfile .lock
@@ -46,11 +47,11 @@ case "${1}" in
                Create_lockfile .lock

                # Restoring cache
-               Restore_cache cache/packages_chroot
+               Restore_cache cache/packages_${_TARGET}

                # Configure custom sources.list

-cat > chroot/etc/apt/sources.list << EOF
+cat > ${_TARGET}/etc/apt/sources.list << EOF
 # /etc/apt/sources.list

 deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}
${LB_PARENT_ARCHIVE_AREAS}
@@ -58,13 +59,13 @@ EOF

                if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" =
"true" ]
                then
-                       echo "deb-src ${LB_PARENT_MIRROR_CHROOT}
${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list
+                       echo "deb-src ${LB_PARENT_MIRROR_CHROOT}
${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list
                fi

                if [ "${LB_DERIVATIVE}" = "true" ]
                then

-cat > chroot/etc/apt/sources.list.d/${LB_MODE}.list << EOF
+cat > ${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list << EOF
 # /etc/apt/sources.list.d/${LB_MODE}.list

 EOF
@@ -82,11 +83,11 @@ EOF
                        for _DISTRIBUTION in ${_DISTRIBUTIONS}
                        do

-                               echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION}
${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                               echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION}
${LB_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list

                                if [ "${_PASS}" = "source" ] || [
"${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                then
-                                       echo "deb-src ${LB_MIRROR_CHROOT}
${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                       echo "deb-src ${LB_MIRROR_CHROOT}
${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list
                                fi
                        done
                fi
@@ -101,11 +102,11 @@ EOF
                                                        ;;

                                                *)
-                                                       echo "deb
${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                                       echo "deb
${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list

                                                        if [ "${_PASS}" =
"source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                                        then
-                                                               echo "deb-src
${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                                               echo "deb-src
${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list
                                                        fi
                                                        ;;
                                        esac
@@ -118,33 +119,33 @@ EOF
                                                                ;;

                                                        *)
-                                                               echo "deb
${LB_MIRROR_CHROOT_SECURITY} ${LB_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}"
>> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                                               echo "deb
${LB_MIRROR_CHROOT_SECURITY} ${LB_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}"
>> ${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list

                                                                if [ "${_PASS}"
= "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                                                then
-                                                                       echo
"deb-src ${LB_MIRROR_CHROOT_SECURITY} ${LB_DISTRIBUTION}-security
${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                                                       echo
"deb-src ${LB_MIRROR_CHROOT_SECURITY} ${LB_DISTRIBUTION}-security
${LB_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list
                                                                fi
                                                                ;;
                                                esac
                                        else
                                                if [ "${LB_DERIVATIVE}" =
"true" ]
                                                then
-                                                       echo "deb
${LB_MIRROR_CHROOT_SECURITY} ${LB_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                                       echo "deb
${LB_MIRROR_CHROOT_SECURITY} ${LB_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list

                                                        if [ "${_PASS}" =
"source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                                        then
-                                                               echo "deb-src
${LB_MIRROR_CHROOT_SECURITY} ${LB_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                                               echo "deb-src
${LB_MIRROR_CHROOT_SECURITY} ${LB_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list
                                                        fi
                                                fi
                                        fi
                                        ;;

                                ubuntu|kubuntu)
-                                       echo "deb
${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                       echo "deb
${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list

                                        if [ "${_PASS}" = "source" ] || [
"${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                        then
-                                               echo "deb-src
${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                               echo "deb-src
${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list
                                        fi
                                        ;;
                        esac
@@ -154,22 +155,22 @@ EOF
                then
                        case "${LB_MODE}" in
                                debian|ubuntu|kubuntu)
-                                       echo "deb
${LB_PARENT_MIRROR_CHROOT_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                       echo "deb
${LB_PARENT_MIRROR_CHROOT_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list

                                        if [ "${_PASS}" = "source" ] || [
"${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                        then
-                                               echo "deb-src
${LB_PARENT_MIRROR_CHROOT_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                               echo "deb-src
${LB_PARENT_MIRROR_CHROOT_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list
                                        fi
                                        ;;
                        esac

                        if [ "${LB_DERIVATIVE}" = "true" ] && [
"${LB_MIRROR_CHROOT_VOLATILE}" != "none" ]
                        then
-                               echo "deb ${LB_MIRROR_CHROOT_VOLATILE}
${LB_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                               echo "deb ${LB_MIRROR_CHROOT_VOLATILE}
${LB_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list

                                if [ "${_PASS}" = "source" ] || [
"${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                then
-                                       echo "deb-src
${LB_MIRROR_CHROOT_VOLATILE} ${LB_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                       echo "deb-src
${LB_MIRROR_CHROOT_VOLATILE} ${LB_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list
                                fi
                        fi
                fi
@@ -180,11 +181,11 @@ EOF
                                debian)
                                        if [ "${LB_PARENT_DISTRIBUTION}" !=
"sid" ]
                                        then
-                                               echo "deb
${LB_PARENT_MIRROR_CHROOT_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                               echo "deb
${LB_PARENT_MIRROR_CHROOT_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list

                                                if [ "${_PASS}" = "source" ] ||
[ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                                then
-                                                       echo "deb-src
${LB_PARENT_MIRROR_CHROOT_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                                       echo "deb-src
${LB_PARENT_MIRROR_CHROOT_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list
                                                fi
                                        fi
                                        ;;
@@ -192,11 +193,11 @@ EOF

                        if [ "${LB_DERIVATIVE}" = "true" ] && [
"${LB_MIRROR_CHROOT_BACKPORTS}" != "none" ]
                        then
-                               echo "deb ${LB_MIRROR_CHROOT_BACKPORTS}
${LB_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                               echo "deb ${LB_MIRROR_CHROOT_BACKPORTS}
${LB_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list

                                if [ "${_PASS}" = "source" ] || [
"${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                then
-                                       echo "deb-src
${LB_MIRROR_CHROOT_BACKPORTS} ${LB_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}"
>> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                       echo "deb-src
${LB_MIRROR_CHROOT_BACKPORTS} ${LB_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}"
>> ${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list
                                fi
                        fi
                fi
@@ -229,30 +230,30 @@ EOF
                                        continue
                                fi

-                               # Adding sources.list entries (chroot)
-                               if [ -e
"${LB_BASE}/archives/${REPOSITORY}.chroot" ]
+                               # Adding sources.list entries (${_TARGET})
+                               if [ -e
"${LB_BASE}/archives/${REPOSITORY}.${_TARGET}" ]
                                then
                                        sed -e
"s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \
                                            -e
"s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
-
"${LB_BASE}/archives/${REPOSITORY}.chroot" > \
-
"chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+
"${LB_BASE}/archives/${REPOSITORY}.${_TARGET}" > \
+
"${_TARGET}/etc/apt/sources.list.d/${REPOSITORY}.list"
                                elif [ -e "${LB_BASE}/archives/${REPOSITORY}" ]
                                then
                                        sed -e
"s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \
                                            -e
"s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
                                        "${LB_BASE}/archives/${REPOSITORY}" > \
-
"chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+
"${_TARGET}/etc/apt/sources.list.d/${REPOSITORY}.list"
                                fi

                                if [ "${LB_APT_SECURE}" != false ]
                                then
-                                       # Adding archive signing keys (chroot)
-                                       if [ -e
"${LB_BASE}/archives/${REPOSITORY}.key.chroot" ]
+                                       # Adding archive signing keys
(${_TARGET})
+                                       if [ -e
"${LB_BASE}/archives/${REPOSITORY}.key.${_TARGET}" ]
                                        then
-                                               cat
"${LB_BASE}/archives/${REPOSITORY}.key.chroot" | Chroot chroot "apt-key add -"
+                                               cat
"${LB_BASE}/archives/${REPOSITORY}.key.${_TARGET}" | Chroot ${_TARGET} "apt-key
add -"
                                        elif [ -e
"${LB_BASE}/archives/${REPOSITORY}.key" ]
                                        then
-                                               cat
"${LB_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -"
+                                               cat
"${LB_BASE}/archives/${REPOSITORY}.key" | Chroot ${_TARGET} "apt-key add -"
                                        fi
                                fi
                        done
@@ -260,10 +261,10 @@ EOF

                # Check local sources.list
                if Find_files config/archives/*.list || \
-                  Find_files config/archives/*.list.chroot
+                  Find_files config/archives/*.list.${_TARGET}
                then
                        for FILE in config/archives/*.list \
-                                   config/archives/*.list.chroot
+                                   config/archives/*.list.${_TARGET}
                        do
                                if [ -e "${FILE}" ]
                                then
@@ -271,101 +272,101 @@ EOF
                                            -e
"s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
                                            -e
"s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
                                            -e
"s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
-                                       "${FILE}" >
"chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
+                                       "${FILE}" >
"${_TARGET}/etc/apt/sources.list.d/$(basename ${FILE} .${_TARGET})"
                                fi
                        done
                fi

                # Configure local package repository
-               if Find_files config/packages.chroot/*.deb || Find_files
config/packages/*.deb
+               if Find_files config/packages.${_TARGET}/*.deb || Find_files
config/packages/*.deb
                then
-                       rm -rf chroot/root/packages
-                       mkdir -p chroot/root/packages
+                       rm -rf ${_TARGET}/root/packages
+                       mkdir -p ${_TARGET}/root/packages

-                       if [ "$(stat --printf %d config/packages.chroot)" =
"$(stat --printf %d chroot/root/packages)" ] ||
-                          [ "$(stat --printf %d config/packages)" = "$(stat
--printf %d chroot/root/packages)" ]
+                       if [ "$(stat --printf %d config/packages.${_TARGET})" =
"$(stat --printf %d ${_TARGET}/root/packages)" ] ||
+                          [ "$(stat --printf %d config/packages)" = "$(stat
--printf %d ${_TARGET}/root/packages)" ]
                        then
                                CP_OPTIONS="-l"
                        fi

                        # Copy packages
-                       if Find_files
config/packages.chroot/*_"${LB_ARCHITECTURES}".deb || Find_files
config/packages/*_"${LB_ARCHITECTURES}".deb
+                       if Find_files
config/packages.${_TARGET}/*_"${LB_ARCHITECTURES}".deb || Find_files
config/packages/*_"${LB_ARCHITECTURES}".deb
                        then
-                               for FILE in
config/packages.chroot/*_"${LB_ARCHITECTURES}".deb
config/packages/*_"${LB_ARCHITECTURES}".deb
+                               for FILE in
config/packages.${_TARGET}/*_"${LB_ARCHITECTURES}".deb
config/packages/*_"${LB_ARCHITECTURES}".deb
                                do
                                        if [ -L "${FILE}" ]
                                        then
-                                               cp -L "${FILE}"
chroot/root/packages
+                                               cp -L "${FILE}"
${_TARGET}/root/packages
                                        elif [ -e "${FILE}" ]
                                        then
-                                               cp ${CP_OPTIONS} "${FILE}"
chroot/root/packages
+                                               cp ${CP_OPTIONS} "${FILE}"
${_TARGET}/root/packages
                                        fi
                                done
                        fi

-                       if Find_files config/packages.chroot/*_all.deb ||
Find_files config/packages/*_all.deb
+                       if Find_files config/packages.${_TARGET}/*_all.deb ||
Find_files config/packages/*_all.deb
                        then
-                               for FILE in config/packages.chroot/*_all.deb
config/packages/*_all.deb
+                               for FILE in
config/packages.${_TARGET}/*_all.deb config/packages/*_all.deb
                                do
                                        if [ -L "${FILE}" ]
                                        then
-                                               cp -L "${FILE}"
chroot/root/packages
+                                               cp -L "${FILE}"
${_TARGET}/root/packages
                                        elif [ -e "${FILE}" ]
                                        then
-                                               cp ${CP_OPTIONS} "${FILE}"
chroot/root/packages
+                                               cp ${CP_OPTIONS} "${FILE}"
${_TARGET}/root/packages
                                        fi
                                done
                        fi

-                       if Find_files chroot/root/packages/*.deb
+                       if Find_files ${_TARGET}/root/packages/*.deb
                        then
-                               # If we bootstrapped a minimal chroot, we need
+                               # If we bootstrapped a minimal ${_TARGET}, we
need
                                # to install apt-utils before we have have
                                # completed all the indices.
                                case "${LB_PACKAGE_LISTS}" in
                                        stripped|minimal)
-                                               Apt chroot update
+                                               Apt ${_TARGET} update
                                                ;;
                                esac

                                # Check depends
-                               Check_package chroot/usr/bin/apt-ftparchive
apt-utils
+                               Check_package ${_TARGET}/usr/bin/apt-ftparchive
apt-utils

                                # Installing depends
                                Install_package

                                # Generate Packages and Packages.gz
-                               echo "cd /root/packages && apt-ftparchive
packages . > Packages" | Chroot chroot sh
-                               gzip -9 -c chroot/root/packages/Packages >
chroot/root/packages/Packages.gz
+                               echo "cd /root/packages && apt-ftparchive
packages . > Packages" | Chroot ${_TARGET} sh
+                               gzip -9 -c ${_TARGET}/root/packages/Packages >
${_TARGET}/root/packages/Packages.gz

                                # Generate Release
                                echo "cd /root/packages && apt-ftparchive \
-                                       -o
APT::FTPArchive::Release::Origin=config/packages.chroot \
-                                       release . > Release" | Chroot chroot sh
+                                       -o
APT::FTPArchive::Release::Origin=config/packages.${_TARGET} \
+                                       release . > Release" | Chroot
${_TARGET} sh

                                if [ "${LB_APT_SECURE}" = "true" ]
                                then
                                        _LB_DOTGNUPG_EXISTED=0
-                                       if [ -d chroot/root/.gnupg ]
+                                       if [ -d ${_TARGET}/root/.gnupg ]
                                        then
                                                _LB_DOTGNUPG_EXISTED=1
                                        fi

                                        # Ensure ~/.gnupg exists (required for
gnupg >= ~1.4.9)
-                                       mkdir -p chroot/root/.gnupg
+                                       mkdir -p ${_TARGET}/root/.gnupg

                                        # Temporarily replace /dev/random with
/dev/urandom so as not
                                        # to block automated image builds; we
don't care about the
                                        # security of this key anyway.
-                                       if [ -e chroot/dev/random ]
+                                       if [ -e ${_TARGET}/dev/random ]
                                        then
-                                               mv chroot/dev/random
chroot/dev/random.orig
-                                               cp -a chroot/dev/urandom
chroot/dev/random
+                                               mv ${_TARGET}/dev/random
${_TARGET}/dev/random.orig
+                                               cp -a ${_TARGET}/dev/urandom
${_TARGET}/dev/random
                                        fi

                                        if Find_files cache/local-package-
keyring.*
                                        then
-                                               cp cache/local-package-
keyring.* chroot/root
+                                               cp cache/local-package-
keyring.* ${_TARGET}/root
                                        else
                                                # Generate temporary key
                                                echo "Key-Type: RSA
@@ -377,7 +378,7 @@ EOF
                                                      Expire-Date: 0
                                                      %secring /root/local-
package-keyring.sec
                                                      %pubring /root/local-
package-keyring.pub
-                                                     %commit" | Chroot chroot
"gpg --batch --gen-key" || _LB_RET=${?}
+                                                     %commit" | Chroot
${_TARGET} "gpg --batch --gen-key" || _LB_RET=${?}

                                                case "${_LB_RET}" in
                                                        ""|2)
@@ -392,38 +393,38 @@ EOF
                                                esac

                                                # Save keyrings to avoid
regeneration
-                                               cp chroot/root/local-package-
keyring.* cache/
+                                               cp ${_TARGET}/root/local-
package-keyring.* cache/
                                        fi

                                        # Sign release
-                                       Chroot chroot "gpg --no-default-keyring
--secret-keyring /root/local-package-keyring.sec \
+                                       Chroot ${_TARGET} "gpg --no-default-
keyring --secret-keyring /root/local-package-keyring.sec \
                                                --keyring /root/local-package-
keyring.pub -abs -o \
                                                /root/packages/Release.gpg
/root/packages/Release"

                                        # Import key
-                                       Chroot chroot "gpg --no-default-keyring
--secret-keyring /root/local-package-keyring.sec \
+                                       Chroot ${_TARGET} "gpg --no-default-
keyring --secret-keyring /root/local-package-keyring.sec \
                                                --keyring /root/local-package-
keyring.pub --armor \
-                                               --export
${_LB_LOCAL_KEY_EMAIL}" | Chroot chroot "apt-key add -"
+                                               --export
${_LB_LOCAL_KEY_EMAIL}" | Chroot ${_TARGET} "apt-key add -"

                                        # Remove temporary keyrings
-                                       rm chroot/root/local-package-
keyring.pub
-                                       rm chroot/root/local-package-
keyring.sec
+                                       rm ${_TARGET}/root/local-package-
keyring.pub
+                                       rm ${_TARGET}/root/local-package-
keyring.sec

                                        # Revert /dev/random
-                                       if [ -e chroot/dev/random.orig ]
+                                       if [ -e ${_TARGET}/dev/random.orig ]
                                        then
-                                               mv chroot/dev/random.orig
chroot/dev/random
+                                               mv ${_TARGET}/dev/random.orig
${_TARGET}/dev/random
                                        fi

                                        # Remove /root/.gnupg if we created it
during the signing process
                                        if [ "${_LB_DOTGNUPG_EXISTED}" -eq 0 ]
                                        then
-                                               rm -rf chroot/root/.gnupg
+                                               rm -rf ${_TARGET}/root/.gnupg
                                        fi
                                fi

                                # Add to sources.list.d
-                               echo "deb file:/root/packages ./" >
chroot/etc/apt/sources.list.d/packages.list
+                               echo "deb file:/root/packages ./" >
${_TARGET}/etc/apt/sources.list.d/packages.list

                                # Removing depends
                                Remove_package
@@ -432,10 +433,10 @@ EOF
                        fi
                fi

-               if Find_files chroot/root/packages/*.deb
+               if Find_files ${_TARGET}/root/packages/*.deb
                then
-                       gunzip < chroot/root/packages/Packages.gz | awk
'/^Package: / { print $2 }' \
-                       >> chroot/root/packages.chroot
+                       gunzip < ${_TARGET}/root/packages/Packages.gz | awk
'/^Package: / { print $2 }' \
+                       >> ${_TARGET}/root/packages.${_TARGET}
                fi

                # Update indices from cache
@@ -443,57 +444,57 @@ EOF
                then
                        if Find_files cache/indices_bootstrap/secring.gpg*
                        then
-                               cp -f cache/indices_bootstrap/secring.gpg*
chroot/etc/apt
+                               cp -f cache/indices_bootstrap/secring.gpg*
${_TARGET}/etc/apt
                        fi

                        if Find_files cache/indices_bootstrap/trusted.gpg*
                        then
-                               cp -rf cache/indices_bootstrap/trusted.gpg*
chroot/etc/apt
+                               cp -rf cache/indices_bootstrap/trusted.gpg*
${_TARGET}/etc/apt
                        fi

                        if [ -f cache/indices_bootstrap/pkgcache.bin ]
                        then
-                               cp -f cache/indices_bootstrap/pkgcache.bin
chroot/var/cache/apt
+                               cp -f cache/indices_bootstrap/pkgcache.bin
${_TARGET}/var/cache/apt
                        fi

                        if [ -f cache/indices_bootstrap/srcpkgcache.bin ]
                        then
-                               cp -f cache/indices_bootstrap/srcpkgcache.bin
chroot/var/cache/apt
+                               cp -f cache/indices_bootstrap/srcpkgcache.bin
${_TARGET}/var/cache/apt
                        fi

                        if Find_files cache/indices_bootstrap/*_Packages
                        then
-                               cp -f cache/indices_bootstrap/*_Packages
chroot/var/lib/apt/lists
+                               cp -f cache/indices_bootstrap/*_Packages
${_TARGET}/var/lib/apt/lists
                        fi

                        if Find_files cache/indices_bootstrap/*_Sources
                        then
-                               cp -f cache/indices_bootstrap/*_Sources
chroot/var/lib/apt/lists
+                               cp -f cache/indices_bootstrap/*_Sources
${_TARGET}/var/lib/apt/lists
                        fi

                        if Find_files cache/indices_bootstrap/*Release*
                        then
-                               cp -f cache/indices_bootstrap/*Release*
chroot/var/lib/apt/lists
+                               cp -f cache/indices_bootstrap/*Release*
${_TARGET}/var/lib/apt/lists
                        fi

                        if [ "${LB_APT}" = "aptitude" ] && [ ! -x
/usr/bin/aptitude ]
                        then
-                               Chroot chroot "apt-get ${APT_OPTIONS} update"
-                               Chroot chroot "apt-get ${APT_OPTIONS} install
aptitude"
+                               Chroot ${_TARGET} "apt-get ${APT_OPTIONS}
update"
+                               Chroot ${_TARGET} "apt-get ${APT_OPTIONS}
install aptitude"
                        fi
                else # Get fresh indices
                        # Check local archive keys
                        if Find_files config/archives/*.key || \
-                          Find_files config/archives/*.key.chroot
+                          Find_files config/archives/*.key.${_TARGET}
                        then
                                for FILE in config/archives/*.key \
-                                           config/archives/*.key.chroot
+                                           config/archives/*.key.${_TARGET}
                                do
                                        if [ -e "${FILE}" ]
                                        then
-                                               cp ${FILE} chroot/root
-                                               Chroot chroot "apt-key add
/root/$(basename ${FILE})"
-                                               rm -f chroot/root/$(basename
${FILE})
+                                               cp ${FILE} ${_TARGET}/root
+                                               Chroot ${_TARGET} "apt-key add
/root/$(basename ${FILE})"
+                                               rm -f
${_TARGET}/root/$(basename ${FILE})
                                        fi
                                done
                        fi
@@ -503,26 +504,26 @@ EOF
                        then
                                for PACKAGE in config/archives/*.deb
                                do
-                                       cp ${PACKAGE} chroot/root
-                                       Chroot chroot "dpkg -i /root/$(basename
${PACKAGE})"
-                                       rm -f chroot/root/$(basename
${PACKAGE})
+                                       cp ${PACKAGE} ${_TARGET}/root
+                                       Chroot ${_TARGET} "dpkg -i
/root/$(basename ${PACKAGE})"
+                                       rm -f ${_TARGET}/root/$(basename
${PACKAGE})
                                done
                        fi

                        # Installing aptitude (FIXME)
                        if [ "${LB_APT}" = "aptitude" ] && [ ! -x
/usr/bin/aptitude ]
                        then
-                               Chroot chroot "apt-get ${APT_OPTIONS} update"
-                               Chroot chroot "apt-get ${APT_OPTIONS} install
aptitude"
+                               Chroot ${_TARGET} "apt-get ${APT_OPTIONS}
update"
+                               Chroot ${_TARGET} "apt-get ${APT_OPTIONS}
install aptitude"
                        fi

                        # Rebuild apt indices from scratch.
                        # Due to the fact that apt doesn't understand
                        # pinning on the fly, we need to manually remove
                        # the cached indices and rebuild them again.
-                       rm -rf chroot/var/cache/apt/*.bin
+                       rm -rf ${_TARGET}/var/cache/apt/*.bin

-                       Apt chroot update
+                       Apt ${_TARGET} update

                        # Installing keyring packages
                        if [ -n "${LB_KEYRING_PACKAGES}" ]
@@ -530,48 +531,48 @@ EOF
                                if [ "${LB_DERIVATIVE}" = "true" ]
                                then
                                        # Temporary hack (FIXME)
-                                       Chroot chroot "apt-get ${APT_OPTIONS}
--force-yes install ${LB_KEYRING_PACKAGES}"
+                                       Chroot ${_TARGET} "apt-get
${APT_OPTIONS} --force-yes install ${LB_KEYRING_PACKAGES}"
                                else
-                                       Apt chroot "install
${LB_KEYRING_PACKAGES}"
+                                       Apt ${_TARGET} "install
${LB_KEYRING_PACKAGES}"
                                fi
                        fi

-                       rm -rf chroot/var/cache/apt/*.bin
+                       rm -rf ${_TARGET}/var/cache/apt/*.bin

-                       Apt chroot update
-                       Apt chroot "upgrade"
-                       Apt chroot "dist-upgrade"
+                       Apt ${_TARGET} update
+                       Apt ${_TARGET} "upgrade"
+                       Apt ${_TARGET} "dist-upgrade"

                        if [ "${LB_CACHE_INDICES}" = "true" ]
                        then
                                mkdir -p cache/indices_bootstrap

-                               cp -f chroot/etc/apt/secring.gpg*
cache/indices_bootstrap
-                               cp -rf chroot/etc/apt/trusted.gpg*
cache/indices_bootstrap
+                               cp -f ${_TARGET}/etc/apt/secring.gpg*
cache/indices_bootstrap
+                               cp -rf ${_TARGET}/etc/apt/trusted.gpg*
cache/indices_bootstrap

-                               cp -f chroot/var/cache/apt/pkgcache.bin
cache/indices_bootstrap
+                               cp -f ${_TARGET}/var/cache/apt/pkgcache.bin
cache/indices_bootstrap

-                               if Find_files
chroot/var/cache/apt/srcpkgcache.bin
+                               if Find_files
${_TARGET}/var/cache/apt/srcpkgcache.bin
                                then
-                                       cp -f
chroot/var/cache/apt/srcpkgcache.bin cache/indices_bootstrap
+                                       cp -f
${_TARGET}/var/cache/apt/srcpkgcache.bin cache/indices_bootstrap
                                fi

-                               cp -f chroot/var/lib/apt/lists/*_Packages
cache/indices_bootstrap
+                               cp -f ${_TARGET}/var/lib/apt/lists/*_Packages
cache/indices_bootstrap

-                               if Find_files
chroot/var/lib/apt/lists/*_Sources
+                               if Find_files
${_TARGET}/var/lib/apt/lists/*_Sources
                                then
-                                       cp -f
chroot/var/lib/apt/lists/*_Sources cache/indices_bootstrap
+                                       cp -f
${_TARGET}/var/lib/apt/lists/*_Sources cache/indices_bootstrap
                                fi

-                               cp -f chroot/var/lib/apt/lists/*Release*
cache/indices_bootstrap
+                               cp -f ${_TARGET}/var/lib/apt/lists/*Release*
cache/indices_bootstrap
                        fi
                fi

                # Saving cache
-               Save_cache cache/packages_chroot
+               Save_cache cache/packages_${_TARGET}

                # Creating stage file
-               Create_stagefile .stage/chroot_archives
+               Create_stagefile .stage/${_TARGET}_archives
                ;;

        remove)
@@ -587,21 +588,21 @@ EOF
                # Don't do anything if it's not required
                if [ "${LB_PARENT_MIRROR_CHROOT}" =
"${LB_PARENT_MIRROR_BINARY}" ] && \
                [ "${LB_PARENT_MIRROR_CHROOT_SECURITY}" =
"${LB_PARENT_MIRROR_BINARY_SECURITY}" ] && \
-               [ ! -d chroot/root/packages ]
+               [ ! -d ${_TARGET}/root/packages ]
                then
                        # Removing stage file
-                       rm -f .stage/chroot_archives
+                       rm -f .stage/${_TARGET}_archives

                        exit 0
                fi

                # Cleaning apt list cache
-               rm -rf chroot/var/lib/apt/lists
-               mkdir -p chroot/var/lib/apt/lists/partial
+               rm -rf ${_TARGET}/var/lib/apt/lists
+               mkdir -p ${_TARGET}/var/lib/apt/lists/partial

                # Configure custom sources.list

-cat > chroot/etc/apt/sources.list << EOF
+cat > ${_TARGET}/etc/apt/sources.list << EOF
 # /etc/apt/sources.list

 deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION}
${LB_PARENT_ARCHIVE_AREAS}
@@ -609,13 +610,13 @@ EOF

                if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" =
"true" ]
                then
-                       echo "deb-src ${LB_PARENT_MIRROR_BINARY}
${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list
+                       echo "deb-src ${LB_PARENT_MIRROR_BINARY}
${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list
                fi

                if [ "${LB_DERIVATIVE}" = "true" ]
                then

-cat > chroot/etc/apt/sources.list.d/${LB_MODE}.list << EOF
+cat > ${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list << EOF
 # /etc/apt/sources.list.d/${LB_MODE}.list

 EOF
@@ -633,11 +634,11 @@ EOF
                        for _DISTRIBUTION in ${_DISTRIBUTIONS}
                        do

-                               echo "deb ${LB_MIRROR_BINARY} ${_DISTRIBUTION}
${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                               echo "deb ${LB_MIRROR_BINARY} ${_DISTRIBUTION}
${LB_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list

                                if [ "${_PASS}" = "source" ] || [
"${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                then
-                                       echo "deb-src ${LB_MIRROR_BINARY}
${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                       echo "deb-src ${LB_MIRROR_BINARY}
${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list
                                fi
                        done
                fi
@@ -652,11 +653,11 @@ EOF
                                                        ;;

                                                *)
-                                                       echo "deb
${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                                       echo "deb
${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list

                                                        if [ "${_PASS}" =
"source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                                        then
-                                                               echo "deb-src
${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                                               echo "deb-src
${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list
                                                        fi
                                                        ;;
                                        esac
@@ -669,33 +670,33 @@ EOF
                                                                ;;

                                                        *)
-                                                               echo "deb
${LB_MIRROR_BINARY_SECURITY} ${LB_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}"
>> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                                               echo "deb
${LB_MIRROR_BINARY_SECURITY} ${LB_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}"
>> ${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list

                                                                if [ "${_PASS}"
= "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                                                then
-                                                                       echo
"deb-src ${LB_MIRROR_BINARY_SECURITY} ${LB_DISTRIBUTION}-security
${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                                                       echo
"deb-src ${LB_MIRROR_BINARY_SECURITY} ${LB_DISTRIBUTION}-security
${LB_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list
                                                                fi
                                                                ;;
                                                esac
                                        else
                                                if [ "${LB_DERIVATIVE}" =
"true" ]
                                                then
-                                                       echo "deb
${LB_MIRROR_BINARY_SECURITY} ${LB_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                                       echo "deb
${LB_MIRROR_BINARY_SECURITY} ${LB_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list

                                                        if [ "${_PASS}" =
"source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                                        then
-                                                               echo "deb-src
${LB_MIRROR_BINARY_SECURITY} ${LB_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                                               echo "deb-src
${LB_MIRROR_BINARY_SECURITY} ${LB_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list
                                                        fi
                                                fi
                                        fi
                                        ;;

                                ubuntu|kubuntu)
-                                       echo "deb
${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                       echo "deb
${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list

                                        if [ "${_PASS}" = "source" ] || [
"${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                        then
-                                               echo "deb-src
${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                               echo "deb-src
${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list
                                        fi
                                        ;;
                        esac
@@ -705,22 +706,22 @@ EOF
                then
                        case "${LB_MODE}" in
                                debian|ubuntu|kubuntu)
-                                       echo "deb
${LB_PARENT_MIRROR_BINARY_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                       echo "deb
${LB_PARENT_MIRROR_BINARY_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list

                                        if [ "${_PASS}" = "source" ] || [
"${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                        then
-                                               echo "deb-src
${LB_PARENT_MIRROR_BINARY_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                               echo "deb-src
${LB_PARENT_MIRROR_BINARY_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list
                                        fi
                                        ;;
                        esac

                        if [ "${LB_DERIVATIVE}" = "true" ] && [
"${LB_MIRROR_BINARY_VOLATILE}" != "none" ]
                        then
-                               echo "deb ${LB_MIRROR_BINARY_VOLATILE}
${LB_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                               echo "deb ${LB_MIRROR_BINARY_VOLATILE}
${LB_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list

                                if [ "${_PASS}" = "source" ] || [
"${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                then
-                                       echo "deb-src
${LB_MIRROR_BINARY_VOLATILE} ${LB_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                       echo "deb-src
${LB_MIRROR_BINARY_VOLATILE} ${LB_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list
                                fi
                        fi
                fi
@@ -731,11 +732,11 @@ EOF
                                debian)
                                        if [ "${LB_PARENT_DISTRIBUTION}" !=
"sid" ]
                                        then
-                                               echo "deb
${LB_PARENT_MIRROR_BINARY_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                               echo "deb
${LB_PARENT_MIRROR_BINARY_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list

                                                if [ "${_PASS}" = "source" ] ||
[ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                                then
-                                                       echo "deb-src
${LB_PARENT_MIRROR_BINARY_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports
${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list
+                                                       echo "deb-src
${LB_PARENT_MIRROR_BINARY_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports
${LB_PARENT_ARCHIVE_AREAS}" >> ${_TARGET}/etc/apt/sources.list
                                                fi
                                        fi
                                        ;;
@@ -743,11 +744,11 @@ EOF

                        if [ "${LB_DERIVATIVE}" = "true" ] && [
"${LB_MIRROR_BINARY_BACKPORTS}" != "none" ]
                        then
-                               echo "deb ${LB_MIRROR_BINARY_BACKPORTS}
${LB_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >>
chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                               echo "deb ${LB_MIRROR_BINARY_BACKPORTS}
${LB_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >>
${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list

                                if [ "${_PASS}" = "source" ] || [
"${LB_APT_SOURCE_ARCHIVES}" = "true" ]
                                then
-                                       echo "deb-src
${LB_MIRROR_BINARY_BACKPORTS} ${LB_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}"
>> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+                                       echo "deb-src
${LB_MIRROR_BINARY_BACKPORTS} ${LB_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}"
>> ${_TARGET}/etc/apt/sources.list.d/${LB_MODE}.list
                                fi
                        fi
                fi
@@ -757,8 +758,8 @@ EOF
                then
                        for REPOSITORY in ${LB_ARCHIVES}
                        do
-                               # Removing sources.list entries (chroot)
-                               rm -f
"chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+                               # Removing sources.list entries (${_TARGET})
+                               rm -f
"${_TARGET}/etc/apt/sources.list.d/${REPOSITORY}.list"

                                # Prefer archives from the config tree
                                # over the global ones.
@@ -773,13 +774,13 @@ EOF
                                        sed -e
"s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
                                            -e
"s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
"${LB_BASE}/archives/${REPOSITORY}.binary" > \
-
"chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+
"${_TARGET}/etc/apt/sources.list.d/${REPOSITORY}.list"
                                elif [ -e "${LB_BASE}/archives/${REPOSITORY}" ]
                                then
                                        sed -e
"s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
                                            -e
"s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
                                        "${LB_BASE}/archives/${REPOSITORY}" > \
-
"chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+
"${_TARGET}/etc/apt/sources.list.d/${REPOSITORY}.list"
                                fi

                                if [ "${LB_APT_SECURE}" != false ]
@@ -787,10 +788,10 @@ EOF
                                        # Adding archive signing keys (binary)
                                        if [ -e
"${LB_BASE}/archives/${REPOSITORY}.key.binary" ]
                                        then
-                                               cat
"${LB_BASE}/archives/${REPOSITORY}.key.binary" | Chroot chroot "apt-key add -"
+                                               cat
"${LB_BASE}/archives/${REPOSITORY}.key.binary" | Chroot ${_TARGET} "apt-key add
-"
                                        elif [ -e
"${LB_BASE}/archives/${REPOSITORY}.key" ]
                                        then
-                                               cat
"${LB_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -"
+                                               cat
"${LB_BASE}/archives/${REPOSITORY}.key" | Chroot ${_TARGET} "apt-key add -"
                                        fi
                                fi
                        done
@@ -809,7 +810,7 @@ EOF
                                            -e
"s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
                                            -e
"s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
                                            -e
"s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
-                                       "${FILE}" >
"chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
+                                       "${FILE}" >
"${_TARGET}/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
                                fi
                        done
                fi
@@ -823,30 +824,30 @@ EOF
                        do
                                if [ -e "${FILE}" ]
                                then
-                                       cp ${FILE} chroot/root
-                                       Chroot chroot "apt-key add
/root/$(basename ${FILE})"
-                                       rm -f chroot/root/$(basename ${FILE})
+                                       cp ${FILE} ${_TARGET}/root
+                                       Chroot ${_TARGET} "apt-key add
/root/$(basename ${FILE})"
+                                       rm -f ${_TARGET}/root/$(basename
${FILE})
                                fi
                        done
                fi

                # Updating indices
-               Apt chroot update
+               Apt ${_TARGET} update

                # Cleaning apt package cache
-               rm -rf chroot/var/cache/apt
-               mkdir -p chroot/var/cache/apt/archives/partial
+               rm -rf ${_TARGET}/var/cache/apt
+               mkdir -p ${_TARGET}/var/cache/apt/archives/partial

                # Cleaning apt package lists
                if [ "${LB_APT_INDICES}" = "false" ]
                then
-                       rm -rf chroot/var/lib/apt/lists
-                       mkdir -p chroot/var/lib/apt/lists/partial
+                       rm -rf ${_TARGET}/var/lib/apt/lists
+                       mkdir -p ${_TARGET}/var/lib/apt/lists/partial
                fi

                # Remove local package repository
-               rm -f chroot/etc/apt/sources.list.d/packages.list
-               rm -rf chroot/root/packages
+               rm -f ${_TARGET}/etc/apt/sources.list.d/packages.list
+               rm -rf ${_TARGET}/root/packages

                # Remove local packages key if it exists
                if apt-key list | grep -q ${_LB_LOCAL_KEY_EMAIL}
@@ -855,7 +856,7 @@ EOF
                fi

                # Removing stage file
-               rm -f .stage/chroot_archives
+               rm -f .stage/${_TARGET}_archives
                ;;

        *)
diff --git a/scripts/build/lb_chroot_cache b/scripts/build/lb_chroot_cache
index 3ad07df..aa881ca 100755
--- a/scripts/build/lb_chroot_cache
+++ b/scripts/build/lb_chroot_cache
@@ -14,28 +14,29 @@ set -e
 . "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh

 # Setting static variables
-DESCRIPTION="$(Echo 'cache chroot stage')"
+DESCRIPTION="$(Echo 'cache ${_TARGET} stage')"
 HELP=""
 USAGE="${PROGRAM} [--force]"

 Arguments "${@}"
+_TARGET="${_TARGET:-chroot}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/ports config/binary config/source
 Set_defaults

 for STAGE in ${LB_CACHE_STAGES}
 do
-       if [ "${STAGE}" = "chroot" ]
+       if [ "${STAGE}" = "${_TARGET}" ]
        then
                case "${1}" in
                        restore)
-                               Echo_message "Restoring chroot stage from
cache..."
+                               Echo_message "Restoring ${_TARGET} stage from
cache..."

                                # Checking stage file
-                               Check_stagefile .stage/chroot_cache.restore
+                               Check_stagefile .stage/${_TARGET}_cache.restore

-                               if [ -d cache/stages_chroot ]
+                               if [ -d cache/stages_${_TARGET} ]
                                then
                                        # Checking lock file
                                        Check_lockfile .lock
@@ -43,29 +44,29 @@ do
                                        # Creating lock file
                                        Create_lockfile .lock

-                                       # Removing old chroot
-                                       rm -rf chroot
+                                       # Removing old ${_TARGET}
+                                       rm -rf ${_TARGET}

                                        # Restoring old cache
-                                       ${LB_ROOT_COMMAND} cp -a
cache/stages_chroot chroot
+                                       ${LB_ROOT_COMMAND} cp -a
cache/stages_${_TARGET} ${_TARGET}

                                        if [ -n "${LB_ROOT_COMMAND}" ]
                                        then
-                                               ${LB_ROOT_COMMAND} chown -R
$(whoami):$(whoami) chroot
+                                               ${LB_ROOT_COMMAND} chown -R
$(whoami):$(whoami) ${_TARGET}
                                        fi

                                        # Creating stage file
-                                       Create_stagefile
.stage/chroot_cache.restore
+                                       Create_stagefile
.stage/${_TARGET}_cache.restore

                                        exit 0
                                fi
                                ;;

                        save)
-                               Echo_message "Saving chroot stage to cache..."
+                               Echo_message "Saving ${_TARGET} stage to
cache..."

                                # Checking stage file
-                               Check_stagefile .stage/chroot_cache.save
+                               Check_stagefile .stage/${_TARGET}_cache.save

                                # Checking lock file
                                Check_lockfile .lock
@@ -73,19 +74,19 @@ do
                                # Creating lock file
                                Create_lockfile .lock

-                               rm -rf cache/stages_chroot
+                               rm -rf cache/stages_${_TARGET}

                                mkdir -p cache

-                               ${LB_ROOT_COMMAND} cp -a chroot
cache/stages_chroot
+                               ${LB_ROOT_COMMAND} cp -a ${_TARGET}
cache/stages_${_TARGET}

                                if [ -n "${LB_ROOT_COMMAND}" ]
                                then
-                                       ${LB_ROOT_COMMAND} chown -R
$(whoami):$(whoami) cache/stages_chroot
+                                       ${LB_ROOT_COMMAND} chown -R
$(whoami):$(whoami) cache/stages_${_TARGET}
                                fi

                                # Creating stage file
-                               Create_stagefile .stage/chroot_cache.save
+                               Create_stagefile .stage/${_TARGET}_cache.save
                                ;;
                esac
        fi
diff --git a/scripts/build/lb_chroot_debianchroot
b/scripts/build/lb_chroot_debianchroot
index 872dc45..7817db6 100755
--- a/scripts/build/lb_chroot_debianchroot
+++ b/scripts/build/lb_chroot_debianchroot
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} {install|remove} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Requiring stage file
diff --git a/scripts/build/lb_chroot_devpts b/scripts/build/lb_chroot_devpts
index 7ba16aa..5aa1bfe 100755
--- a/scripts/build/lb_chroot_devpts
+++ b/scripts/build/lb_chroot_devpts
@@ -19,12 +19,13 @@ HELP=""
 USAGE="${PROGRAM} {install|remove} [--force]"

 Arguments "${@}"
+_TARGET=${_TARGET:-chroot}

 # Ensure that a system is built as root
 lb testroot

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/ports config/binary config/source
 Set_defaults

 # Requiring stage file
@@ -35,7 +36,7 @@ case "${1}" in
                Echo_message "Begin mounting /dev/pts..."

                # Checking stage file
-               Check_stagefile .stage/chroot_devpts
+               Check_stagefile .stage/${_TARGET}_devpts

                # Checking lock file
                Check_lockfile .lock
@@ -46,14 +47,14 @@ case "${1}" in
                if [ "${LB_USE_FAKEROOT}" != "true" ]
                then
                        # Creating mountpoint
-                       mkdir -p chroot/dev/pts
+                       mkdir -p ${_TARGET}/dev/pts

                        # Mounting /dev/pts
-                       ${LB_ROOT_COMMAND} mount devpts-live -t devpts
chroot/dev/pts || true
+                       ${LB_ROOT_COMMAND} mount devpts-live -t devpts
${_TARGET}/dev/pts || true
                fi

                # Creating stage file
-               Create_stagefile .stage/chroot_devpts
+               Create_stagefile .stage/${_TARGET}_devpts
                ;;

        remove)
@@ -68,16 +69,16 @@ case "${1}" in
                # Unmounting /dev/pts
                if [ "${LB_USE_FAKEROOT}" != "true" ]
                then
-                       if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts ||
Find_files chroot/dev/pts/*
+                       if grep -qs "$(pwd)/${_TARGET}/dev/pts" /proc/mounts ||
Find_files ${_TARGET}/dev/pts/*
                        then
-                               ${LB_ROOT_COMMAND} umount chroot/dev/pts
+                               ${LB_ROOT_COMMAND} umount ${_TARGET}/dev/pts
                        else
-                               ${LB_ROOT_COMMAND} umount -f chroot/dev/pts >
/dev/null 2>&1 || true
+                               ${LB_ROOT_COMMAND} umount -f ${_TARGET}/dev/pts
> /dev/null 2>&1 || true
                        fi
                fi

                # Removing stage file
-               rm -f .stage/chroot_devpts
+               rm -f .stage/${_TARGET}_devpts
                ;;

        *)
diff --git a/scripts/build/lb_chroot_dpkg b/scripts/build/lb_chroot_dpkg
index 7daf7bf..ab3e2f2 100755
--- a/scripts/build/lb_chroot_dpkg
+++ b/scripts/build/lb_chroot_dpkg
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} {install|remove} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Requiring stage file
diff --git a/scripts/build/lb_chroot_hacks b/scripts/build/lb_chroot_hacks
index c6e2775..5c69ff3 100755
--- a/scripts/build/lb_chroot_hacks
+++ b/scripts/build/lb_chroot_hacks
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin executing hacks..."
diff --git a/scripts/build/lb_chroot_hooks b/scripts/build/lb_chroot_hooks
index 7080459..d5e8708 100755
--- a/scripts/build/lb_chroot_hooks
+++ b/scripts/build/lb_chroot_hooks
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin executing hooks..."
diff --git a/scripts/build/lb_chroot_hostname
b/scripts/build/lb_chroot_hostname
index 4da8602..1e0e04c 100755
--- a/scripts/build/lb_chroot_hostname
+++ b/scripts/build/lb_chroot_hostname
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} {install|remove} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Requiring stage file
diff --git a/scripts/build/lb_chroot_hosts b/scripts/build/lb_chroot_hosts
index 65e85fa..46fe4e2 100755
--- a/scripts/build/lb_chroot_hosts
+++ b/scripts/build/lb_chroot_hosts
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} {install|remove} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Requiring stage file
@@ -50,7 +50,7 @@ case "${1}" in

 cat > chroot/etc/hosts << EOF
 127.0.0.1      localhost localhost.localdomain
-127.0.1.1      debian
+127.0.1.1      ${LB_MODE}
 EOF

                if [ -f /etc/hosts ]
diff --git a/scripts/build/lb_chroot_includes
b/scripts/build/lb_chroot_includes
index 0d08dd9..0cb2e70 100755
--- a/scripts/build/lb_chroot_includes
+++ b/scripts/build/lb_chroot_includes
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin copying chroot includes..."
diff --git a/scripts/build/lb_chroot_install-packages b/scripts/build
/lb_chroot_install-packages
index 37d055a..4f0705b 100755
--- a/scripts/build/lb_chroot_install-packages
+++ b/scripts/build/lb_chroot_install-packages
@@ -25,7 +25,7 @@ shift
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin installing packages (${_PASS} pass)..."
diff --git a/scripts/build/lb_chroot_interactive
b/scripts/build/lb_chroot_interactive
index 989b379..412bb02 100755
--- a/scripts/build/lb_chroot_interactive
+++ b/scripts/build/lb_chroot_interactive
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_INTERACTIVE}" = "false" ]
diff --git a/scripts/build/lb_chroot_linux-image b/scripts/build
/lb_chroot_linux-image
index a655277..ae22e7f 100755
--- a/scripts/build/lb_chroot_linux-image
+++ b/scripts/build/lb_chroot_linux-image
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Requiring stage file
diff --git a/scripts/build/lb_chroot_live-packages b/scripts/build
/lb_chroot_live-packages
index 31734a8..830e8a1 100755
--- a/scripts/build/lb_chroot_live-packages
+++ b/scripts/build/lb_chroot_live-packages
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Requiring stage file
diff --git a/scripts/build/lb_chroot_local-patches b/scripts/build
/lb_chroot_local-patches
index b695e63..23036dc 100755
--- a/scripts/build/lb_chroot_local-patches
+++ b/scripts/build/lb_chroot_local-patches
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin applying chroot local patches..."
diff --git a/scripts/build/lb_chroot_local-preseed b/scripts/build
/lb_chroot_local-preseed
index d37f5eb..d32d6d0 100755
--- a/scripts/build/lb_chroot_local-preseed
+++ b/scripts/build/lb_chroot_local-preseed
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin executing local preseeds..."
diff --git a/scripts/build/lb_chroot_package-lists b/scripts/build
/lb_chroot_package-lists
index ff990d5..fd1aa6f 100755
--- a/scripts/build/lb_chroot_package-lists
+++ b/scripts/build/lb_chroot_package-lists
@@ -24,7 +24,7 @@ shift
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin queueing installation of package lists (${_PASS} pass)..."
diff --git a/scripts/build/lb_chroot_preseed b/scripts/build/lb_chroot_preseed
index 63493b2..e177867 100755
--- a/scripts/build/lb_chroot_preseed
+++ b/scripts/build/lb_chroot_preseed
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 Echo_message "Begin executing preseed..."
diff --git a/scripts/build/lb_chroot_proc b/scripts/build/lb_chroot_proc
index 57ba5cf..c751452 100755
--- a/scripts/build/lb_chroot_proc
+++ b/scripts/build/lb_chroot_proc
@@ -19,12 +19,13 @@ HELP=""
 USAGE="${PROGRAM} {install|remove} [--force]"

 Arguments "${@}"
+_TARGET="${_TARGET:-chroot}"

 # Ensure that a system is built as root
 lb testroot

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/ports config/binary config/source
 Set_defaults

 # Requiring stage file
@@ -35,7 +36,7 @@ case "${1}" in
                Echo_message "Begin mounting /proc..."

                # Checking stage file
-               Check_stagefile .stage/chroot_proc
+               Check_stagefile .stage/${_TARGET}_proc

                # Checking lock file
                Check_lockfile .lock
@@ -46,17 +47,17 @@ case "${1}" in
                if [ "${LB_USE_FAKEROOT}" != "true" ]
                then
                        # Creating mountpoint
-                       mkdir -p chroot/proc
+                       mkdir -p ${_TARGET}/proc

                        # Mounting /proc
-                       ${LB_ROOT_COMMAND} mount proc-live -t proc chroot/proc
+                       ${LB_ROOT_COMMAND} mount proc-live -t proc
${_TARGET}/proc
                else
-                       rm -rf chroot/proc
-                       ln -s /proc chroot/
+                       rm -rf ${_TARGET}/proc
+                       ln -s /proc ${_TARGET}/
                fi

                # Creating stage file
-               Create_stagefile .stage/chroot_proc
+               Create_stagefile .stage/${_TARGET}_proc
                ;;

        remove)
@@ -71,24 +72,24 @@ case "${1}" in
                if [ "${LB_USE_FAKEROOT}" != "true" ]
                then
                        # Workaround binfmt-support /proc locking
-                       if [ -e chroot/proc/sys/fs/binfmt_misc/status ]
+                       if [ -e ${_TARGET}/proc/sys/fs/binfmt_misc/status ]
                        then
-                               ${LB_ROOT_COMMAND} umount
chroot/proc/sys/fs/binfmt_misc
+                               ${LB_ROOT_COMMAND} umount
${_TARGET}/proc/sys/fs/binfmt_misc
                        fi

                        # Unmounting /proc
-                       #fuser -km chroot/proc
-                       if [ -e chroot/proc/version ]
+                       #fuser -km ${_TARGET}/proc
+                       if [ -e ${_TARGET}/proc/version ]
                        then
-                               ${LB_ROOT_COMMAND} umount chroot/proc
+                               ${LB_ROOT_COMMAND} umount ${_TARGET}/proc
                        fi
                else
-                       rm -rf chroot/proc
-                       mkdir -p chroot/proc
+                       rm -rf ${_TARGET}/proc
+                       mkdir -p ${_TARGET}/proc
                fi

                # Removing stage file
-               rm -f .stage/chroot_proc
+               rm -f .stage/${_TARGET}_proc
                ;;

        *)
diff --git a/scripts/build/lb_chroot_resolv b/scripts/build/lb_chroot_resolv
index e32bdc6..158a0e5 100755
--- a/scripts/build/lb_chroot_resolv
+++ b/scripts/build/lb_chroot_resolv
@@ -19,9 +19,10 @@ HELP=""
 USAGE="${PROGRAM} {install|remove} [--force]"

 Arguments "${@}"
+_TARGET="${_TARGET:-chroot}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/ports config/binary config/source
 Set_defaults

 # Requiring stage file
@@ -32,7 +33,7 @@ case "${1}" in
                Echo_message "Configuring file /etc/resolv.conf"

                # Checking stage file
-               Check_stagefile .stage/chroot_resolv
+               Check_stagefile .stage/${_TARGET}_resolv

                # Checking lock file
                Check_lockfile .lock
@@ -40,27 +41,27 @@ case "${1}" in
                # Creating lock file
                Create_lockfile .lock

-               if [ -e chroot/etc/resolv.conf ]
+               if [ -e ${_TARGET}/etc/resolv.conf ]
                then
                        # Save resolv file or symlink
-                       mv chroot/etc/resolv.conf chroot/etc/resolv.conf.orig
+                       mv ${_TARGET}/etc/resolv.conf
${_TARGET}/etc/resolv.conf.orig

                        # Also truncate it, otherwise we'll end up with the one
                        # created by debootstrap in the final image.
                        #
                        # If you want to have a custom resolv.conf, please
                        # overwrite it with normal local_includes mechanism.
-                       Truncate chroot/etc/resolv.conf.orig
+                       Truncate ${_TARGET}/etc/resolv.conf.orig
                fi

                if [ -f /etc/resolv.conf ]
                then
                        # Copy resolv file
-                       cp /etc/resolv.conf chroot/etc/resolv.conf
+                       cp /etc/resolv.conf ${_TARGET}/etc/resolv.conf
                fi

                # Creating stage file
-               Create_stagefile .stage/chroot_resolv
+               Create_stagefile .stage/${_TARGET}_resolv
                ;;

        remove)
@@ -72,22 +73,22 @@ case "${1}" in
                # Creating lock file
                Create_lockfile .lock

-               if [ -e config/includes.chroot/etc/resolv.conf ]
+               if [ -e config/includes.${_TARGET}/etc/resolv.conf ]
                then
                        # Copying local resolv.conf
-                       cp -a config/includes.chroot/etc/resolv.conf
chroot/etc/resolv.conf
-                       rm -f chroot/etc/resolv.conf.orig
-               elif [ -e chroot/etc/resolv.conf.orig ]
+                       cp -a config/includes.${_TARGET}/etc/resolv.conf
${_TARGET}/etc/resolv.conf
+                       rm -f ${_TARGET}/etc/resolv.conf.orig
+               elif [ -e ${_TARGET}/etc/resolv.conf.orig ]
                then
                        # Restoring resolv file or symlink
-                       mv chroot/etc/resolv.conf.orig chroot/etc/resolv.conf
+                       mv ${_TARGET}/etc/resolv.conf.orig
${_TARGET}/etc/resolv.conf
                else
                        # Truncating resolv file
-                       Truncate chroot/etc/resolv.conf
+                       Truncate ${_TARGET}/etc/resolv.conf
                fi

                # Removing stage file
-               rm -f .stage/chroot_resolv
+               rm -f .stage/${_TARGET}_resolv
                ;;

        *)
diff --git a/scripts/build/lb_chroot_selinuxfs
b/scripts/build/lb_chroot_selinuxfs
index 1d7bd0a..10d072f 100755
--- a/scripts/build/lb_chroot_selinuxfs
+++ b/scripts/build/lb_chroot_selinuxfs
@@ -19,12 +19,13 @@ HELP=""
 USAGE="${PROGRAM} {install|remove} [--force]"

 Arguments "${@}"
+_TARGET="${_TARGET:-chroot}"

 # Ensure that a system is built as root
 lb testroot

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/ports config/binary config/source
 Set_defaults

 # Requiring stage file
@@ -37,7 +38,7 @@ case "${1}" in
                        Echo_message "Begin mounting /selinux..."

                        # Checking stage file
-                       Check_stagefile .stage/chroot_selinuxfs
+                       Check_stagefile .stage/${_TARGET}_selinuxfs

                        # Checking lock file
                        Check_lockfile .lock
@@ -48,17 +49,17 @@ case "${1}" in
                        if [ "${LB_USE_FAKEROOT}" != "true" ]
                        then
                                # Create mountpoint
-                               mkdir -p chroot/selinux
+                               mkdir -p ${_TARGET}/selinux

                                # Mounting /selinux
-                               ${LB_ROOT_COMMAND} mount selinuxfs-live -t
selinuxfs chroot/selinux
+                               ${LB_ROOT_COMMAND} mount selinuxfs-live -t
selinuxfs ${_TARGET}/selinux
                        else
-                               rm -rf chroot/selinux
-                               ln -s /selinux chroot/
+                               rm -rf ${_TARGET}/selinux
+                               ln -s /selinux ${_TARGET}/
                        fi

                        # Creating stage file
-                       Create_stagefile .stage/chroot_selinuxfs
+                       Create_stagefile .stage/${_TARGET}_selinuxfs
                fi
                ;;

@@ -74,21 +75,21 @@ case "${1}" in
                if [ "${LB_USE_FAKEROOT}" != "true" ]
                then
                        # Unmounting /selinux
-                       #fuser -km chroot/selinux
-                       if [ -e chroot/selinux/enforce ]
+                       #fuser -km ${_TARGET}/selinux
+                       if [ -e ${_TARGET}/selinux/enforce ]
                        then
-                               ${LB_ROOT_COMMAND} umount chroot/selinux
+                               ${LB_ROOT_COMMAND} umount ${_TARGET}/selinux
                        fi
                else
-                       if [ -e chroot/selinux ]
+                       if [ -e ${_TARGET}/selinux ]
                        then
-                               rm -rf chroot/selinux
-                               mkdir -p chroot/selinux
+                               rm -rf ${_TARGET}/selinux
+                               mkdir -p ${_TARGET}/selinux
                        fi
                fi

                # Removing stage file
-               rm -f .stage/chroot_selinux
+               rm -f .stage/${_TARGET}_selinux
                ;;

        *)
diff --git a/scripts/build/lb_chroot_sysfs b/scripts/build/lb_chroot_sysfs
index fd17743..e5133b4 100755
--- a/scripts/build/lb_chroot_sysfs
+++ b/scripts/build/lb_chroot_sysfs
@@ -19,12 +19,13 @@ HELP=""
 USAGE="${PROGRAM} {install|remove} [--force]"

 Arguments "${@}"
+_TARGET="${_TARGET:-chroot}"

 # Ensure that a system is built as root
 lb testroot

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/ports config/binary config/source
 Set_defaults

 # Requiring stage file
@@ -35,7 +36,7 @@ case "${1}" in
                Echo_message "Begin mounting /sys..."

                # Checking stage file
-               Check_stagefile .stage/chroot_sysfs
+               Check_stagefile .stage/${_TARGET}_sysfs

                # Checking lock file
                Check_lockfile .lock
@@ -46,17 +47,17 @@ case "${1}" in
                if [ "${LB_USE_FAKEROOT}" != "true" ]
                then
                        # Create mountpoint
-                       mkdir -p chroot/sys
+                       mkdir -p ${_TARGET}/sys

                        # Mounting /sys
-                       ${LB_ROOT_COMMAND} mount sysfs-live -t sysfs chroot/sys
+                       ${LB_ROOT_COMMAND} mount sysfs-live -t sysfs
${_TARGET}/sys
                else
-                       rm -rf chroot/sys
-                       ln -s /sys chroot/
+                       rm -rf ${_TARGET}/sys
+                       ln -s /sys ${_TARGET}/
                fi

                # Creating stage file
-               Create_stagefile .stage/chroot_sysfs
+               Create_stagefile .stage/${_TARGET}_sysfs
                ;;

        remove)
@@ -71,18 +72,18 @@ case "${1}" in
                if [ "${LB_USE_FAKEROOT}" != "true" ]
                then
                        # Unmounting /sys
-                       #fuser -km chroot/sys
-                       if [ -e chroot/sys/class ]
+                       #fuser -km ${_TARGET}/sys
+                       if [ -e ${_TARGET}/sys/class ]
                        then
-                               ${LB_ROOT_COMMAND} umount chroot/sys
+                               ${LB_ROOT_COMMAND} umount ${_TARGET}/sys
                        fi
                else
-                       rm -rf chroot/sys
-                       mkdir -p chroot/sys
+                       rm -rf ${_TARGET}/sys
+                       mkdir -p ${_TARGET}/sys
                fi

                # Removing stage file
-               rm -f .stage/chroot_sysfs
+               rm -f .stage/${_TARGET}_sysfs
                ;;

        *)
diff --git a/scripts/build/lb_chroot_sysv-rc b/scripts/build/lb_chroot_sysv-rc
index 5829275..ef815ab 100755
--- a/scripts/build/lb_chroot_sysv-rc
+++ b/scripts/build/lb_chroot_sysv-rc
@@ -19,9 +19,10 @@ HELP=""
 USAGE="${PROGRAM} {install|remove} [--force]"

 Arguments "${@}"
+_TARGET="${_TARGET:-chroot}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/ports config/binary config/source
 Set_defaults

 # Requiring stage file
@@ -32,7 +33,7 @@ case "${1}" in
                Echo_message "Configuring file /usr/sbin/policy-rc.d"

                # Checking stage file
-               Check_stagefile .stage/chroot_sysv-rc
+               Check_stagefile .stage/${_TARGET}_sysv-rc

                # Checking lock file
                Check_lockfile .lock
@@ -40,23 +41,23 @@ case "${1}" in
                # Creating lock file
                Create_lockfile .lock

-               if [ -f chroot/usr/sbin/policy-rc.d ]
+               if [ -f ${_TARGET}/usr/sbin/policy-rc.d ]
                then
                        # Save policy-rc.d file
-                       mv chroot/usr/sbin/policy-rc.d chroot/usr/sbin/policy-
rc.d.orig
+                       mv ${_TARGET}/usr/sbin/policy-rc.d ${_TARGET}/usr/sbin
/policy-rc.d.orig
                fi

                # Create policy-rc.d file
-cat > chroot/usr/sbin/policy-rc.d << EOF
+cat > ${_TARGET}/usr/sbin/policy-rc.d << EOF
 #!/bin/sh
 echo "All runlevel operations denied by policy" >&2
 exit 101
 EOF

-               chmod 0755 chroot/usr/sbin/policy-rc.d
+               chmod 0755 ${_TARGET}/usr/sbin/policy-rc.d

                # Creating stage file
-               Create_stagefile .stage/chroot_sysv-rc
+               Create_stagefile .stage/${_TARGET}_sysv-rc
                ;;

        remove)
@@ -68,17 +69,17 @@ EOF
                # Creating lock file
                Create_lockfile .lock

-               if [ -f chroot/usr/sbin/policy-rc.d.orig ]
+               if [ -f ${_TARGET}/usr/sbin/policy-rc.d.orig ]
                then
                        # Restore policy-rc.d file
-                       mv chroot/usr/sbin/policy-rc.d.orig chroot/usr/sbin
/policy-rc.d
+                       mv ${_TARGET}/usr/sbin/policy-rc.d.orig
${_TARGET}/usr/sbin/policy-rc.d
                else
                        # Remove policy-rc.d file
-                       rm -f chroot/usr/sbin/policy-rc.d
+                       rm -f ${_TARGET}/usr/sbin/policy-rc.d
                fi

                # Removing stage file
-               rm -f .stage/chroot_sysv-rc
+               rm -f .stage/${_TARGET}_sysv-rc
                ;;

        *)
diff --git a/scripts/build/lb_chroot_task-lists b/scripts/build/lb_chroot_task-
lists
index 1377ad1..e84b230 100755
--- a/scripts/build/lb_chroot_task-lists
+++ b/scripts/build/lb_chroot_task-lists
@@ -14,7 +14,7 @@ set -e
 . "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh

 # Setting static variables
-DESCRIPTION="$(Echo 'install task lists into chroot')"
+DESCRIPTION="$(Echo 'install task lists into ${_TARGET}')"
 HELP=""
 USAGE="${PROGRAM} {install|live} [--force]"

@@ -22,9 +22,10 @@ _PASS="${1}"
 shift

 Arguments "${@}"
+_TARGET="${_TARGET:-chroot}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/ports config/binary config/source
 Set_defaults

 Echo_message "Begin installation of task lists (${_PASS} pass)..."
@@ -33,7 +34,7 @@ Echo_message "Begin installation of task lists (${_PASS}
pass)..."
 Require_stagefile .stage/config .stage/bootstrap

 # Checking stage file
-Check_stagefile .stage/chroot_task-lists.${_PASS}
+Check_stagefile .stage/${_TARGET}_task-lists.${_PASS}

 # Checking lock file
 Check_lockfile .lock
@@ -42,36 +43,36 @@ Check_lockfile .lock
 Create_lockfile .lock

 if ls config/task-lists/*.list > /dev/null 2>&1 || \
-   ls config/task-lists/*.list.chroot > /dev/null 2>&1 || \
-   ls config/task-lists/*.list.chroot_${_PASS} > /dev/null 2>&1
+   ls config/task-lists/*.list.${_TARGET} > /dev/null 2>&1 || \
+   ls config/task-lists/*.list.${_TARGET}_${_PASS} > /dev/null 2>&1
 then
        for LIST in config/task-lists/*.list \
-                   config/task-lists/*.list.chroot \
-                   config/task-lists/*.list.chroot_${_PASS}
+                   config/task-lists/*.list.${_TARGET} \
+                   config/task-lists/*.list.${_TARGET}_${_PASS}
        do
                if [ -e "${LIST}" ]
                then
                        # Generating task list
                        Expand_packagelist "$(basename ${LIST})" "config/task-
lists" \
-                               >> chroot/root/chroot_tasks
+                               >> ${_TARGET}/root/${_TARGET}_tasks
                fi
        done

        # Restoring cache
-       Restore_cache cache/packages_chroot
+       Restore_cache cache/packages_${_TARGET}

        # Checking depends
        case "${LB_TASKSEL}" in
                apt)
-                       Check_package chroot/usr/bin/apt-get apt
+                       Check_package ${_TARGET}/usr/bin/apt-get apt
                        ;;

                aptitude)
-                       Check_package chroot/usr/bin/aptitude aptitude
+                       Check_package ${_TARGET}/usr/bin/aptitude aptitude
                        ;;

                tasksel)
-                       Check_package chroot/usr/bin/tasksel tasksel
+                       Check_package ${_TARGET}/usr/bin/tasksel tasksel
                        ;;
        esac

@@ -86,12 +87,12 @@ then

                        case "${LB_MODE}" in
                                ubuntu|kubuntu)
-                                       TASKS="$(cat chroot/root/chroot_tasks)"
+                                       TASKS="$(cat
${_TARGET}/root/${_TARGET}_tasks)"
                                        ;;

                                *)
                                        # Avoid standard tasks which appears to
not exist
-                                       TASKS="$(cat chroot/root/chroot_tasks |
sed -e 's|standard||')"
+                                       TASKS="$(cat
${_TARGET}/root/${_TARGET}_tasks | sed -e 's|standard||')"
                                        ;;
                        esac

@@ -100,15 +101,15 @@ then
                                APT_TASKS="${APT_TASKS:+$APT_TASKS }$TASK^"
                        done

-                       Chroot chroot "apt-get ${APT_OPTIONS} install
${APT_TASKS}"
+                       Chroot ${_TARGET} "apt-get ${APT_OPTIONS} install
${APT_TASKS}"
                        ;;

                aptitude)
-                       Chroot chroot "aptitude ${APTITUDE_OPTIONS} install
$(cat chroot/root/chroot_tasks)"
+                       Chroot ${_TARGET} "aptitude ${APTITUDE_OPTIONS} install
$(cat ${_TARGET}/root/${_TARGET}_tasks)"
                        ;;

                tasksel)
-                       for TASK in $(cat chroot/root/chroot_tasks)
+                       for TASK in $(cat ${_TARGET}/root/${_TARGET}_tasks)
                        do
                                case "${TASK}" in
                                        gnome*)
@@ -128,11 +129,11 @@ then
                                                ;;
                                esac

-                               echo "tasksel tasksel/desktop multiselect
${DESKTOP}" > chroot/root/preseed
-                               Chroot chroot "debconf-set-selections
/root/preseed"
-                               rm -f chroot/root/preseed
+                               echo "tasksel tasksel/desktop multiselect
${DESKTOP}" > ${_TARGET}/root/preseed
+                               Chroot ${_TARGET} "debconf-set-selections
/root/preseed"
+                               rm -f ${_TARGET}/root/preseed

-                               Chroot chroot "tasksel --debconf-apt-progress
--logstderr install ${TASK}"
+                               Chroot ${_TARGET} "tasksel --debconf-apt-
progress --logstderr install ${TASK}"
                        done
                        ;;
        esac
@@ -141,11 +142,11 @@ then
        Remove_package

        # Removing task list
-       rm -f chroot/root/chroot_tasks
+       rm -f ${_TARGET}/root/${_TARGET}_tasks

        # Saving cache
-       Save_cache cache/packages_chroot
+       Save_cache cache/packages_${_TARGET}

        # Creating stage file
-       Create_stagefile .stage/chroot_task-lists.${_PASS}
+       Create_stagefile .stage/${_TARGET}_task-lists.${_PASS}
 fi
diff --git a/scripts/build/lb_chroot_tmpfs b/scripts/build/lb_chroot_tmpfs
index 7a4e08e..3fca9ca 100755
--- a/scripts/build/lb_chroot_tmpfs
+++ b/scripts/build/lb_chroot_tmpfs
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} {install|remove} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_BUILD_WITH_TMPFS}" != "true" ]
diff --git a/scripts/build/lb_chroot_upstart b/scripts/build/lb_chroot_upstart
index 8f45633..fd5d3e4 100755
--- a/scripts/build/lb_chroot_upstart
+++ b/scripts/build/lb_chroot_upstart
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} {install|remove} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Requiring stage file
diff --git a/scripts/build/lb_clean b/scripts/build/lb_clean
index 4b10c65..7856aba 100755
--- a/scripts/build/lb_clean
+++ b/scripts/build/lb_clean
@@ -34,7 +34,7 @@ USAGE="${PROGRAM} [--all] [--cache] [--chroot] [--binary]
[--purge] [--remove] [
 #Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Avoid cases were users accidentally nuke their config/binary
diff --git a/scripts/build/lb_config b/scripts/build/lb_config
index d231a7d..cc8b6b3 100755
--- a/scripts/build/lb_config
+++ b/scripts/build/lb_config
@@ -145,7 +145,22 @@ USAGE="${PROGRAM}   [--apt apt|aptitude]\n\
 \t    [--exposed-root true|false]\n\
 \t    [--username NAME]\n\
 \t    [--verbose]\n\
-\t    [--win32-loader true|false]"
+\t    [--win32-loader true|false]\n
+\t    [--build-image]\n
+\t    [--no-build-source]\n
+\t    [--no-build-binary]\n
+\t    [--build-image]\n
+\t    [--image-fs-type ext2|ext3|ext4]\n
+\t    [--image-root-size MB]\n
+\t    [--image-fs-label LABEL]\n
+\t    [--image-packages PACKAGES]\n
+\t    [--image-tasksel TASKS]\n
+\t    [--ports-bootstrap foriegn|debootstrap]\n
+\t    [--ports-exclude PACKAGES]\n
+\t    [--ports-qemu-static PATH]\n
+\t    [--ports-arch ARCH]\n
+\t    [--skip-live-config]\n
+\t    [--hot-image]\n"

 Local_arguments ()
 {
@@ -168,7 +183,10 @@ Local_arguments ()
                net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-
mountoptions:,net-cow-path:,
                net-cow-server:,net-tarball:,swap-file-path:,swap-file-size
:,syslinux-theme:,
                username:,win32-loader:,source:,source-
images:,breakpoints,conffile:,debug,force,
-               help,ignore-system-defaults,quiet,usage,verbose,version"
+               help,ignore-system-defaults,quiet,usage,verbose,version,no-
build-source,no-build-binary,build-image,image-fs-type:,
+        image-root-size:,image-fs-label:,image-packages:,image-tasksel:,ports-
bootstrap:,ports-exclude:,ports-qemu-static:,
+        ports-arch:,skip-live-config,hot-image"
+
        # Remove spaces added by indentation
        LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')"
        ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name="${PROGRAM}"
--options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")"
@@ -194,7 +212,7 @@ Local_arguments ()
                                Echo "%s: This is live-build version %s" "${0}"
"${VERSION_DPKG:-${VERSION}}"

                                # Dump conffile contents
-                               Print_conffiles config/all config/common
config/bootstrap config/chroot config/binary config/source
+                               Print_conffiles config/all config/common
config/bootstrap config/chroot config/image config/source config/ports

                                # Dump contents of directories that contain
text files
                                for DIRECTORY in config/package-lists config
/task-lists config/chroot_apt config/chroot_local-patches config/chroot_local-
preseed config/binary_rootfs
@@ -780,6 +798,78 @@ Local_arguments ()
                                shift 2
                                ;;

+            --no-build-binary)
+                LB_BUILD_BINARY="false"
+                shift
+                ;;
+
+            --build-image)
+                LB_BUILD_IMAGE="true"
+                shift
+                ;;
+
+            --image-fs-type)
+                LB_IMAGE_FILESYSTEM="${2}"
+                shift 2
+                ;;
+
+            --image-root-size)
+                LB_IMAGE_ROOT_SIZE="${2}"
+                shift 2
+                ;;
+
+            --image-fs-label)
+                LB_IMAGE_FILESYSTEM_LABEL="${2}"
+                shift 2
+                ;;
+
+            --image-packages)
+                LB_IMAGE_PACKAGES="${2}"
+                shift 2
+                ;;
+
+            --image-tasksel)
+                LB_IMAGE_TASKSEL="${2}"
+                shift 2
+                ;;
+
+            --ports-arch)
+                LB_PORTS_ARCHITECTURES="${2}"
+                shift 2
+                ;;
+
+            --ports-bootstrap)
+                LB_PORTS_BOOTSTRAP="${2}"
+                shift 2
+                ;;
+
+            --ports-exclude)
+                LB_PORTS_BOOTSTRAP_EXCLUDE="${2}"
+                shift 2
+                ;;
+
+            --ports-qemu-static)
+                LB_PORTS_QEMU_STATIC="${2}"
+                shift 2
+                ;;
+
+            --skip-live-config)
+                LB_CHROOT_PASSES="install"
+                shift
+                ;;
+
+            --hot-image)
+                # This will produce a live-config-less image. In order to make
this
+                # image runnable, you will need to configured it via the
image_local-hooks and image_local-includes
+                LB_CHROOT_PASSES="install"
+                LB_BUILD_SOURCE="false"
+                LB_BUILD_BINARY="false"
+                LB_BUILD_IMAGE="true"
+                LB_INITSYSTEM="none"
+                LB_INITRAMFS="none"
+                shift
+                ;;
+
                        # other
                        --breakpoints)
                                _BREAKPOINTS="true"
@@ -857,7 +947,7 @@ then
 fi

 # Reading existing configuration
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports

 Local_arguments "${@}"

@@ -1176,6 +1266,10 @@ cat > config/chroot << EOF
 # (Default: ${LB_CHROOT_FILESYSTEM})
 LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM}"

+# \$LB_CHROOT_PASSES: passes for package and taks installation
+# (Default: ${LB_CHROOT_PASSES} )
+LB_CHROOT_PASSES="${LB_CHROOT_PASSES}"
+
 # \$LB_UNION_FILESYSTEM: set union filesystem
 # (Default: ${LB_UNION_FILESYSTEM})
 LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM}"
@@ -1242,6 +1336,10 @@ mkdir -p config/binary_syslinux
 cat > config/binary << EOF
 # config/binary - options for live-build(7), binary stage

+# \$LB_BUILD_BINARY: build binary file system
+# (Default: true)
+LB_BUILD_BINARY="${LB_BUILD_BINARY}"
+
 # \$LB_BINARY_FILESYSTEM: set image filesystem
 # (Default: ${LB_BINARY_FILESYSTEM})
 LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM}"
@@ -1388,6 +1486,10 @@ EOF
 cat > config/source << EOF
 # config/source - options for live-build(7), source stage

+# \$LB_BUILD_SOURCE: build source
+# (Default: ${LB_BUILD_SOURCE})
+LB_BUILD_SOURCE="${LB_BUILD_SOURCE}"
+
 # \$LB_SOURCE: set source option
 # (Default: ${LB_SOURCE})
 LB_SOURCE="${LB_SOURCE}"
@@ -1397,6 +1499,50 @@ LB_SOURCE="${LB_SOURCE}"
 LB_SOURCE_IMAGES="${LB_SOURCE_IMAGES}"
 EOF

+# Creating lb_image_* configruation
+cat > config/image << EOF
+# \$LB_BUILD_IMAGE: build file system image
+# (Default:  ${LB_BUILD_IMAGE})
+LB_BUILD_IMAGE="${LB_BUILD_IMAGE}"
+
+# \$LB_IMAGE_FILESYSTEM: file system type for label
+# (Default: ${LB_IMAGE_FILESYSTEM})
+LB_IMAGE_FILESYSTEM="${LB_IMAGE_FILESYSTEM}"
+
+# \$LB_IMAGE_FILESYSTEM_LABEL: file system label of image
+# (Default: ${LB_IMAGE_FILESYSTEM_LABEL})
+LB_IMAGE_FILESYSTEM_LABEL="${LB_IMAGE_FILESYSTEM_LABEL}"
+
+# \$LB_IMAGE_ROOT_SIZE: file system image size
+# (Default: ${LB_IMAGE_ROOT_SIZE})
+LB_IMAGE_ROOT_SIZE="${LB_IMAGE_ROOT_SIZE}"
+
+# \$LB_IMAGE_PACKAGES: additional packages to install into image
+# (Default: ${LB_IMAGE_PACKAGES})
+LB_IMAGE_PACKAGES="${LB_IMAGE_PACKAGES}"
+
+# \$LB_IMAGE_TASKSEL: additional tasks to install into image
+# (Default: ${LB_IMAGE_TASKSEL}"
+LB_IMAGE_TASKSEL="${LB_IMAGE_TASKSEL}"
+EOF
+
+# Create configuration for port bootraping
+cat > config/ports << EOF
+# \$LB_PORTS_ARCHITECTURES: architectures to build through foriegn
bootstraping
+#       most users will also want to set LB_PORTS_QEMU_STATIC as well
+# (Default: ${LB_PORTS_ARCHITECTURES})
+LB_PORTS_ARCHITECTURES="${LB_PORTS_ARCHITECTURES}"
+
+# \$LB_PORTS_BOOTSTRAP_EXCLUDE: which packages to exclude from bootstrapping
+# (Default: ${LB_PORTS_BOOTSTRAP_EXCLUDE})
+LB_PORTS_BOOTSTRAP_EXCLUDE="${LB_PORTS_BOOTSTRAP_EXCLUDE}"
+
+# \$LB_PORTS_QEMU_STATIC: location of qemu-*-static for foriegn bootstrapping
+#       if left blank, automatic detection will be attempted
+# (Default: ${LB_PORTS_QEMU_STATIC})
+LB_PORTS_QEMU_STATIC="${LB_PORTS_QEMU_STATIC}"
+EOF
+
 mkdir -p auto/functions
 mkdir -p auto/scripts

diff --git a/scripts/build/lb_source b/scripts/build/lb_source
index 61a3de2..1864b00 100755
--- a/scripts/build/lb_source
+++ b/scripts/build/lb_source
@@ -28,7 +28,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 #Require_stagefile
diff --git a/scripts/build/lb_source_checksums
b/scripts/build/lb_source_checksums
index 9864500..d1294ba 100755
--- a/scripts/build/lb_source_checksums
+++ b/scripts/build/lb_source_checksums
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_CHECKSUMS}" = "none" ] || [ "${LB_SOURCE}" != "true" ]
diff --git a/scripts/build/lb_source_debian b/scripts/build/lb_source_debian
index 7566155..e47bda8 100755
--- a/scripts/build/lb_source_debian
+++ b/scripts/build/lb_source_debian
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_SOURCE}" != "true" ]
diff --git a/scripts/build/lb_source_debian-live b/scripts/build
/lb_source_debian-live
index faa201a..e8cfee3 100755
--- a/scripts/build/lb_source_debian-live
+++ b/scripts/build/lb_source_debian-live
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_SOURCE}" != "true" ]
diff --git a/scripts/build/lb_source_disk b/scripts/build/lb_source_disk
index 3a93d24..c4a9bf0 100755
--- a/scripts/build/lb_source_disk
+++ b/scripts/build/lb_source_disk
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 case "${LB_SOURCE_IMAGES}" in
diff --git a/scripts/build/lb_source_iso b/scripts/build/lb_source_iso
index 4d1f6f5..c45bd32 100755
--- a/scripts/build/lb_source_iso
+++ b/scripts/build/lb_source_iso
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_SOURCE}" != "true" ]
diff --git a/scripts/build/lb_source_net b/scripts/build/lb_source_net
index fdd05c2..9742690 100755
--- a/scripts/build/lb_source_net
+++ b/scripts/build/lb_source_net
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_SOURCE}" != "true" ]
diff --git a/scripts/build/lb_source_tar b/scripts/build/lb_source_tar
index ef60510..2a4689b 100755
--- a/scripts/build/lb_source_tar
+++ b/scripts/build/lb_source_tar
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_SOURCE}" != "true" ]
diff --git a/scripts/build/lb_source_usb b/scripts/build/lb_source_usb
index 1ba7e44..8dd51bf 100755
--- a/scripts/build/lb_source_usb
+++ b/scripts/build/lb_source_usb
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_SOURCE}" != "true" ]
diff --git a/scripts/build/lb_source_virtual-hdd b/scripts/build
/lb_source_virtual-hdd
index 0f53573..01f966f 100755
--- a/scripts/build/lb_source_virtual-hdd
+++ b/scripts/build/lb_source_virtual-hdd
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 if [ "${LB_SOURCE}" != "true" ]
diff --git a/scripts/build/lb_testroot b/scripts/build/lb_testroot
index 2920b9b..fc02350 100755
--- a/scripts/build/lb_testroot
+++ b/scripts/build/lb_testroot
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
 Arguments "${@}"

 # Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot
config/binary config/source
+Read_conffiles config/all config/common config/bootstrap config/chroot
config/image config/source config/ports
 Set_defaults

 # Checking user account
--
1.7.5.4



-- System Information:
Debian Release: wheezy/sid
  APT prefers oneiric-updates
  APT policy: (500, 'oneiric-updates'), (500, 'oneiric-security'), (500, 'oneiric'), (100, 'oneiric-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-11-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Tue, 27 Sep 2011 20:39:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Howard <ben.howard@canonical.com>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Tue, 27 Sep 2011 20:39:05 GMT) Full text and rfc822 format available.

Message #10 received at 643585@bugs.debian.org (full text, mbox):

From: Ben Howard <ben.howard@canonical.com>
To: 643585@bugs.debian.org
Subject: Bug 643585
Date: Tue, 27 Sep 2011 14:34:52 -0600
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My apologies for not including an explanation...

Starting with Oneiric Ocelot (11.10) Beta2, Canonical started to build
the cloud images using live-build. The above patch includes the changes
that I made in order to get live-build to generate images suitable for
building cloud-images.

I would appreciate any feedback that you might have regarding these
patches and would be delighted if the patch set was accepted upstream.

~Ben
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJOgjNsAAoJEETWil5UBqhmMHMQALZ9LjFzKK/jHnEqIlnUWuC8
yboeqGpUgT96UMRWe4aemw/PH0Q6Mxkj+RmkP+9ZXhgOk++0QL8kcWscfyFzuOO5
U/XyihVDnsbel5Domu78FxcO6KIXKtpiFPTBZJkNmjVLSe+oEVOsKffO2U+RaZ6V
3BYJSc1/o52O/mJMfqkHEMj3b0OQolAORlDN8Lw+9hhQLAcxqhB18quvHK0yDdQB
3ic8IPh5Z9UkKedXHgkIBq11u5CnurBRqy2WTQ9UDQoyzosSDDv6Y2d0OjDOW5dI
h3+8v3MpS7w8VkJ73RGhA5Xdp0EclBIpQ6lGZ1ioNji5pkcBwBvf3dGmpOkGcIMJ
5pg7HdL9d+YrqDE86dX6pwBxbcw857q/oHCYR7BiHmPiHc68dGjXO31yqYS6rgJf
TWokb6EnE5t+5z4ijKWsGxTQhiXdtybBg4/nBXGmWV2MwMjhrsDM+mYcSX/MfdL5
yHBeMuUCKAiirz1rIYvY6n9x2i/ezr/ti0q8und4iyxAV5Zh6yTJX0UE3k3xlqOK
48JitxqY5qbCZ/7bYSuBoojR3PZ3dc522KIBHmz8LYUrMYdi2mMnJfMvf3r+2/Ps
2F0PvUz1UK2rRQAj7gXTI51aKEBFrVLpn6sHwXiRKMKHoBPmkNDwnwtMEiUEc/YB
jidCjtS4+HVn+h/al+f1
=q6eT
-----END PGP SIGNATURE-----





Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Tue, 27 Sep 2011 20:51:19 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Tue, 27 Sep 2011 20:51:19 GMT) Full text and rfc822 format available.

Message #15 received at 643585@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: Ben Howard <ben.howard@canonical.com>
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Tue, 27 Sep 2011 22:50:29 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/27/2011 10:34 PM, Ben Howard wrote:
> I would appreciate any feedback that you might have regarding these 
> patches and would be delighted if the patch set was accepted
> upstream.

sure, more than welcome. can you attach patches to the bug report,
rebased on debian-next branch of the git repository?

- -- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEUEARECAAYFAk6CNxUACgkQ+C5cwEsrK561cwCYlzPPDZQgLnALXc2z6YZno59C
TACgygArcqzV7059CjmiO9C/0LsPsyI=
=5A0N
-----END PGP SIGNATURE-----




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Tue, 27 Sep 2011 20:54:10 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Howard <ben.howard@canonical.com>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Tue, 27 Sep 2011 20:54:10 GMT) Full text and rfc822 format available.

Message #20 received at 643585@bugs.debian.org (full text, mbox):

From: Ben Howard <ben.howard@canonical.com>
To: daniel.baumann@progress-technologies.net
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Tue, 27 Sep 2011 14:52:06 -0600
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sure thing, I'll get that done as soon as I can.
~Ben

On 09/27/2011 02:50 PM, Daniel Baumann wrote:
> On 09/27/2011 10:34 PM, Ben Howard wrote:
> > I would appreciate any feedback that you might have regarding these
> > patches and would be delighted if the patch set was accepted
> > upstream.
>
> sure, more than welcome. can you attach patches to the bug report,
> rebased on debian-next branch of the git repository?
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJOgjd2AAoJEETWil5UBqhmoR8QAMRAjdzR9g/71RMYBTwVpmUa
nQHK4CyLHJ3CZiZa9dzBQky/DaSpm6WO7uS2A4sdgWSoKQHqQAQC2A/dS0Tqlejr
RHXn4Ro903FjnKrIucAJkgvquQuyys1aKbok84auBNsTffg0skVSwrEYHgiLlV0Y
/vQKqa2XZ9epYg0yfZaiYr+gHISS4zgOjx894F82xr4SssX1inpB3KmSr9vGtemG
A2+M+nFyVTGSb4U/t9KTpcFeyIVASxE+TVHC3hlp+akD+YirskCJdNGdc+GR8Nus
/y1T6STbM73MYEfvZhniU6i1JiiOrei+SH4FOjKBjclM1DYEMnX26GVppCUz5Fad
plFm+tReD+8JsfYZSqgGUS1nZEYkXEiJNqyt5vsa6yo8emBs6IAprt9mqYJGkP+U
LmNRPEDKRlnPta43xK1YqfZTPVsD0FHQ9HqlmPqYJVTxf6r2FTqcAs/1xv8jZpdd
LbQE8wNgji0XKoTw/BWg9tQvvqQWzqZKdq20DUf6JBrd70D9lsrZpxHZOhZfBscn
xRNZ8F3p3Rc2q9GcEUTBb629jifl5mwbfLE2kGIgNI3yubmYQIldnp7um4XtHLEF
iR2C5fpC+seODsSfkvM9nsyuj4WXyuF53RTH+WTxgF5dGepdXVzdZGNxhks2tD5g
sdgYS7o8Dl5B2smatkC/
=nzu4
-----END PGP SIGNATURE-----





Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Tue, 27 Sep 2011 21:24:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Howard <ben.howard@canonical.com>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Tue, 27 Sep 2011 21:24:04 GMT) Full text and rfc822 format available.

Message #25 received at 643585@bugs.debian.org (full text, mbox):

From: Ben Howard <ben.howard@canonical.com>
To: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Tue, 27 Sep 2011 15:21:40 -0600
[Message part 1 (text/plain, inline)]
Attaching patch based on debian-next.
~Ben
[0001-Merge-of-Ubuntu-Cloud-Images-patch-set.patch (text/x-patch, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Tue, 27 Sep 2011 22:57:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Howard <ben.howard@canonical.com>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Tue, 27 Sep 2011 22:57:03 GMT) Full text and rfc822 format available.

Message #30 received at 643585@bugs.debian.org (full text, mbox):

From: Ben Howard <ben.howard@canonical.com>
To: 643585@bugs.debian.org
Subject: Corrected patchf for Bug 643585
Date: Tue, 27 Sep 2011 16:55:53 -0600
[Message part 1 (text/plain, inline)]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My prior submitted patch was incomplete due to a mangled git command.
Please disregard the previous patches and base off the one attached. ~Ben
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJOglR5AAoJEETWil5UBqhmrWEQAMSwToJlQFJFf806AtS+7T1i
1A7142ZLQLFu8r2WDCW1tOoJBAomd/b2hG96GYSEXJcvMroLs+SlVK0xT2IKzY6W
ZcKTPAitN1BYx9vUv/FT01A4h/DD4hO/Gix8HlNef77nrYAA3Q7/imaLuluZqOhz
ZZzi3HA2+Sr0dEm26u7LF3w20aY5bdh/PX4d1V6pWPiqB9nGIo1/Y1RR/pep/1R7
K5jI/Es+8TUDm+AKo0KUKkueQwtt3nM3Xen9JJVnNnFRmEjfuAjH6FZEN+DyjrDq
o/K6VR7zRfAQf+x9bfT+06O4Fz9kyzWYiVNhK7ppi6TKVNm0D6wTQvjf2t1tuuu0
NzI1a9ur/nPgXGBZNisbmFNpE6XECHEP469T84lsruoAvFQzpcgeQE0c5u5Qz7Ih
0tIdRuTYL+IqyTBC7E4FKAfkl1dSUjro9y8wIBnKv+W/hpE9HWx2ujoukAwtU/3J
JCs4N63qKGJsqfY6/+ZMzKBChYK+0XZTRODAjKgObOhg69135XOyYZjGRlcnOtBS
+IZ2E6yeFQEdY2jvP1+nYvjoI/9OIygCmZM1wgDwfIeArrOy8fxPukg35GzZ2SCF
t32YEL3GVXviVXwaacV4OPbgxROMqWswjjoevOJV406AfPwz8R8XaDGwxH4fn0oi
8ZL9ugll0IT+YM0Rt0TI
=lZSG
-----END PGP SIGNATURE-----

[0001-Ubuntu-Cloud-images-patch-supporting-image-building-.patch (text/x-patch, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Wed, 28 Sep 2011 08:45:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Wed, 28 Sep 2011 08:45:04 GMT) Full text and rfc822 format available.

Message #35 received at 643585@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: Ben Howard <ben.howard@canonical.com>
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Wed, 28 Sep 2011 10:43:02 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

first some general things..

  * please clean your changes from useless whitespaces at EOL and EOF.

  * please use proper indenting and coding style to match the rest of
    live-build, see
    http://live.debian.net/manual/en/html/coding-style.html; lb is not
    100% consistent everywhere, but almost)

  * please keep logical seperated things in seperated patches,
    e.g.

- -127.0.1.1»·····debian
+127.0.1.1»·····${LB_MODE}

    in the place where /etc/hosts is created, is perfectly fine,
    but has nothing to do with adding ubuntu cloud images and should
    be a seperate commit on it's own. there are a couple of other things
    like that that should be applied individually.

  * if you add new features/behaviour to existing helpers, don't break
    old behaviour. e.g.

- -   ls config/task-lists/*.list.chroot > /dev/null 2>&1 || \
- -   ls config/task-lists/*.list.chroot_${_PASS} > /dev/null 2>&1
+   ls config/task-lists/*.list.${_TARGET} > /dev/null 2>&1 || \
+   ls config/task-lists/*.list.${_TARGET}_${_PASS} > /dev/null 2>&1

     if we would do that, we would not just break existing configs
     (which sometimes is inevitable and ok-ish for development versions
     such as lb 3.x) but it would also mean, that now everyone has to
     define user overly complicated task list names for the default
     (!= your target thing) case.

     a proper way to do this is to do look for the additional files
     in addition, and still respect the other ones.

  * why do you add a new stage 'image' in the first place? producing
    ubuntu cloud images just means that's another binary image time
    alongside iso and hdd, not a whole new stage within live-build. in
    fact, i don't see why this cannot be done on top on hdd anyways.

  * do you happen to have a git tree online? it would probably be
    more convenient for both of us :)

i think it would be best if you do above things, then we apply all the
non-ubuntu-cloud-image related things (the misc fixes like the
/etc/hosts one), and then the big one for adding the ubuntu-cloud-images
thing.

Regards,
Daniel

- -- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6C3hYACgkQ+C5cwEsrK56ZhACdGP02ElBHePUuVGfOVE3CIl/M
/CgAoMQs5p5ChMX5qSQ8Wq8+d6LIInZp
=tv5x
-----END PGP SIGNATURE-----




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Wed, 28 Sep 2011 14:24:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Howard <ben.howard@canonical.com>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Wed, 28 Sep 2011 14:24:07 GMT) Full text and rfc822 format available.

Message #40 received at 643585@bugs.debian.org (full text, mbox):

From: Ben Howard <ben.howard@canonical.com>
To: debian-live@lists.debian.org, 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Wed, 28 Sep 2011 08:22:44 -0600
[Message part 1 (text/plain, inline)]
Thank you for the feedback. Let's go ahead and drop this bug for the
time being while I make the changes. Once I get the feedback
implemented, I'll re-raise a bug.

~Ben

On 09/28/2011 02:43 AM, Daniel Baumann wrote:
> first some general things..
>
> * please clean your changes from useless whitespaces at EOL and EOF.
>
> * please use proper indenting and coding style to match the rest of
> live-build, see
> http://live.debian.net/manual/en/html/coding-style.html; lb is not
> 100% consistent everywhere, but almost)
>
> * please keep logical seperated things in seperated patches,
> e.g.
>
> -127.0.1.1»·····debian
> +127.0.1.1»·····${LB_MODE}
>
> in the place where /etc/hosts is created, is perfectly fine,
> but has nothing to do with adding ubuntu cloud images and should
> be a seperate commit on it's own. there are a couple of other things
> like that that should be applied individually.
>
> * if you add new features/behaviour to existing helpers, don't break
> old behaviour. e.g.
>
> - ls config/task-lists/*.list.chroot > /dev/null 2>&1 || \
> - ls config/task-lists/*.list.chroot_${_PASS} > /dev/null 2>&1
> + ls config/task-lists/*.list.${_TARGET} > /dev/null 2>&1 || \
> + ls config/task-lists/*.list.${_TARGET}_${_PASS} > /dev/null 2>&1
>
> if we would do that, we would not just break existing configs
> (which sometimes is inevitable and ok-ish for development versions
> such as lb 3.x) but it would also mean, that now everyone has to
> define user overly complicated task list names for the default
> (!= your target thing) case.
>
> a proper way to do this is to do look for the additional files
> in addition, and still respect the other ones.
>
> * why do you add a new stage 'image' in the first place? producing
> ubuntu cloud images just means that's another binary image time
> alongside iso and hdd, not a whole new stage within live-build. in
> fact, i don't see why this cannot be done on top on hdd anyways.
>
> * do you happen to have a git tree online? it would probably be
> more convenient for both of us :)
>
> i think it would be best if you do above things, then we apply all the
> non-ubuntu-cloud-image related things (the misc fixes like the
> /etc/hosts one), and then the big one for adding the ubuntu-cloud-images
> thing.
>
> Regards,
> Daniel
>
>
>
>

-- 


Ben Howard
ben.howard@canonical.com
Canonical USA, Inc
GPG ID 0x5406A866



[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Wed, 28 Sep 2011 16:39:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Wed, 28 Sep 2011 16:39:05 GMT) Full text and rfc822 format available.

Message #45 received at 643585@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: Ben Howard <ben.howard@canonical.com>
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Wed, 28 Sep 2011 18:37:31 +0200
retitle 643585 integrate ubuntu cloud-provider support
severity 643585 normal
thanks

On 09/28/2011 04:22 PM, Ben Howard wrote:
> Thank you for the feedback. Let's go ahead and drop this bug for the
> time being while I make the changes.

i wouldn't mind keeping it open, so we can use it to track anything else 
related with it. unless...

> Once I get the feedback implemented, I'll re-raise a bug.

your ETA is like 6 months or so, then i'd say it would be better to 
indeed close it, otherwise let's keep it open.

Regards,
Daniel

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/




Changed Bug title to 'integrate ubuntu cloud-provider support' from 'live-build: [patch] Add support for building file system images suitable for cloud-provider use and cross-building ARM on Intel' Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Wed, 28 Sep 2011 16:39:06 GMT) Full text and rfc822 format available.

Severity set to 'normal' from 'wishlist' Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Wed, 28 Sep 2011 16:39:07 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Wed, 28 Sep 2011 20:18:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Howard <ben.howard@canonical.com>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Wed, 28 Sep 2011 20:18:06 GMT) Full text and rfc822 format available.

Message #54 received at 643585@bugs.debian.org (full text, mbox):

From: Ben Howard <ben.howard@canonical.com>
To: daniel.baumann@progress-technologies.net
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Wed, 28 Sep 2011 14:14:53 -0600
My best guess on the ETA is EOW or early next week for a new set of
patches. I'll resubmit the new set of patches to the old bug.

~Ben

On 09/28/2011 10:37 AM, Daniel Baumann wrote:
> retitle 643585 integrate ubuntu cloud-provider support
> severity 643585 normal
> thanks
>
> On 09/28/2011 04:22 PM, Ben Howard wrote:
>> Thank you for the feedback. Let's go ahead and drop this bug for the
>> time being while I make the changes.
>
> i wouldn't mind keeping it open, so we can use it to track anything
> else related with it. unless...
>
>> Once I get the feedback implemented, I'll re-raise a bug.
>
> your ETA is like 6 months or so, then i'd say it would be better to
> indeed close it, otherwise let's keep it open.
>
> Regards,
> Daniel
>

-- 


Ben Howard
ben.howard@canonical.com
Canonical USA, Inc
GPG ID 0x5406A866







Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Wed, 28 Sep 2011 20:36:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Wed, 28 Sep 2011 20:36:03 GMT) Full text and rfc822 format available.

Message #59 received at 643585@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: Ben Howard <ben.howard@canonical.com>
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Wed, 28 Sep 2011 22:32:30 +0200
On 09/28/2011 10:14 PM, Ben Howard wrote:
> My best guess on the ETA is EOW or early next week for a new set of
> patches. I'll resubmit the new set of patches to the old bug.

sounds good, thanks.

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Thu, 29 Sep 2011 21:24:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Howard <ben.howard@canonical.com>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Thu, 29 Sep 2011 21:24:03 GMT) Full text and rfc822 format available.

Message #64 received at 643585@bugs.debian.org (full text, mbox):

From: Ben Howard <ben.howard@canonical.com>
To: daniel.baumann@progress-technologies.net
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Thu, 29 Sep 2011 15:21:21 -0600
[Message part 1 (text/plain, inline)]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Daniel,

After taking your feedback, here is a set of 5 patches that
significantly reduce the line count and provide the needed functionality
for building cloud images (562 lines in the diff versus the ~2.5K
previous patches). The primary need for cloud images is that ability to
produce a "warm" file system suitable for running on Amazon AWS or Open
Stack.

Git Repo: https://github.com/utlemming/ubuntu-live-build

0001-Added-Ubuntu-Cloud-package-lists.patch:
      - Adds the Ubuntu Cloud package list definitions
      - Package lists are the official packages for the Ubuntu Cloud
images compatible with Maverick and later

0002-Fixed-rootfs-chroot-and-added-fs-label-support.patch
      - Fixed an issue where mkfs.ext? failed due to missing mtab while
formating file system in chroot
      - Added file system label support to rootfs for ext? file systems
      - Added /etc/fstab based on labels (allow rootfs to be used
independent of binary wrapper)

0003-Added-lb_binary_image-to-emit-standalone-rootfs-imag.patch:
      - Adds lb_binary_image to emit the chroot rootfs a file system
image named <LABEL>.<FS TYPE>
      - Provides the ability to build images suitable for running
      - For uses where the raw file system is needed
    
0004-Enablement-for-foreign-bootstrap-via-qemu-static.patch:
      Probably the most controversial of my patches
      - Adds foreign bootstrapping ability via "qemu-<ARCH>-static"
     
0005-Set-default-armel-linux-flavour-for-Ubuntu.patch:
      - Set default armel kernel flavour for Ubuntu to omap

As a side note, I've done a bit of work on the generation of VMDK and
QCOW2 images. If there is interest in supporting more complicated warm
file systems/images, I can do some work on porting those features. The
concern (and perhaps it is wrong) is that live-build is focused on
building bootable systems that use live-config, where cloud images
generally do not have nor need live-config.

~Ben

- -- 


Ben Howard
ben.howard@canonical.com
Canonical USA, Inc
GPG ID 0x5406A866


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJOhOFQAAoJEETWil5UBqhmwYgP/3+/JY8hmxU65nJ0iBUeheiT
z/9Tt9TRaCw74VKn7Z3bLxWXOwFhDdyZqGdW6S8TTo/YBuSR8jDCMARQXWPgHacv
u6i5AcRvoSJXKEaWOGDg/3ce8B+02g0s57F3/CMS3yqosJA74WMDk5SEqu8eHvOR
l5CG0979njah9AUIPt3h/dnAwx3fDVWQcZa6n4/tgwcij6YiLzs2FMD4PJBSf9G4
SmdXc4DyiR4E96zDxBt/IawPIQVPLQK6rOXRd/v4w2BHGJIqyGpeYegYGbgtDo19
u6LQydgZcq9LuCWIz4QILesHvx0zfgvzp8EqxaI9r6z3XD68HyRVur+CpWqsPX7J
n/TMUm1Lxz0ewZbYExY5P1tNNpHVGMC8hdBSdfDTEiuTayy23KSRTvsLb8irr3he
g0dYsiLFEmAYXtSrs4MwqH6dnFXtmV2HExnJqHEfuidEJZp/Babplhbm1Ij8vHkF
XKLeRcki8Xnp1ukmprmnrkUxESH8wkP2C6XeRvP/6LuZ+lKxGx01XSaolLrnVyN1
ocMHkXbumYJjJinvHwVLlyMdzs69VRqy1MEL+KLL6Qi7f9WrFdYTA6uv+LHRNczL
Z2muNth0V0NsylAlXNWSPJIVHH9IOM7XsxFECuALVw10XNs2mhcAX2d1EF8grKal
N5y+BVzRi0EXxuDmAuqS
=1tKy
-----END PGP SIGNATURE-----

[0001-Added-Ubuntu-Cloud-package-lists.patch (text/x-patch, attachment)]
[0002-Fixed-rootfs-chroot-and-added-fs-label-support.patch (text/x-patch, attachment)]
[0003-Added-lb_binary_image-to-emit-standalone-rootfs-imag.patch (text/x-patch, attachment)]
[0004-Enablement-for-foreign-bootstrap-via-qemu-static.patch (text/x-patch, attachment)]
[0005-Set-default-armel-linux-flavour-for-Ubuntu.patch (text/x-patch, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Thu, 29 Sep 2011 22:45:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Thu, 29 Sep 2011 22:45:03 GMT) Full text and rfc822 format available.

Message #69 received at 643585@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: Ben Howard <ben.howard@canonical.com>
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Fri, 30 Sep 2011 00:43:35 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/29/2011 11:21 PM, Ben Howard wrote:
> 0001-Added-Ubuntu-Cloud-package-lists.patch: - Adds the Ubuntu Cloud
> package list definitions - Package lists are the official packages
> for the Ubuntu Cloud images compatible with Maverick and later

  * contains useless whitespaces at EOL

  * please sort the lists: first tasks (stronger set first, then
    weaker; means, e.g. standard before server), second the packages
    alphabetically. and it probably would make it more readable if you
    group them (means, between tasks and packages an empty line) and
    add a comment '# Tasks' and '# Packages' on top of the group.

  * please include the standard blurb at the beginning common to all
    package lists.

  * please deduplicate 'ubuntu-cloud' with the minimal package list,
    using '#<include <foo>' mechanism.

  * please deduplicate 'ubuntu-cloud-desktop' with the 'ubuntu-cloud'
    one, using '#<include <foo>' mechanism.

otherwise good.

> 0002-Fixed-rootfs-chroot-and-added-fs-label-support.patch

this patch is too big; let me reiterate, any patch should be *one thing*
only. the rational should be: every individual commit should be
revertable on it's own.

> - Fixed an issue where mkfs.ext? failed due to missing mtab while 
> formating file system in chroot

you're creating an /etc/mtab->/proc/mounts symlink, if /etc/mtab is not
already existing. which is fine, but when do you revert that change
again? the auxiliary chroot should not be tainted (gives some problems
for ensuring its sanity over multiple builds and makes testing for
regressions hard).

> - Added file system label support to rootfs for ext? file systems

but lb already supports using LB_HDD_LABEL.

> - Added /etc/fstab based on labels (allow rootfs to be used 
> independent of binary wrapper)

that changes does two things: first, it creates an fstab per se, which
is not desireable in the live case. so, we need a 'generic' flag first
that we can call lb with that defines if the resulting system is a live
system or not. i'll add '--system live|normal' for that in git in a
moment, so you can check for LB_SYSTEM=normal and only then create the
fstab.

second, your sample fstab looks strange:

  * you're adding an entry for /proc, but /proc (like /sys and others)
    is automatically mounted through sysvinit anyway, and does not need
    nor should be added to the fstab.

    this might or might not be true for upstart, if it's not true for
    upstart, then that entry should conditionally be added upon
    LB_INITSYSTEM=upstart only.

  * you're adding a write_fstab();, please remember coding style:

    - function names start with capital letter

    - intending is off

    - use 'cat > FILE << EOF' instead of 'cat << EOF > FILE',
      look at other uses of 'cat ... EOF' with respect to
      empty line seperators before and after.

  * the 'Generated by live-build' comment uselessly clutters the file.

  * why LABEL and not UUID? why '0 0' instead of '0 1'?

  * you imported a typo '-FF' in one of the mkfs calls.

otherwise good.

> 0003-Added-lb_binary_image-to-emit-standalone-rootfs-imag.patch:

too big, please break it into smaller patches.

> - Adds lb_binary_image to emit the chroot rootfs a file system image
> named <LABEL>.<FS TYPE> - Provides the ability to build images
> suitable for running - For uses where the raw file system is needed

this should go through the hdd image type (see note at the end).

> 0004-Enablement-for-foreign-bootstrap-via-qemu-static.patch: Probably
> the most controversial of my patches - Adds foreign bootstrapping
> ability via "qemu-<ARCH>-static"

  * useless whitespace at EOL

  * typo in comment: s/foriegn/foreign/

  * unclean diff, has spurious changes in it due to mixed up
    indenting of existing code.

  * inconsistent indenting of newly added code
    (the 'Run appropriate bootstrap [...' block)

  * you're adding a new config/ports file, i'd use the
    existing config/bootstrap for that. after all, this all is
    about bootstrapping.

i don't really understand yet the whole foreign bootstrapping thing with
qemu, so symantically i can't yet say much, i'll have to actually
try and run the code at some later point.

> 0005-Set-default-armel-linux-flavour-for-Ubuntu.patch: - Set default
> armel kernel flavour for Ubuntu to omap

applied, thanks, with slightly modified commit message though: commit
messages are supposed to be full and proper sentences, means, they end
with a stop. and we're tryting to always use the '-ing' form, like
'Fixing/Correcting/Adding $whatever." instead of 'Fix Correct/Add
$whatever.'.

> If there is interest in supporting more complicated warm file
> systems/images, I can do some work on porting those features.

that would be awesome, i was meaning to get to do that myself during the
last ~1.5 months, but never got arround to it (see 'Providing official
virtualization images' thread on debian-devel end of july 2011).

> The concern (and perhaps it is wrong) is that live-build is focused
> on building bootable systems that use live-config, where cloud
> images generally do not have nor need live-config.

live-build is intended to build *any* system image, regardless if it's a
live one or not, live-build just doesn't announce itself that way (yet).


General note about binary images types again:

The idea of live-build is to generate different image types, such as iso
images, hdd images, or netboot tarballs.

images like you want to do are hdd images, without partition table, and
without live packages installed (the latter being addressed through
- --system live|normal). so, rather than to add an other image type, code
wise, the existing hdd image type should be extended to make yours possible.

therefore, like i said in one of my mails before, we should handle such
a new 'hdd-raw' image type as a sub-type to the hdd image type, just as
iso-hybrid to iso is handled atm. please have a look at lb_binary_iso.

now, you'll say that you want to generate multiple binary images in one
run. well, we want that too, we just didn't got arround to it (as you
see, the resp. parameter is already in the plural form: --binary-images).

the idea is that once we have support for multiple binary images types,
you can e.g. do: lb config -b 'iso iso-hybrid hdd hdd-raw net' and
you'll get 5 binary images as output, a regular iso image, a isohybrid
image, a hdd image with partitions, a raw hdd image without
partitioning, and a netboot tarball.

keeping this stuff together that way ensure that we can keep the build
time as minimal as possible by eliminating double work and not copying
stuff multiple times over and over again.

hope that makes it somewhat more clear.

Regards,
Daniel

- -- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6E9JcACgkQ+C5cwEsrK54MEwCghEmQ4JzWZU2vzW060l+u+vzy
x3gAoMBsMdURY1eEmmgrqIfkDeCpgM6T
=jW9I
-----END PGP SIGNATURE-----




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Fri, 30 Sep 2011 23:12:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Howard <ben.howard@canonical.com>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Fri, 30 Sep 2011 23:12:03 GMT) Full text and rfc822 format available.

Message #74 received at 643585@bugs.debian.org (full text, mbox):

From: Ben Howard <ben.howard@canonical.com>
To: 643585@bugs.debian.org, daniel.baumann@progress-technologies.net
Subject: Bug 643585
Date: Fri, 30 Sep 2011 17:08:36 -0600
[Message part 1 (text/plain, inline)]
Daniel, thank you kindly for your patience. It is much appreciated.

Here is a smaller set of patches today, drawn from your feedback.
git://github.com/utlemming/lb.git

0001-Adding-Ubuntu-Cloud-Images-package-lists.patch:
    - Adds Ubuntu Cloud images packages list

0002-Adding-check-for-valid-mtab-during-chrooted-binary-r.patch:
    - Installs and reverts /etc/mtab if missing

0003-Adding-foreign-bootstrap-via-qemu-for-cross-arch-bui.patch
    - Adds LB_BOOTSTRAP_QEMU_*

The use-case for the foreign bootstrap via qemu is to build ARMEL images
on non-ARM hardware. While it is not exactly the fastest thing in the
world, it allows for some flexibility (i.e. not having to procure
separate hardware for separate builds). My use case is building ARMEL
images on a x86_64 cloud instance.  In the last email you mentioned
trying it out. Should you feel so inclined, here is an example (albeit
useless) lb_config command.

Tested using lb_config commands of:
lb_config --package-lists ubuntu-cloud --mode ubuntu --initramfs none
--initsystem none --bootloader none -d oneiric -b rootfs
--build-with-chroot true  --chroot-filesystem ext3 -a armel
--bootstrap-qemu-arch armel --bootstrap-qemu-static /usr/bin/qemu-arm-static

Thanks,
Ben
[0001-Adding-Ubuntu-Cloud-images-packages-lists.patch (text/x-patch, attachment)]
[0002-Adding-check-for-missing-mtab-during-chrooted-binary.patch (text/x-patch, attachment)]
[0003-Adding-foreign-bootstrap-via-qemu-for-cross-arch-bui.patch (text/x-patch, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Sat, 01 Oct 2011 06:15:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Sat, 01 Oct 2011 06:15:03 GMT) Full text and rfc822 format available.

Message #79 received at 643585@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: Ben Howard <ben.howard@canonical.com>
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Sat, 01 Oct 2011 08:10:24 +0200
On 10/01/2011 01:08 AM, Ben Howard wrote:
> 0001-Adding-Ubuntu-Cloud-Images-package-lists.patch:
>     - Adds Ubuntu Cloud images packages list

i'm sorry..

  * in ubuntu-cloud, you have a useless whitespace after landscape,
    plus a useless empty line at the end of the file.

    what editor do you use, and don't you highlight (or strip) those?

  * the comment in at the top of the file is supposed to refer to the
    actual file, not to the 'standard'.list where you probably copied
    it from.

  * #include <ubunut-cloud> looks like a typo and wouldn't work.

  * ubuntu-minimal is not a task, but a package, therefore you should
    list it in the packages section, not the task one in ubuntu-cloud.

otherwise good.

> 0002-Adding-check-for-valid-mtab-during-chrooted-binary-r.patch:
>     - Installs and reverts /etc/mtab if missing


applied, thanks.

> 0003-Adding-foreign-bootstrap-via-qemu-for-cross-arch-bui.patch
>     - Adds LB_BOOTSTRAP_QEMU_*

looks mostly ok, i'll try it out (not sure i'll get arround to it during
the weekend as i'm mostly away, at latest during monday) and then let
you know.

> Tested using lb_config commands of:
> lb_config --package-lists ubuntu-cloud --mode ubuntu --initramfs none
> --initsystem none --bootloader none -d oneiric -b rootfs
> --build-with-chroot true  --chroot-filesystem ext3 -a armel
> --bootstrap-qemu-arch armel --bootstrap-qemu-static /usr/bin/qemu-arm-static

jftr: with lb >= 3.0~a34-1, the above lb config command can be reduced to:

  lb_config --package-lists ubuntu-cloud --mode ubuntu --system normal
  --bootloader none -b rootfs --chroot-filesystem ext3 -a armel
  --bootstrap-qemu-arch armel --bootstrap-qemu-static /usr/bin/qemu-
  arm-static

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Tue, 04 Oct 2011 22:36:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Howard <ben.howard@canonical.com>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Tue, 04 Oct 2011 22:36:03 GMT) Full text and rfc822 format available.

Message #84 received at 643585@bugs.debian.org (full text, mbox):

From: Ben Howard <ben.howard@canonical.com>
To: daniel.baumann@progress-technologies.net
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Tue, 04 Oct 2011 16:32:32 -0600
[Message part 1 (text/plain, inline)]
Daniel,

I've fixed the git tree (rebased) to address the packages list; you
should you re-fetch the tree.

I think the white space fun was caused by bad options in my .vimrc.
Sorry for the back and forth on that. Out of courosity,

I'm just going to submit the 
0001-Adding-Ubuntu-Cloud-Images-package-lists.patch today. 

I'm going to spend a bit of time thinking about the binary-hdd-raw and
binary-hdd-virt (to support qcow and vmdk's).

~Ben


On 10/01/2011 12:10 AM, Daniel Baumann wrote:
> On 10/01/2011 01:08 AM, Ben Howard wrote:
>> 0001-Adding-Ubuntu-Cloud-Images-package-lists.patch:
>>     - Adds Ubuntu Cloud images packages list
> i'm sorry..
>
>   * in ubuntu-cloud, you have a useless whitespace after landscape,
>     plus a useless empty line at the end of the file.
>
>     what editor do you use, and don't you highlight (or strip) those?
>
>   * the comment in at the top of the file is supposed to refer to the
>     actual file, not to the 'standard'.list where you probably copied
>     it from.
>
>   * #include <ubunut-cloud> looks like a typo and wouldn't work.
>
>   * ubuntu-minimal is not a task, but a package, therefore you should
>     list it in the packages section, not the task one in ubuntu-cloud.
>
> otherwise good.
>
>> 0002-Adding-check-for-valid-mtab-during-chrooted-binary-r.patch:
>>     - Installs and reverts /etc/mtab if missing
>
> applied, thanks.
>
>> 0003-Adding-foreign-bootstrap-via-qemu-for-cross-arch-bui.patch
>>     - Adds LB_BOOTSTRAP_QEMU_*
> looks mostly ok, i'll try it out (not sure i'll get arround to it during
> the weekend as i'm mostly away, at latest during monday) and then let
> you know.
>
>> Tested using lb_config commands of:
>> lb_config --package-lists ubuntu-cloud --mode ubuntu --initramfs none
>> --initsystem none --bootloader none -d oneiric -b rootfs
>> --build-with-chroot true  --chroot-filesystem ext3 -a armel
>> --bootstrap-qemu-arch armel --bootstrap-qemu-static /usr/bin/qemu-arm-static
> jftr: with lb >= 3.0~a34-1, the above lb config command can be reduced to:
>
>   lb_config --package-lists ubuntu-cloud --mode ubuntu --system normal
>   --bootloader none -b rootfs --chroot-filesystem ext3 -a armel
>   --bootstrap-qemu-arch armel --bootstrap-qemu-static /usr/bin/qemu-
>   arm-static
>

-- 


Ben Howard
ben.howard@canonical.com
Canonical USA, Inc
GPG ID 0x5406A866



[0001-Adding-Ubuntu-Cloud-images-packages-lists.patch (text/x-patch, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#643585; Package live-build. (Wed, 05 Oct 2011 05:51:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Wed, 05 Oct 2011 05:51:03 GMT) Full text and rfc822 format available.

Message #89 received at 643585@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: Ben Howard <ben.howard@canonical.com>
Cc: 643585@bugs.debian.org
Subject: Re: Bug#643585: Bug 643585
Date: Wed, 05 Oct 2011 07:47:47 +0200
On 10/05/2011 12:32 AM, Ben Howard wrote:
> I've fixed the git tree (rebased) to address the packages list; you
> should you re-fetch the tree.

applied, thanks.

i haven't tested it yet, but as it's not breaking existing things, i've
also applied the qemu thing.

> I think the white space fun was caused by bad options in my .vimrc.

you can use the following to highlight most useless whitespaces in vim:

highlight ExtraWhitespace ctermbg=red guibg=red
:match ExtraWhitespace /\s\+$\| \+\ze\t/

> I'm just going to submit the 
> 0001-Adding-Ubuntu-Cloud-Images-package-lists.patch today. 

great; would you mind opening another bug for that (with subject
something like 'adding support for virtualization images') so we can
keep things seperate?

> I'm going to spend a bit of time thinking about the binary-hdd-raw and
> binary-hdd-virt (to support qcow and vmdk's).

note that they should all be 'seperate' formats, such as hdd-raw,
hdd-qcow, hdd-vmdk etc. otherwise, we can't (even try) to build them in
one shot.

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/




Bug 643585 cloned as bug 646836. Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Thu, 27 Oct 2011 16:51:07 GMT) Full text and rfc822 format available.

Bug marked as fixed in version 3.0~a36-1, send any further explanations to Ben Howard <ben.howard@canonical.com> Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Thu, 27 Oct 2011 16:51:12 GMT) Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Fri, 25 Nov 2011 07:39:47 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Apr 24 21:33:20 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.