summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/build/bootstrap32
-rwxr-xr-xscripts/build/bootstrap_archives275
2 files changed, 307 insertions, 0 deletions
diff --git a/scripts/build/bootstrap b/scripts/build/bootstrap
index bf68b0cf5..b497fb6c7 100755
--- a/scripts/build/bootstrap
+++ b/scripts/build/bootstrap
@@ -36,4 +36,36 @@ Setup_cleanup
# Bootstrapping system
lb bootstrap_${LB_BOOTSTRAP}
+
+# Configuring chroot
+lb chroot_devpts install ${@}
+lb chroot_proc install ${@}
+lb chroot_selinuxfs install ${@}
+lb chroot_sysfs install ${@}
+lb chroot_debianchroot install ${@}
+lb chroot_dpkg install ${@}
+lb chroot_tmpfs install ${@}
+lb chroot_sysv-rc install ${@}
+lb chroot_upstart install ${@}
+lb chroot_hosts install ${@}
+lb chroot_resolv install ${@}
+lb chroot_hostname install ${@}
+lb chroot_apt install ${@}
+
lb bootstrap_archive-keys ${@}
+lb bootstrap_archives ${@}
+
+# Deconfiguring chroot
+lb chroot_apt remove ${@}
+lb chroot_hostname remove ${@}
+lb chroot_resolv remove ${@}
+lb chroot_hosts remove ${@}
+lb chroot_sysv-rc remove ${@}
+lb chroot_upstart remove ${@}
+lb chroot_tmpfs remove ${@}
+lb chroot_dpkg remove ${@}
+lb chroot_debianchroot remove ${@}
+lb chroot_sysfs remove ${@}
+lb chroot_selinuxfs remove ${@}
+lb chroot_proc remove ${@}
+lb chroot_devpts remove ${@}
diff --git a/scripts/build/bootstrap_archives b/scripts/build/bootstrap_archives
new file mode 100755
index 000000000..42a6863d0
--- /dev/null
+++ b/scripts/build/bootstrap_archives
@@ -0,0 +1,275 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2013 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 'manage /etc/apt/sources.list')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+_PASS="${1}"
+shift
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
+Set_defaults
+
+# Requiring stage file
+Require_stagefile .build/config .build/bootstrap
+
+case "${LB_DERIVATIVE}" in
+ true)
+ _PARENT_FILE="sources.list.d/debian.list"
+ ;;
+
+ false)
+ _PARENT_FILE="sources.list"
+ ;;
+esac
+
+Echo_message "Configuring file /etc/apt/sources.list"
+
+# Checking stage file
+Check_stagefile .build/chroot_archives
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+# Restoring cache
+Restore_cache cache/packages.chroot
+
+# Configure custom sources.list
+
+cat > chroot/etc/apt/${_PARENT_FILE} << EOF
+deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}
+EOF
+
+if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
+then
+ echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+fi
+
+if [ "${LB_DERIVATIVE}" = "true" ]
+then
+ rm -f chroot/etc/apt/sources.list.d/${LB_MODE}.list
+
+ _DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')"
+
+ echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION} ${LIVE_IMAGE_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+
+ if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
+ then
+ echo "deb-src ${LB_MIRROR_CHROOT} ${_DISTRIBUTION} ${LIVE_IMAGE_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+ fi
+fi
+
+if [ "${LB_SECURITY}" = "true" ]
+then
+ case "${LB_MODE}" in
+ debian|progress-linux)
+ case "${LB_PARENT_DISTRIBUTION}" in
+ sid)
+
+ ;;
+
+ *)
+ echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+
+ if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
+ then
+ echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+ fi
+ ;;
+ esac
+
+ if [ "${LB_MODE}" = progress-linux ]
+ then
+ echo "deb ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}-security ${LIVE_IMAGE_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+
+ if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
+ then
+ echo "deb-src ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}-security ${LIVE_IMAGE_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+ fi
+ else
+ if [ "${LB_DERIVATIVE}" = "true" ]
+ then
+ echo "deb ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}/updates ${LIVE_IMAGE_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+
+ if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
+ then
+ echo "deb-src ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}/updates ${LIVE_IMAGE_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+ fi
+ fi
+ fi
+ ;;
+
+ ubuntu)
+ echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+
+ if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
+ then
+ echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+ fi
+ ;;
+ esac
+fi
+
+if [ "${LB_UPDATES}" = "true" ]
+then
+ echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+
+ if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
+ then
+ echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+ fi
+
+ if [ "${LB_DERIVATIVE}" = "true" ]
+ then
+ echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION}-updates ${LIVE_IMAGE_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+
+ if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
+ then
+ echo "deb-src ${LB_MIRROR_CHROOT} ${_DISTRIBUTION}-updates ${LIVE_IMAGE_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+ fi
+ fi
+fi
+
+if [ "${LB_BACKPORTS}" = "true" ]
+then
+ case "${LB_MODE}" in
+ debian)
+ if [ "${LB_PARENT_DISTRIBUTION}" != "sid" ]
+ then
+ echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-backports ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+
+ if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
+ then
+ echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-backports ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+ fi
+ fi
+ ;;
+ esac
+
+ if [ "${LB_DERIVATIVE}" = "true" ]
+ then
+ echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION}-backports ${LIVE_IMAGE_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+
+ if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
+ then
+ echo "deb-src ${LB_MIRROR_CHROOT} ${_DISTRIBUTION}-backports ${LIVE_IMAGE_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
+ fi
+ fi
+fi
+
+# Adding local apt sources (chroot)
+for FILE in config/archives/*.list config/archives/*.list.chroot
+do
+ if [ -e "${FILE}" ]
+ then
+ sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
+ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LIVE_IMAGE_ARCHIVE_AREAS}|g" \
+ -e "s|@PARENT_ARCHIVE_AREAS@|${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}|g" \
+ "${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
+
+ if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ]
+ then
+ # Strip out source archives
+ sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
+ fi
+ fi
+done
+
+# Adding local apt configuration (chroot)
+for FILE in config/archives/*.conf config/archives/*.conf.chroot
+do
+ if [ -e "${FILE}" ]
+ then
+ cp ${FILE} chroot/etc/apt/conf.d/$(basename ${FILE} .chroot)
+ fi
+done
+
+# Adding local apt preferences (chroot)
+for FILE in config/archives/*.pref config/archives/*.pref.chroot
+do
+ if [ -e "${FILE}" ]
+ then
+ cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot)
+ fi
+done
+
+# Check local archive keys
+if Find_files config/archives/*.key || \
+ Find_files config/archives/*.key.chroot
+then
+ for FILE in config/archives/*.key \
+ config/archives/*.key.chroot
+ do
+ if [ -e "${FILE}" ]
+ then
+ cp ${FILE} chroot/root
+ Chroot chroot "apt-key add /root/$(basename ${FILE})"
+ rm -f chroot/root/$(basename ${FILE})
+ fi
+ done
+fi
+
+# Check local keyring packages
+if Find_files config/archives/*.deb
+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})
+ 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"
+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
+
+Apt chroot update
+
+# Installing keyring packages
+if [ -n "${LB_KEYRING_PACKAGES}" ]
+then
+ Apt chroot "install ${LB_KEYRING_PACKAGES}"
+fi
+
+rm -rf chroot/var/cache/apt/*.bin
+
+Apt chroot update
+Apt chroot "upgrade"
+Apt chroot "dist-upgrade"
+
+# Saving cache
+Save_cache cache/packages.chroot
+
+# Creating stage file
+Create_stagefile .build/bootstrap_archives