summaryrefslogtreecommitdiffstats
path: root/system-build/scripts/build/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsystem-build/scripts/build/source66
-rwxr-xr-xsystem-build/scripts/build/source_checksums101
-rwxr-xr-xsystem-build/scripts/build/source_debian207
-rwxr-xr-xsystem-build/scripts/build/source_debian-live62
-rwxr-xr-xsystem-build/scripts/build/source_disk123
-rwxr-xr-xsystem-build/scripts/build/source_hdd155
-rwxr-xr-xsystem-build/scripts/build/source_hooks81
-rwxr-xr-xsystem-build/scripts/build/source_iso122
-rwxr-xr-xsystem-build/scripts/build/source_live62
-rwxr-xr-xsystem-build/scripts/build/source_tar85
10 files changed, 1064 insertions, 0 deletions
diff --git a/system-build/scripts/build/source b/system-build/scripts/build/source
new file mode 100755
index 0000000..4d4f9bd
--- /dev/null
+++ b/system-build/scripts/build/source
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
+
+# Automatically populating config tree
+if [ -x auto/config ] && [ ! -e .build/config ]
+then
+ Echo_message "Automatically populating config tree."
+ lb config
+fi
+
+# Setting static variables
+DESCRIPTION="$(Echo 'build source images')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/system config/binary config/source
+Set_defaults
+
+if [ "${LB_SOURCE}" != "true" ]
+then
+ exit 0
+fi
+
+#Require_stagefile
+
+# Setup cleanup function
+Setup_cleanup
+
+# Enabling network in chroot
+lb chroot_hosts install ${@}
+lb chroot_resolv install ${@}
+lb chroot_hostname install ${@}
+lb chroot_archives source install ${@}
+
+# Preparing images
+lb source_live ${@}
+lb source_debian ${@}
+lb source_disk ${@}
+lb source_hooks ${@}
+lb source_checksums ${@}
+
+# Building images
+lb source_iso ${@}
+lb source_tar ${@}
+lb source_hdd ${@}
+
+# Deconfiguring chroot
+lb chroot_archives chroot remove ${@}
+lb chroot_hostname remove ${@}
+lb chroot_resolv remove ${@}
+lb chroot_hosts remove ${@}
diff --git a/system-build/scripts/build/source_checksums b/system-build/scripts/build/source_checksums
new file mode 100755
index 0000000..8b3172f
--- /dev/null
+++ b/system-build/scripts/build/source_checksums
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'create source checksums')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/system config/binary config/source
+Set_defaults
+
+if [ "${LB_CHECKSUMS}" = "none" ] || [ "${LB_SOURCE}" != "true" ]
+then
+ exit 0
+fi
+
+# Requiring stage file
+Require_stagefile .build/config .build/source_debian
+
+# Checking stage file
+Check_stagefile .build/source_checksums
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+for DIRECTORY in source/debian source/live
+do
+ if [ ! -d ${DIRECTORY} ]
+ then
+ continue
+ fi
+
+ for CHECKSUM in ${LB_CHECKSUMS}
+ do
+ case "${LB_MODE}" in
+ progress-linux)
+ CHECKSUMS="$(echo ${CHECKSUM} | tr [a-z] [A-Z])SUMS"
+ ;;
+
+ *)
+ CHECKSUMS="${CHECKSUM}sum.txt"
+ ;;
+ esac
+
+ Echo_message "Begin creating source ${CHECKSUMS}..."
+
+ # Remove old checksums
+ if [ -f ${DIRECTORY}/${CHECKSUMS} ]
+ then
+ rm -f ${DIRECTORY}/${CHECKSUMS}
+ fi
+
+ # Calculating checksums
+ cd ${DIRECTORY}
+ find . -type f \
+ \! -path './*SUMS' \
+ \! -path './*sum.txt' \
+ -print0 | sort -z | xargs -0 ${CHECKSUM}sum > ../${CHECKSUMS}
+
+cat > ${CHECKSUMS} << EOF
+## This file contains the list of ${CHECKSUM} checksums of all files on this
+## medium.
+##
+## You can verify them automatically with the 'verify-checksums' boot parameter,
+## or, manually with: '${CHECKSUM}sum -c ${CHECKSUMS}'.
+##
+##
+EOF
+
+ cat ../${CHECKSUMS} >> ${CHECKSUMS}
+ rm -f ../${CHECKSUMS}
+
+ cd "${OLDPWD}"
+ done
+
+ # File list
+ cd ${DIRECTORY}
+ find . | sed -e 's|^.||g' | grep "^/" | sort > ../../${LIVE_IMAGE_NAME}-source.$(basename ${DIRECTORY}).contents
+ cd "${OLDPWD}"
+done
+
+# Creating stage file
+Create_stagefile .build/source_checksums
diff --git a/system-build/scripts/build/source_debian b/system-build/scripts/build/source_debian
new file mode 100755
index 0000000..49e53db
--- /dev/null
+++ b/system-build/scripts/build/source_debian
@@ -0,0 +1,207 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'debian sources')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/system config/binary config/source
+Set_defaults
+
+if [ "${LB_SOURCE}" != "true" ]
+then
+ exit 0
+fi
+
+Echo_message "Begin downloading sources..."
+
+# Requiring stage file
+Require_stagefile .build/config .build/bootstrap
+
+# Checking stage file
+Check_stagefile .build/source_debian
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+# Remove old sources
+if [ -d source/debian ]
+then
+ rm -rf source/debian
+fi
+
+# Download sources
+Chroot chroot "dpkg --get-selections" | awk '{ print $1 }' > source-selection.txt
+
+echo "${LB_BOOTLOADERS}" | \
+while IFS="," read -r BOOTLOADER
+do
+ cat >> source-selection.txt << EOF
+ ${BOOTLOADER}
+EOF
+done
+
+cat >> source-selection.txt << EOF
+live-build
+EOF
+
+case "${LB_BINARY_IMAGES}" in
+ iso*)
+ echo "xorriso" >> source-selection.txt
+ ;;
+
+ hdd*)
+ echo "parted" >> source-selection.txt
+ ;;
+esac
+
+case "${LB_CHROOT_FILESYSTEM}" in
+ squashfs)
+ echo "squashfs-tools" >> source-selection.txt
+ ;;
+esac
+
+case "${LB_BINARY_FILESYSTEM}" in
+ fat*)
+ echo "dosfstools" >> source-selection.txt
+ ;;
+
+ ntfs)
+ echo "ntfs-3g" >> source-selection.txt
+ ;;
+esac
+
+case "${LB_ARCHITECTURES}" in
+ amd64|i386)
+
+cat >> source-selection.txt << EOF
+mtools
+syslinux
+grub
+EOF
+
+ if [ "${LB_MEMTEST}" != "false" ] && [ "${LB_MEMTEST}" != "none" ]
+ then
+ echo "${LB_MEMTEST}" >> source-selection.txt
+ fi
+ ;;
+esac
+
+if [ -n "${LB_TASKS}" ]
+then
+ echo "${LB_TASKSEL}" >> source-selection.txt
+fi
+
+# apt-get source does not respect pinning
+# building images with backports included but not enabled
+# will result in apt-get source download stuff from backports
+# where available. workaround: disable backports
+case "${LB_MODE}" in
+ progress-linux)
+ case "${LB_DISTRIBUTION}" in
+ *-backports)
+
+ ;;
+
+ *)
+ if grep -qs "${LB_DISTRIBUTION}-backports" chroot/etc/apt/sources.list.d/progress-linux.list
+ then
+ cp chroot/etc/apt/sources.list.d/progress-linux.list chroot/etc/apt/sources.list.d/progress-linux.list.orig
+
+ while read _LINE
+ do
+ if echo "${_LINE}" | grep -qs ${LB_DISTRIBUTION}-backports
+ then
+ sed -i -e "s|${_LINE}|#${_LINE}|" chroot/etc/apt/sources.list.d/progress-linux.list
+ fi
+ done < chroot/etc/apt/sources.list.d/progress-linux.list.orig
+
+ Apt chroot update
+ fi
+ ;;
+ esac
+ ;;
+esac
+
+MISSING=""
+
+grep . source-selection.txt | \
+while read PACKAGE
+do
+ if ! Chroot chroot "apt-get ${APT_OPTIONS} --download-only source ${PACKAGE}"
+ then
+ MISSING="${MISSING} ${PACKAGE}"
+ fi
+done
+
+if [ -n "${MISSING}" ]
+then
+ cat > source/missing-source.txt << EOF
+This file contains the list of binary packages that are installed on this live
+system that do not have a corresponding source package.
+
+EOF
+
+ for PACKAGE in ${MISSING}
+ do
+ Chroot chroot "dpkg -l ${PACKAGE}" | tail -n1 >> source/missing-source.txt
+ done
+fi
+
+rm -f source-selection.txt
+
+# Sort sources
+for DSC in chroot/*.dsc
+do
+ SOURCE="$(sed -n 's|^Source: ||p' ${DSC} 2>/dev/null || :)"
+ # The sed may fail if multiple dsc files exist for same source, as the
+ # first one to match will have already been moved.
+ [ -n "$SOURCE" ] || continue
+
+ case "${SOURCE}" in
+ lib?*)
+ LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')"
+ ;;
+
+ *)
+ LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')"
+ ;;
+ esac
+
+ # Install directory
+ mkdir -p source/debian/"${LETTER}"/"${SOURCE}"
+
+ # Move files
+ mv chroot/"${SOURCE}"_* source/debian/"${LETTER}"/"${SOURCE}"
+done
+
+# Reverting apt sources again
+if [ -e chroot/etc/apt/sources.list.d/progress-linux.list.orig ]
+then
+ mv chroot/etc/apt/sources.list.d/progress-linux.list.orig chroot/etc/apt/sources.list.d/progress-linux.list
+
+ Apt chroot update
+fi
+
+# Creating stage file
+Create_stagefile .build/source_debian
+Create_stagefile .build/source
diff --git a/system-build/scripts/build/source_debian-live b/system-build/scripts/build/source_debian-live
new file mode 100755
index 0000000..3af41e5
--- /dev/null
+++ b/system-build/scripts/build/source_debian-live
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'copy debian-live config into source')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/system config/binary config/source
+Set_defaults
+
+if [ "${LB_SOURCE}" != "true" ]
+then
+ exit 0
+fi
+
+Echo_message "Begin copying live-build configuration..."
+
+# Requiring stage file
+Require_stagefile .build/config .build/bootstrap
+
+# Checking stage file
+Check_stagefile .build/source_debian-live
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+# Remove old sources
+if [ -d source/debian-live ]
+then
+ rm -rf source/debian-live
+fi
+
+# Copy system configuration
+mkdir -p source/debian-live
+cp -a config source/debian-live
+
+if Find_files auto/*
+then
+ cp -a auto source/debian-live
+fi
+
+# Creating stage file
+Create_stagefile .build/source_debian-live
diff --git a/system-build/scripts/build/source_disk b/system-build/scripts/build/source_disk
new file mode 100755
index 0000000..9cac2b3
--- /dev/null
+++ b/system-build/scripts/build/source_disk
@@ -0,0 +1,123 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'install disk information into source')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/system config/binary config/source
+Set_defaults
+
+case "${LB_SOURCE_IMAGES}" in
+ iso*|hdd*)
+ ;;
+
+ *)
+ exit 0
+ ;;
+esac
+
+Echo_message "Begin installing disk information..."
+
+# Requiring stage file
+Require_stagefile .build/config .build/bootstrap
+
+# Checking stage file
+Check_stagefile .build/source_disk
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+mkdir -p source/.disk
+
+DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')"
+DISTRIBUTION="${DISTRIBUTION}$(echo ${LB_DISTRIBUTION} | cut -b 2-)"
+
+if [ -e chroot/etc/os-release ]
+then
+ VERSION="$(. chroot/etc/os-release && echo ${VERSION_ID})"
+fi
+
+VERSION="${VERSION:-none}"
+
+case "${LB_MODE}" in
+ debian)
+ TITLE="Debian GNU/Linux"
+ STRING="Official Snapshot ${ARCHITECTURE}"
+ TRACE="project/trace/ftp-master.debian.org"
+ ;;
+
+ progress-linux)
+ TITLE="Progress Linux"
+ STRING="${VERSION} (${DISTRIBUTION}) - ${ARCHITECTURE}"
+ TRACE="project/trace/archive-master.progress-linux.org"
+ ;;
+
+ *)
+ TITLE="Debian GNU/Linux"
+ STRING="Snapshot ${ARCHITECTURE}"
+ TRACE=""
+ ;;
+esac
+
+if [ -n "${TRACE}" ]
+then
+ case "${LB_DERIVATIVE}" in
+ true)
+ echo "$(echo ${LB_PARENT_MIRROR_BOOTSTRAP} | awk -F:// '{ print $2 }'): $(wget -q ${LB_PARENT_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \
+ > source/.disk/archive_trace
+
+ echo "$(echo ${LB_MIRROR_BOOTSTRAP} | awk -F:// '{ print $2 }'): $(wget -q ${LB_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \
+ >> source/.disk/archive_trace
+ ;;
+
+ false)
+ echo "$(wget -q ${LB_PARENT_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \
+ > source/.disk/archive_trace
+ ;;
+ esac
+fi
+
+case "${LB_DEBIAN_INSTALLER}" in
+ cdrom)
+ echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/CD Source $(date +%Y%m%d-%H:%M)" > source/.disk/info
+ ;;
+
+ true|netinst)
+ echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/NETINST Source $(date +%Y%m%d-%H:%M)" > source/.disk/info
+ ;;
+
+ live)
+ echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/INSTALL Source $(date +%Y%m%d-%H:%M)" > source/.disk/info
+ ;;
+
+ businesscard)
+ echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/BC Source $(date +%Y%m%d-%H:%M)" > source/.disk/info
+ ;;
+
+ false)
+ echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE Source $(date +%Y%m%d-%H:%M)" > source/.disk/info
+ ;;
+esac
+
+# Creating stage file
+Create_stagefile .build/source_disk
diff --git a/system-build/scripts/build/source_hdd b/system-build/scripts/build/source_hdd
new file mode 100755
index 0000000..e9947ab
--- /dev/null
+++ b/system-build/scripts/build/source_hdd
@@ -0,0 +1,155 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'build source image')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/system config/binary config/source
+Set_defaults
+
+if [ "${LB_SOURCE}" != "true" ]
+then
+ exit 0
+fi
+
+if ! In_list hdd "${LB_SOURCE_IMAGES}"
+then
+ exit 0
+fi
+
+Echo_message "Begin building source hdd image..."
+
+# Requiring stage file
+Require_stagefile .build/config .build/source_debian
+
+# Checking stage file
+Check_stagefile .build/source_hdd
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+# Checking depends
+Check_package chroot /sbin/mkdosfs dosfstools
+Check_package chroot /sbin/parted parted
+
+# Installing depends
+Install_package
+
+# Remove old source
+if [ -f ${LIVE_IMAGE_NAME}-source.img ]
+then
+ rm -f ${LIVE_IMAGE_NAME}-source.img
+fi
+
+# Everything which comes here needs to be cleaned up,
+DU_DIM="$(du -ms source | cut -f1)"
+REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LB_BINARY_FILESYSTEM})"
+dd if=/dev/zero of=${LIVE_IMAGE_NAME}-source.img bs=1024k count=0 seek=${REAL_DIM}
+FREELO="$(${LB_LOSETUP} -f)"
+if [ ! -b chroot/${FREELO} ]
+then
+ MAKEDEV="true"
+
+ mv chroot/dev chroot/dev.tmp
+ find /dev | cpio -dmpu chroot
+fi
+
+case "${LB_BINARY_FILESYSTEM}" in
+ ext2|ext3|ext4)
+ PARTITION_TYPE="ext2"
+ ;;
+
+ fat16|fat32)
+ PARTITION_TYPE="${LB_BINARY_FILESYSTEM}"
+ ;;
+
+ ntfs)
+ PARTITION_TYPE="NTFS"
+ ;;
+
+ *)
+ Echo_error "Unsupported binary filesystem %s" "${LB_BINARY_FILESYSTEM}"
+ exit 1
+ ;;
+esac
+
+Echo_warning "!!! The following error/warning messages can be ignored !!!"
+Losetup $FREELO ${LIVE_IMAGE_NAME}-source.img 0
+Chroot chroot "parted -s ${FREELO} mklabel msdos" || true
+Chroot chroot "parted -a optimal -s ${FREELO} mkpart primary ${PARTITION_TYPE} 0.0 100%" || true
+Lodetach ${FREELO}
+
+Losetup $FREELO ${LIVE_IMAGE_NAME}-source.img 1
+
+case "${LB_BINARY_FILESYSTEM}" in
+ ext2|ext3|ext4)
+ MKFS="${LB_BINARY_FILESYSTEM}"
+ MKFS_OPTIONS="-L ${LB_HDD_LABEL} -m 0 -O ^64bit"
+ MOUNT_OPTIONS=""
+ ;;
+
+ fat16)
+ MKFS="vfat"
+ MKFS_OPTIONS="-F 16 -n ${LB_HDD_LABEL}"
+ MOUNT_OPTIONS=""
+ ;;
+
+ fat32)
+ MKFS="vfat"
+ MKFS_OPTIONS="-F 32 -n ${LB_HDD_LABEL}"
+ MOUNT_OPTIONS=""
+ ;;
+
+ ntfs)
+ MKFS="ntfs"
+ MKFS_OPTIONS="-L ${LB_HDD_LABEL}"
+ MOUNT_OPTIONS="-t ntfs-3g"
+ ;;
+esac
+
+Chroot chroot "mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO}"
+
+mkdir -p source.tmp
+mount ${MOUNT_OPTIONS} ${FREELO} source.tmp
+cp -r source/* source.tmp
+umount source.tmp
+rmdir source.tmp
+Lodetach ${FREELO}
+Echo_warning "!!! The above error/warning messages can be ignored !!!"
+
+FREELO="$(${LB_LOSETUP} -f)"
+Losetup "$FREELO" ${LIVE_IMAGE_NAME}-source.img 0
+Chroot chroot "parted -s ${FREELO} set 1 lba off" || true
+Lodetach ${FREELO}
+
+if [ -n "${MAKEDEV}" ]
+then
+ rm -rf chroot/dev
+ mv chroot/dev.tmp chroot/dev
+fi
+
+# Removing depends
+Remove_package
+
+# Creating stage file
+Create_stagefile .build/source_hdd
diff --git a/system-build/scripts/build/source_hooks b/system-build/scripts/build/source_hooks
new file mode 100755
index 0000000..4a7b1a4
--- /dev/null
+++ b/system-build/scripts/build/source_hooks
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'execute hooks in source')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/system config/source config/source
+Set_defaults
+
+Echo_message "Begin executing hooks..."
+
+# Requiring stage file
+Require_stagefile .build/config .build/bootstrap
+
+# Checking stage file
+Check_stagefile .build/source_hooks
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+## Processing distribution hooks
+
+# Running hooks
+for _HOOK in ${LB_BINARY_HOOKS}
+do
+ for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
+ do
+ for FILE in "${LOCATION}"/????-"${_HOOK}".source
+ do
+ if [ -e "${FILE}" ]
+ then
+ cd source
+ "${FILE}" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
+ cd "${OLDPWD}"
+ fi
+ done
+ done
+done
+
+## Processing local hooks
+for HOOK in config/hooks/normal/*.source config/hooks/live/*.source
+do
+ if [ ! -e "${HOOK}" ]
+ then
+ continue
+ fi
+
+ # Making hook executable
+ if [ ! -x "${HOOK}" ]
+ then
+ chmod +x "${HOOK}"
+ fi
+
+ # Executing hook
+ cd source
+ ../"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
+ cd "${OLDPWD}"
+done
+
+# Creating stage file
+Create_stagefile .build/source_hooks
diff --git a/system-build/scripts/build/source_iso b/system-build/scripts/build/source_iso
new file mode 100755
index 0000000..b0b3036
--- /dev/null
+++ b/system-build/scripts/build/source_iso
@@ -0,0 +1,122 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'build iso source image')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/system config/binary config/source
+Set_defaults
+
+if [ "${LB_SOURCE}" != "true" ]
+then
+ exit 0
+fi
+
+case "${LB_SOURCE_IMAGES}" in
+ iso*)
+ ;;
+
+ *)
+ exit 0
+ ;;
+esac
+
+Echo_message "Begin building source iso image..."
+
+# Requiring stage file
+Require_stagefile .build/config .build/source_debian
+
+# Checking stage file
+Check_stagefile .build/source_iso
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+# Checking depends
+Check_package chroot /usr/bin/xorriso xorriso
+
+# Installing depends
+Install_package
+
+# Remove old iso image
+if [ -f ${LIVE_IMAGE_NAME}-source.iso ]
+then
+ rm -f ${LIVE_IMAGE_NAME}-source.iso
+fi
+
+# Handle xorriso generic options
+XORRISO_OPTIONS="-as mkisofs -r -J -joliet-long -l -cache-inodes"
+
+# Handle xorriso live-build specific options
+if [ "${_QUIET}" = "true" ]
+then
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -quiet"
+fi
+
+if [ "${_VERBOSE}" = "true" ]
+then
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -v"
+fi
+
+if [ -n "${LB_ISO_APPLICATION}" ] && [ "${LB_ISO_APPLICATION}" != "none" ]
+then
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -A \"${LB_ISO_APPLICATION}\""
+fi
+
+if [ -n "${LB_ISO_PREPARER}" ] && [ "${LB_ISO_PREPARER}" != "none" ]
+then
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -p \"${LB_ISO_PREPARER}\""
+fi
+
+if [ -n "${LB_ISO_PUBLISHER}" ] && [ "${LB_ISO_PUBLISHER}" != "none" ]
+then
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -publisher \"${LB_ISO_PUBLISHER}\""
+fi
+
+if [ -n "${LB_ISO_VOLUME}" ] && [ "${LB_ISO_VOLUME}" != "none" ]
+then
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -V \"${LB_ISO_VOLUME}\""
+fi
+
+# Set an explicit modification date
+XORRISO_OPTIONS="${XORRISO_OPTIONS} --modification-date=$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m%d%H%m%S00)"
+
+# Moving image
+mv source chroot
+
+cat >> chroot/source.sh << EOF
+xorriso ${XORRISO_OPTIONS} -o source.iso source
+EOF
+
+Chroot chroot "sh source.sh"
+
+# Move image
+mv chroot/source ./
+mv chroot/source.iso ${LIVE_IMAGE_NAME}-source.iso
+rm -f chroot/source.sh
+
+# Removing depends
+Remove_package
+
+# Creating stage file
+Create_stagefile .build/source_iso
diff --git a/system-build/scripts/build/source_live b/system-build/scripts/build/source_live
new file mode 100755
index 0000000..67e71c9
--- /dev/null
+++ b/system-build/scripts/build/source_live
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'copy live config into source')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/system config/binary config/source
+Set_defaults
+
+if [ "${LB_SOURCE}" != "true" ]
+then
+ exit 0
+fi
+
+Echo_message "Begin copying live-build configuration..."
+
+# Requiring stage file
+Require_stagefile .build/config .build/bootstrap
+
+# Checking stage file
+Check_stagefile .build/source_live
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+# Remove old sources
+if [ -d source/live ]
+then
+ rm -rf source/live
+fi
+
+# Copy system configuration
+mkdir -p source/live
+cp -a config source/live
+
+if Find_files auto/*
+then
+ cp -a auto source/live
+fi
+
+# Creating stage file
+Create_stagefile .build/source_live
diff --git a/system-build/scripts/build/source_tar b/system-build/scripts/build/source_tar
new file mode 100755
index 0000000..d4b3555
--- /dev/null
+++ b/system-build/scripts/build/source_tar
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'build source tarball')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/system config/binary config/source
+Set_defaults
+
+if [ "${LB_SOURCE}" != "true" ]
+then
+ exit 0
+fi
+
+if ! In_list tar "${LB_SOURCE_IMAGES}"
+then
+ exit 0
+fi
+
+Echo_message "Begin building source tarball..."
+Echo_message "This may take a while."
+
+# Requiring stage file
+Require_stagefile .build/config .build/source_debian
+
+# Checking stage file
+Check_stagefile .build/source_tar
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+# Remove old source
+rm -f ${LIVE_IMAGE_NAME}-source.orig.tar.bz2 ${LIVE_IMAGE_NAME}-source.orig.tar.gz ${LIVE_IMAGE_NAME}-source.orig.tar.lz ${LIVE_IMAGE_NAME}-source.orig.tar
+rm -f ${LIVE_IMAGE_NAME}-source.config.tar.bz2 ${LIVE_IMAGE_NAME}-source.config.tar.gz ${LIVE_IMAGE_NAME}-source.config.tar.lz ${LIVE_IMAGE_NAME}-source.config.tar
+
+tar cf ${LIVE_IMAGE_NAME}-source.orig.tar source/debian
+tar cf ${LIVE_IMAGE_NAME}-source.config.tar source/live
+
+case "${LB_COMPRESSION}" in
+ bzip2)
+ bzip2 ${BZIP2_OPTIONS} ${LIVE_IMAGE_NAME}-source.orig.tar
+ bzip2 ${BZIP2_OPTIONS} ${LIVE_IMAGE_NAME}-source.config.tar
+ ;;
+
+ gzip)
+ gzip ${GZIP_OPTIONS} ${LIVE_IMAGE_NAME}-source.orig.tar
+ gzip ${GZIP_OPTIONS} ${LIVE_IMAGE_NAME}-source.config.tar
+ ;;
+
+ lzip)
+ lzip ${LZIP_OPTIONS} ${LIVE_IMAGE_NAME}-source.orig.tar
+ lzip ${LZIP_OPTIONS} ${LIVE_IMAGE_NAME}-source.config.tar
+ ;;
+
+ xz)
+ xz ${XZ_OPTIONS} ${LIVE_IMAGE_NAME}-source.orig.tar
+ xz ${XZ_OPTIONS} ${LIVE_IMAGE_NAME}-source.config.tar
+ ;;
+
+ none)
+ ;;
+esac
+
+# Creating stage file
+Create_stagefile .build/source_tar