2007-09-23 08:04:46 +00:00
#!/bin/sh
2010-09-02 11:12:37 +00:00
## live-build(7) - System Build Scripts
2012-02-04 19:41:41 -01:00
## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
2010-09-02 11:12:37 +00:00
##
2012-07-29 23:59:00 +00:00
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
2010-09-02 11:12:37 +00:00
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
2007-09-23 08:04:46 +00:00
set -e
2007-09-23 08:05:11 +00:00
# Including common functions
2012-08-27 13:52:29 +00:00
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
2007-09-23 08:04:46 +00:00
2007-09-23 08:05:11 +00:00
# Setting static variables
2011-04-23 15:37:36 +00:00
DESCRIPTION="$(Echo 'schedule kernel packages for installation')"
2007-09-23 08:04:48 +00:00
HELP=""
2011-04-23 15:37:36 +00:00
USAGE="${PROGRAM} [--force]"
2007-09-23 08:04:48 +00:00
Arguments "${@}"
2007-09-23 08:04:46 +00:00
# Reading configuration files
2008-10-28 14:26:17 -01:00
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
2007-09-23 08:04:46 +00:00
Set_defaults
# Requiring stage file
2012-06-03 20:42:41 +00:00
Require_stagefile .build/config .build/bootstrap
2007-09-23 08:04:46 +00:00
2011-04-23 15:37:36 +00:00
# Checking stage file
2012-06-03 20:42:41 +00:00
Check_stagefile .build/chroot_linux-image
2011-04-23 15:37:36 +00:00
# Checking lock file
Check_lockfile .lock
# Creating lock file
Create_lockfile .lock
# Diverting update-initramfs
#case "${LB_INITRAMFS}" in
# live-boot)
# mv chroot/usr/sbin/update-initramfs chroot/usr/sbin/update-initramfs.live-build
# ;;
#esac
if [ "${LB_LINUX_PACKAGES}" != "none" ]
then
for FLAVOUR in ${LB_LINUX_FLAVOURS}
do
for PACKAGE in ${LB_LINUX_PACKAGES}
do
2011-09-07 13:59:48 +00:00
echo ${PACKAGE}-${FLAVOUR} >> chroot/root/packages.chroot
2011-04-23 15:37:36 +00:00
done
done
2012-06-04 08:41:57 +00:00
# Include firmware packages
2012-04-26 20:27:56 +00:00
if [ "${LB_FIRMWARE_CHROOT}" = "true" ]
then
# Assumption: firmware packages install files into /lib/firmware
# Get all firmware packages names
2012-06-04 08:41:57 +00:00
mkdir -p cache/contents.chroot
FIRMWARE_PACKAGES=""
2012-04-26 20:27:56 +00:00
2012-11-22 15:07:35 -01:00
if [ "${_PARENT_DISTRIBUTION}" = "squeeze" ] || [ "${LB_MODE}" = "ubuntu" ] || [ "${LB_MODE}" = "kubuntu" ]
then
_CONTENTS="${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz"
else
_CONTENTS="$(for _PARENT_ARCHIVE_AREA in ${LB_PARENT_ARCHIVE_AREAS}; do echo ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION}/${_PARENT_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz; done)"
fi
2012-06-04 08:41:57 +00:00
2012-11-22 15:07:35 -01:00
rm -f cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES}
2012-04-26 20:27:56 +00:00
2012-11-22 15:07:35 -01:00
for _CONTENT in ${_CONTENTS}
do
wget ${WGET_OPTIONS} ${_CONTENT} -O - | gunzip -c >> cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES}
FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)"
2012-11-02 09:50:44 -01:00
done
2012-04-26 20:27:56 +00:00
2012-11-22 15:07:35 -01:00
if echo ${LB_PARENT_ARCHIVE_AREAS} | grep -qs "non-free"
then
# FIXME: should check that we're building on debian through e.g. a 'derivative-is-based-on' variable or somesuch.
# Manually add firmware-linux/non-free meta package
FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} firmware-linux"
fi
2012-11-02 09:50:44 -01:00
if [ "${LB_DERIVATIVE}" = "true" ]
2012-04-26 20:27:56 +00:00
then
2012-11-02 09:50:44 -01:00
# FIXME: account for the fact that PARENT_DISTRIBUTION and DISTRIBUTION might be the same (to not have overlapping cache files for contents).
2012-06-04 08:41:57 +00:00
2012-11-22 15:07:35 -01:00
if [ "${_PARENT_DISTRIBUTION}" = "squeeze" ] || [ "${LB_MODE}" = "ubuntu" ] || [ "${LB_MODE}" = "kubuntu" ]
then
_CONTENTS="${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz"
else
_CONTENTS="$(for _ARCHIVE_AREA in ${LB_ARCHIVE_AREAS}; do echo ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION}/${_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz; done)"
fi
rm -f cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES}
for _CONTENT in ${_CONTENTS}
2012-04-26 20:27:56 +00:00
do
2012-11-22 15:07:35 -01:00
wget ${WGET_OPTIONS} ${_CONTENT} -O - | gunzip -c >> cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES}
2012-04-26 20:27:56 +00:00
2012-11-22 15:07:35 -01:00
FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)"
2012-11-02 09:50:44 -01:00
done
2012-04-26 20:27:56 +00:00
fi
# Drop section and keep package names only
for _PACKAGE in ${FIRMWARE_PACKAGES}
do
echo $(echo ${_PACKAGE} | awk -F/ '{ print $NF }') >> chroot/root/packages.chroot
done
2012-04-26 20:49:57 +00:00
# Some known licenses required to be accepted
cat >> chroot/root/packages.chroot.cfg << EOF
firmware-ivtv firmware-ivtv/license/accepted boolean true
firmware-ipw2x00 firmware-ipw2x00/license/accepted boolean true
EOF
2012-04-26 20:27:56 +00:00
fi
2011-06-11 17:36:46 +00:00
# Creating stage file
2012-06-03 20:42:41 +00:00
Create_stagefile .build/chroot_linux-image
2011-04-23 15:37:36 +00:00
fi