Unverified Commit 2c6ba6d8 authored by Daniel Baumann's avatar Daniel Baumann
Browse files

Adding upstream version 20160501.


Signed-off-by: default avatarDaniel Baumann <mail@daniel-baumann.ch>
parent 1a192735
#!/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.
PROGRAM="live-build"
VERSION="$(if [ -e ${LIVE_BUILD}/VERSION ]; then cat ${LIVE_BUILD}/VERSION; else cat /usr/share/live/build/VERSION; fi)"
CONFIG_VERSION="$(echo ${VERSION} | awk -F- '{ print $1 }')"
# FIXME
LIVE_BUILD_VERSION="${CONFIG_VERSION}"
PATH="${PWD}/local/bin:${PATH}"
#!/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.
Get_conffiles ()
{
if [ -n "${LB_CONFIG}" ]
then
FILES="${LB_CONFIG}"
else
for FILE in ${@}
do
FILES="${FILES} ${FILE} ${FILE}.${LB_ARCHITECTURES} ${FILE}.${DISTRIBUTION}"
FILES="${FILES} config/$(echo ${PROGRAM} | sed -e 's|^lb_||')"
FILES="${FILES} config/$(echo ${PROGRAM} | sed -e 's|^lb_||').${ARCHITECTURE}"
FILES="${FILES} config/$(echo ${PROGRAM} | sed -e 's|^lb_||').${DISTRIBUTION}"
done
fi
echo ${FILES}
}
Read_conffiles ()
{
for CONFFILE in $(Get_conffiles "${@}")
do
if [ -f "${CONFFILE}" ]
then
if [ -r "${CONFFILE}" ]
then
Echo_debug "Reading configuration file %s" "${CONFFILE}"
. "${CONFFILE}"
else
Echo_warning "Failed to read configuration file %s" "${CONFFILE}"
fi
fi
done
}
Print_conffiles ()
{
for CONFFILE in $(Get_conffiles "${@}")
do
if [ -f "${CONFFILE}" ]
then
Echo_file "${CONFFILE}"
fi
done
}
#!/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.
Get_configuration ()
{
_CONFIGURATION_FILE="${1}"
_FIELD_NAME="${2}"
if [ -e "${_CONFIGURATION_FILE}" ]
then
_FIELD_BODY="$(grep ^${_FIELD_NAME}: ${_CONFIGURATION_FILE} | awk '{ $1=""; print $0 }' | sed -e 's|^ ||')"
fi
echo ${_FIELD_BODY}
}
Set_configuration ()
{
_CONFIGURATION_FILE="${1}"
_FIELD_NAME="${2}"
_FIELD_BODY="${3}"
if grep -qs "^${_FIELD_NAME}:" "${_CONFIGURATION_FILE}"
then
# Update configuration
sed -i -e "s|^${_FIELD_NAME}:.*$|${_FIELD_NAME}: ${_FIELD_BODY}|" "${_CONFIGURATION_FILE}"
else
# Append configuration
echo "${_FIELD_NAME}: ${_FIELD_BODY}" >> "${_CONFIGURATION_FILE}"
fi
}
#!/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.
Cursor_goto_position ()
{
__LINE="${1}"
__COLUMN="${2}"
#echo -e "[${__LINE};${__COLUMN};H\c"
printf "[${__LINE};${__COLUMN};H"
}
Cursor_save_position ()
{
#echo -e "\c"
printf ""
}
Cursor_restore_position ()
{
#echo -e "\c"
printf ""
}
Cursor_line_up ()
{
__LINES="${1}"
#echo -e "[${__LINES}A\c"
printf "[${__LINES}A"
}
Cursor_line_down ()
{
__LINES="${1}"
#echo -e "[${__LINES}B\c"
printf "[${__LINES}B"
}
Cursor_columns_forward ()
{
__COLUMNS="${1}"
#echo -e "[${__COLUMNS}C\c"
printf "[${__COLUMNS}C"
}
Cursor_columns_backward ()
{
__COLUMNS="${1}"
#echo -e "[${__COLUMNS}D\c"
printf "[${__COLUMNS}D"
}
Cursor_clear_screen ()
{
#echo -e "\c"
printf ""
}
Cursor_erase_EOL ()
{
#echo -e "\c"
printf ""
}
#!/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.
New_configuration ()
{
## Runtime
# Image: Architecture
if [ -x "/usr/bin/dpkg" ]
then
CURRENT_IMAGE_ARCHITECTURE="$(dpkg --print-architecture)"
else
case "$(uname -m)" in
x86_64)
CURRENT_IMAGE_ARCHITECTURE="amd64"
;;
i?86)
CURRENT_IMAGE_ARCHITECTURE="i386"
;;
*)
Echo_warning "Unable to determine current architecture, using ${CURRENT_IMAGE_ARCHITECTURE}"
;;
esac
fi
## Configuration
# Configuration-Version
LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION:-$(Get_configuration config/build Configuration-Version)}"
LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION:-${LIVE_BUILD_VERSION}}"
export LIVE_CONFIGURATION_VERSION
# Image: Name
LIVE_IMAGE_NAME="${LIVE_IMAGE_NAME:-$(Get_configuration config/build Name)}"
LIVE_IMAGE_NAME="${LIVE_IMAGE_NAME:-live-image}"
export LIVE_IMAGE_NAME
# Image: Architecture (FIXME: Support and default to 'any')
LB_ARCHITECTURES="${LB_ARCHITECTURES:-$(Get_configuration config/build Architecture)}"
LB_ARCHITECTURES="${LB_ARCHITECTURES:-${CURRENT_IMAGE_ARCHITECTURE}}"
export LB_ARCHITECTURES
# Image: Archive Areas
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-$(Get_configuration config/build Archive-Areas)}"
case "${LB_MODE}" in
progress-linux)
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main contrib non-free}"
;;
*)
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main}"
;;
esac
export LB_ARCHIVE_AREAS
# Image: Archive Areas
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-$(Get_configuration config/build Parent-Archive-Areas)}"
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-${LB_ARCHIVE_AREAS}}"
export LB_PARENT_ARCHIVE_AREAS
# Image: Type
LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-$(Get_configuration config/build Type)}"
LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso-hybrid}"
export LIVE_IMAGE_TYPE
}
Set_defaults ()
{
# FIXME
New_configuration
## config/common
if [ -e local/live-build ]
then
LIVE_BUILD="${LIVE_BUILD:-${PWD}/local/live-build}"
export LIVE_BUILD
fi
# Setting system type
LB_SYSTEM="${LB_SYSTEM:-live}"
# Setting mode (currently: debian, progress-linux)
if [ -x /usr/bin/lsb_release ]
then
_DISTRIBUTOR="$(lsb_release -is | tr "[A-Z]" "[a-z]")"
case "${_DISTRIBUTOR}" in
debian|progress-linux)
LB_MODE="${LB_MODE:-${_DISTRIBUTOR}}"
;;
*)
LB_MODE="${LB_MODE:-debian}"
;;
esac
else
if [ -e /etc/progress-linux_version ]
then
LB_MODE="${LB_MODE:-progress-linux}"
else
LB_MODE="${LB_MODE:-debian}"
fi
fi
# Setting distribution name
case "${LB_MODE}" in
progress-linux)
LB_DISTRIBUTION="${LB_DISTRIBUTION:-cairon}"
LB_DERIVATIVE="true"
LB_DERIVATIVE_IS_BASED_ON="debian"
;;
*)
LB_DISTRIBUTION="${LB_DISTRIBUTION:-stretch}"
LB_DERIVATIVE="false"
;;
esac
case "${LB_MODE}" in
progress-linux)
case "${LB_DISTRIBUTION}" in
baureo|baureo-backports)
LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-wheezy}"
LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
;;
cairon|cairon-backports)
LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-sid}"
LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
;;
esac
LB_BACKPORTS="${LB_BACKPORTS:-true}"
;;
*)
LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-${LB_DISTRIBUTION}}"
LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
LB_BACKPORTS="${LB_BACKPORTS:-false}"
;;
esac
# Setting package manager
LB_APT="${LB_APT:-apt}"
# Setting apt ftp proxy
LB_APT_FTP_PROXY="${LB_APT_FTP_PROXY}"
# Setting apt http proxy
LB_APT_HTTP_PROXY="${LB_APT_HTTP_PROXY}"
# Setting apt pipeline
# LB_APT_PIPELINE
APT_OPTIONS="${APT_OPTIONS:---yes}"
APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}"
BZIP2_OPTIONS="${BZIP2_OPTIONS:--6}"
GZIP_OPTIONS="${GZIP_OPTIONS:--6}"
if gzip --help | grep -qs "\-\-rsyncable"
then
GZIP_OPTIONS="$(echo ${GZIP_OPTIONS} | sed -e 's|--rsyncable||') --rsyncable"
fi
LZIP_OPTIONS="${LZIP_OPTIONS:--6}"
LZMA_OPTIONS="${LZMA_OPTIONS:--6}"
XZ_OPTIONS="${XZ_OPTIONS:--6}"
# Setting apt recommends
case "${LB_MODE}" in
progress-linux)
LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-false}"
;;
*)
LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-true}"
;;
esac
# Setting apt secure
LB_APT_SECURE="${LB_APT_SECURE:-true}"
# Setting apt source
case "${LB_MODE}" in
progress-linux)
LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES:-false}"
;;
*)
LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES:-true}"
;;
esac
# Setting cache option
LB_CACHE="${LB_CACHE:-true}"
LB_CACHE_INDICES="${LB_CACHE_INDICES:-false}"
LB_CACHE_PACKAGES="${LB_CACHE_PACKAGES:-true}"
LB_CACHE_STAGES="${LB_CACHE_STAGES:-bootstrap}"
# Setting debconf frontend
LB_DEBCONF_FRONTEND="${LB_DEBCONF_FRONTEND:-noninteractive}"
LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY:-critical}"
# Setting initramfs hook
case "${LB_SYSTEM}" in
live)
LB_INITRAMFS="${LB_INITRAMFS:-live-boot}"
;;
normal)
LB_INITRAMFS="${LB_INITRAMFS:-none}"
;;
esac
LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION:-gzip}"
# Setting initsystem
case "${LB_MODE}" in
progress-linux)
case "${LB_DISTRIBUTION}" in
cairon*)
LB_INITSYSTEM="${LB_INITSYSTEM:-systemd}"
;;
*)
LB_INITSYSTEM="${LB_INITSYSTEM:-sysvinit}"
;;
esac
;;
*)
case "${LB_SYSTEM}" in
live)
LB_INITSYSTEM="${LB_INITSYSTEM:-systemd}"
;;
normal)
LB_INITSYSTEM="${LB_INITSYSTEM:-none}"
;;
esac
;;
esac
# Setting fdisk
if [ -z "${LB_FDISK}" ] || [ ! -x "${LB_FDISK}" ]
then
# Workaround for gnu-fdisk divertion
# (gnu-fdisk is buggy, #445304).
if [ -x /sbin/fdisk.distrib ]
then
LB_FDISK="fdisk.distrib"
elif [ -x /sbin/fdisk ]
then
LB_FDISK="fdisk"
else
Echo_error "Can't process file /sbin/fdisk"
fi
fi
# Setting losetup
if [ -z "${LB_LOSETUP}" ] || [ "${LB_LOSETUP}" != "/sbin/losetup.orig" ]
then
# Workaround for loop-aes-utils divertion
# (loop-aes-utils' losetup lacks features).
if [ -x /sbin/losetup.orig ]
then
LB_LOSETUP="losetup.orig"
elif [ -x /sbin/losetup ]
then
LB_LOSETUP="losetup"
else
Echo_error "Can't process file /sbin/losetup"
fi
fi
if [ "${LB_ARCHITECTURES}" = "i386" ] && [ "${CURRENT_IMAGE_ARCHITECTURE}" = "amd64" ]
then
# Use linux32 when building amd64 images on i386
_LINUX32="linux32"
else
_LINUX32=""
fi
# Setting tasksel
LB_TASKSEL="${LB_TASKSEL:-apt}"
# Setting root directory
case "${LB_MODE}" in
progress-linux)
LB_ROOT="${LB_ROOT:-progress-linux}"
;;
*)
LB_ROOT="${LB_ROOT:-${LB_MODE}-live}"
;;
esac
# Setting live build options
_BREAKPOINTS="${_BREAKPOINTS:-false}"
_COLOR="${_COLOR:-false}"
_DEBUG="${_DEBUG:-false}"
_FORCE="${_FORCE:-false}"
_QUIET="${_QUIET:-false}"
_VERBOSE="${_VERBOSE:-false}"
## config/bootstrap
# Setting mirror to fetch packages from
case "${LB_MODE}" in
debian)
LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://ftp.debian.org/debian/}"
LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP:-${LB_MIRROR_BOOTSTRAP}}"
;;
progress-linux)
LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP:-http://ftp.debian.org/debian/}"
LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://cdn.archive.progress-linux.org/packages/}"
;;
esac
LB_PARENT_MIRROR_CHROOT="${LB_PARENT_MIRROR_CHROOT:-${LB_PARENT_MIRROR_BOOTSTRAP}}"
LB_MIRROR_CHROOT="${LB_MIRROR_CHROOT:-${LB_MIRROR_BOOTSTRAP}}"
# Setting security mirror to fetch packages from
case "${LB_MODE}" in
debian)
LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-http://security.debian.org/}"
LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY:-${LB_MIRROR_CHROOT_SECURITY}}"
;;
progress-linux)
LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY:-http://security.debian.org/}"
LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-${LB_MIRROR_CHROOT}}"
;;
esac
# Setting mirror which ends up in the image
case "${LB_MODE}" in
debian)
LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-http://httpredir.debian.org/debian/}"
LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-${LB_MIRROR_BINARY}}"
;;
progress-linux)
LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-http://ftp.debian.org/debian/}"
LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-${LB_MIRROR_CHROOT}}"
;;
esac
# Setting security mirror which ends up in the image
case "${LB_MODE}" in
debian)
LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-http://security.debian.org/}"
LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY:-${LB_MIRROR_BINARY_SECURITY}}"
;;
progress-linux)
LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY:-http://security.debian.org/}"
LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-${LB_MIRROR_CHROOT}}"
;;
esac
case "${LB_MODE}" in
progress-linux)
LB_PARENT_MIRROR_DEBIAN_INSTALLER="${LB_PARENT_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_CHROOT}}"
LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_CHROOT}}"
;;
*)
LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_CHROOT}}"
LB_PARENT_MIRROR_DEBIAN_INSTALLER="${LB_PARENT_MIRROR_DEBIAN_INSTALLER:-${LB_PARENT_MIRROR_CHROOT}}"
;;
esac
## config/chroot
# Setting chroot filesystem
LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM:-squashfs}"
# Setting union filesystem
LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM:-aufs}"
# Setting interactive shell/X11/Xnest
LB_INTERACTIVE="${LB_INTERACTIVE:-false}"
# Setting keyring packages
LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-debian-archive-keyring}"
# Setting linux flavour string
case "${LB_ARCHITECTURES}" in
arm64)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-arm64}"
;;
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:-ixp4xx kirkwood orion5x versatile}"
;;
armhf)
# armhf will have special images: one rootfs image and many additional kernel images.
# therefore we default to all available armhf flavours
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-armmp armmp-lpae}"
;;
amd64)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-amd64}"
;;
i386)
case "${LB_MODE}" in
progress-linux)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-686-pae}"
;;
*)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-586}"
;;
esac
;;