2007-09-23 08:04:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2014-02-08 15:47:02 -01:00
|
|
|
## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch>
|
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
|
2009-01-15 01:37:42 -01:00
|
|
|
DESCRIPTION="$(Echo 'manage /etc/apt/sources.list')"
|
2007-09-23 08:04:48 +00:00
|
|
|
HELP=""
|
|
|
|
USAGE="${PROGRAM} {install|remove} [--force]"
|
|
|
|
|
2011-08-24 18:34:01 +00:00
|
|
|
_PASS="${1}"
|
|
|
|
shift
|
|
|
|
|
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
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
_LB_LOCAL_KEY_EMAIL="live-build-local-key@invalid"
|
2008-07-04 23:40:20 +00:00
|
|
|
|
2012-02-04 19:35:38 -01:00
|
|
|
case "${LB_DERIVATIVE}" in
|
|
|
|
true)
|
|
|
|
_PARENT_FILE="sources.list.d/debian.list"
|
|
|
|
;;
|
|
|
|
|
|
|
|
false)
|
|
|
|
_PARENT_FILE="sources.list"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
case "${1}" in
|
|
|
|
install)
|
2007-09-23 08:05:12 +00:00
|
|
|
Echo_message "Configuring file /etc/apt/sources.list"
|
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Checking stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Check_stagefile .build/chroot_archives
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:04:50 +00:00
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
2010-06-23 16:30:13 +00:00
|
|
|
# Restoring cache
|
2012-06-04 08:52:28 +00:00
|
|
|
Restore_cache cache/packages.chroot
|
2010-06-23 16:30:13 +00:00
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Configure custom sources.list
|
2010-09-15 11:03:04 +00:00
|
|
|
|
2012-02-04 19:35:38 -01:00
|
|
|
cat > chroot/etc/apt/${_PARENT_FILE} << EOF
|
2012-12-19 19:48:49 -01:00
|
|
|
deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}
|
2010-09-15 11:03:04 +00:00
|
|
|
EOF
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-05-15 19:23:03 +00:00
|
|
|
then
|
2012-12-19 19:48:49 -01:00
|
|
|
echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-05-15 19:23:03 +00:00
|
|
|
fi
|
|
|
|
|
2011-02-14 12:32:10 -01:00
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]
|
|
|
|
then
|
2012-02-04 19:35:38 -01:00
|
|
|
rm -f chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2012-02-04 20:05:36 -01:00
|
|
|
_DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')"
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-05-15 19:23:03 +00:00
|
|
|
|
2012-02-04 20:05:36 -01:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb-src ${LB_MIRROR_CHROOT} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2012-02-04 20:05:36 -01:00
|
|
|
fi
|
2007-09-23 08:04:46 +00:00
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_SECURITY}" = "true" ]
|
2007-09-23 08:04:46 +00:00
|
|
|
then
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_MODE}" in
|
2012-10-25 11:36:12 +00:00
|
|
|
debian|progress-linux)
|
2011-05-15 18:53:24 +00:00
|
|
|
case "${LB_PARENT_DISTRIBUTION}" in
|
2012-07-18 20:44:30 +00:00
|
|
|
sid)
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2011-05-15 18:53:24 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2012-12-19 19:48:49 -01:00
|
|
|
echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-05-15 18:53:24 +00:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-05-15 18:53:24 +00:00
|
|
|
then
|
2012-12-19 19:48:49 -01:00
|
|
|
echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-05-15 18:53:24 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2009-04-15 20:07:26 +00:00
|
|
|
|
2012-10-25 11:36:12 +00:00
|
|
|
if [ "${LB_MODE}" = progress-linux ]
|
2009-04-15 20:07:26 +00:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-05-15 18:56:26 +00:00
|
|
|
|
2012-02-04 20:05:36 -01:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb-src ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2012-02-04 20:05:36 -01:00
|
|
|
fi
|
2011-02-14 12:32:10 -01:00
|
|
|
else
|
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]
|
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb-src ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
fi
|
2009-04-15 20:07:26 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2012-12-17 11:48:54 -01:00
|
|
|
ubuntu)
|
2012-12-19 19:48:49 -01:00
|
|
|
echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2012-12-19 19:48:49 -01:00
|
|
|
echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-02-14 12:32:10 -01:00
|
|
|
fi
|
|
|
|
;;
|
2009-04-15 20:07:26 +00:00
|
|
|
esac
|
2007-09-23 08:04:46 +00:00
|
|
|
fi
|
|
|
|
|
2012-09-20 14:53:03 +00:00
|
|
|
if [ "${LB_UPDATES}" = "true" ]
|
2010-03-06 15:23:59 -01:00
|
|
|
then
|
2013-03-21 14:58:30 -01:00
|
|
|
echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2010-03-11 16:03:29 -01:00
|
|
|
|
2011-09-14 19:02:17 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
|
|
|
then
|
2013-03-21 14:58:30 -01:00
|
|
|
echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-09-14 19:02:17 +00:00
|
|
|
fi
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2013-03-21 14:58:30 -01:00
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb-src ${LB_MIRROR_CHROOT} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
fi
|
|
|
|
fi
|
2010-03-06 15:23:59 -01:00
|
|
|
fi
|
|
|
|
|
2010-09-16 12:15:30 +00:00
|
|
|
if [ "${LB_BACKPORTS}" = "true" ]
|
|
|
|
then
|
|
|
|
case "${LB_MODE}" in
|
2011-01-07 19:09:49 -01:00
|
|
|
debian)
|
2011-02-14 12:32:10 -01:00
|
|
|
if [ "${LB_PARENT_DISTRIBUTION}" != "sid" ]
|
2010-09-16 12:15:30 +00:00
|
|
|
then
|
2013-03-20 10:45:36 -01:00
|
|
|
echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-backports ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2010-09-16 12:15:30 +00:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2010-09-16 12:15:30 +00:00
|
|
|
then
|
2013-03-20 10:45:36 -01:00
|
|
|
echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-backports ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2010-09-16 12:15:30 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2013-03-20 10:45:36 -01:00
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb-src ${LB_MIRROR_CHROOT} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
fi
|
|
|
|
fi
|
2010-09-16 12:15:30 +00:00
|
|
|
fi
|
|
|
|
|
2012-12-04 10:04:47 -01:00
|
|
|
# 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" \
|
2014-12-10 05:41:29 -01:00
|
|
|
-e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
|
2012-12-19 19:48:49 -01:00
|
|
|
-e "s|@PARENT_ARCHIVE_AREAS@|${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}|g" \
|
2012-12-04 10:04:47 -01:00
|
|
|
"${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
|
|
|
|
|
|
|
|
if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ]
|
2012-07-18 19:03:20 +00:00
|
|
|
then
|
2012-12-04 10:04:47 -01:00
|
|
|
# Strip out source archives
|
|
|
|
sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
|
2012-07-18 19:03:20 +00:00
|
|
|
fi
|
2012-12-04 10:04:47 -01:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-12-04 10:07:51 -01:00
|
|
|
# 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
|
|
|
|
|
2012-12-04 10:04:47 -01:00
|
|
|
# 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
|
2012-07-18 19:03:20 +00:00
|
|
|
|
2008-04-16 05:53:34 +00:00
|
|
|
# Configure local package repository
|
2011-09-07 15:33:53 +00:00
|
|
|
if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb
|
2008-04-16 05:53:34 +00:00
|
|
|
then
|
2011-06-15 20:08:23 +00:00
|
|
|
rm -rf chroot/root/packages
|
|
|
|
mkdir -p chroot/root/packages
|
2008-04-16 05:53:34 +00:00
|
|
|
|
2011-09-07 15:33:53 +00:00
|
|
|
if [ "$(stat --printf %d config/packages.chroot)" = "$(stat --printf %d chroot/root/packages)" ] ||
|
|
|
|
[ "$(stat --printf %d config/packages)" = "$(stat --printf %d chroot/root/packages)" ]
|
2008-08-07 17:45:24 +00:00
|
|
|
then
|
|
|
|
CP_OPTIONS="-l"
|
|
|
|
fi
|
|
|
|
|
2008-04-16 05:53:34 +00:00
|
|
|
# Copy packages
|
2014-12-10 05:39:58 -01:00
|
|
|
if Find_files config/packages.chroot/*_"${LB_ARCHITECTURES}".deb || Find_files config/packages/*_"${LB_ARCHITECTURES}".deb
|
2008-04-16 05:53:34 +00:00
|
|
|
then
|
2014-12-10 05:39:58 -01:00
|
|
|
for FILE in config/packages.chroot/*_"${LB_ARCHITECTURES}".deb config/packages/*_"${LB_ARCHITECTURES}".deb
|
2010-09-16 16:16:19 +00:00
|
|
|
do
|
|
|
|
if [ -L "${FILE}" ]
|
|
|
|
then
|
2011-09-07 15:33:53 +00:00
|
|
|
cp -L "${FILE}" chroot/root/packages
|
|
|
|
elif [ -e "${FILE}" ]
|
2011-09-07 15:37:37 +00:00
|
|
|
then
|
2011-09-07 15:33:53 +00:00
|
|
|
cp ${CP_OPTIONS} "${FILE}" chroot/root/packages
|
2010-09-16 16:16:19 +00:00
|
|
|
fi
|
|
|
|
done
|
2008-04-16 05:53:34 +00:00
|
|
|
fi
|
|
|
|
|
2011-09-07 15:33:53 +00:00
|
|
|
if Find_files config/packages.chroot/*_all.deb || Find_files config/packages/*_all.deb
|
2008-04-16 05:53:34 +00:00
|
|
|
then
|
2011-09-07 15:33:53 +00:00
|
|
|
for FILE in config/packages.chroot/*_all.deb config/packages/*_all.deb
|
2010-09-16 16:16:19 +00:00
|
|
|
do
|
|
|
|
if [ -L "${FILE}" ]
|
|
|
|
then
|
2011-09-07 15:33:53 +00:00
|
|
|
cp -L "${FILE}" chroot/root/packages
|
|
|
|
elif [ -e "${FILE}" ]
|
2011-09-07 15:37:37 +00:00
|
|
|
then
|
2011-09-07 15:33:53 +00:00
|
|
|
cp ${CP_OPTIONS} "${FILE}" chroot/root/packages
|
2010-09-16 16:16:19 +00:00
|
|
|
fi
|
|
|
|
done
|
2008-04-16 05:53:34 +00:00
|
|
|
fi
|
|
|
|
|
2011-06-15 20:08:23 +00:00
|
|
|
if Find_files chroot/root/packages/*.deb
|
2008-04-16 05:53:34 +00:00
|
|
|
then
|
2008-09-03 19:56:56 +00:00
|
|
|
# If we bootstrapped a minimal chroot, we need
|
2012-08-27 12:07:34 +00:00
|
|
|
# to install apt-utils before we have
|
2008-09-03 19:56:56 +00:00
|
|
|
# completed all the indices.
|
2012-08-27 12:07:34 +00:00
|
|
|
if [ ! -e chroot/usr/bin/apt-ftparchive ]
|
2012-07-28 22:24:11 +00:00
|
|
|
then
|
|
|
|
Apt chroot update
|
|
|
|
fi
|
2008-09-03 19:56:56 +00:00
|
|
|
|
2008-06-15 01:55:33 +00:00
|
|
|
# Check depends
|
|
|
|
Check_package chroot/usr/bin/apt-ftparchive apt-utils
|
|
|
|
|
|
|
|
# Installing depends
|
|
|
|
Install_package
|
|
|
|
|
2011-09-07 15:33:53 +00:00
|
|
|
# Generate Packages and Packages.gz
|
2011-06-15 20:08:23 +00:00
|
|
|
echo "cd /root/packages && apt-ftparchive packages . > Packages" | Chroot chroot sh
|
|
|
|
gzip -9 -c chroot/root/packages/Packages > chroot/root/packages/Packages.gz
|
2008-07-04 23:40:20 +00:00
|
|
|
|
2008-08-14 00:39:03 +00:00
|
|
|
# Generate Release
|
2011-06-15 20:08:23 +00:00
|
|
|
echo "cd /root/packages && apt-ftparchive \
|
2011-09-07 14:02:03 +00:00
|
|
|
-o APT::FTPArchive::Release::Origin=config/packages.chroot \
|
2008-11-14 14:11:13 -01:00
|
|
|
release . > Release" | Chroot chroot sh
|
2008-08-14 00:39:03 +00:00
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_APT_SECURE}" = "true" ]
|
2008-07-04 23:40:20 +00:00
|
|
|
then
|
2013-02-19 10:01:27 -01:00
|
|
|
if [ -e chroot/root/.gnupg ]
|
2008-07-04 23:40:20 +00:00
|
|
|
then
|
2013-02-19 10:01:27 -01:00
|
|
|
mv chroot/root/.gnupg chroot/root/.gnupg.orig
|
2008-07-04 23:40:20 +00:00
|
|
|
fi
|
|
|
|
|
2013-02-19 10:01:27 -01:00
|
|
|
# Ensure ~/.gnupg exists
|
2008-07-09 14:40:39 +00:00
|
|
|
mkdir -p chroot/root/.gnupg
|
|
|
|
|
2009-11-01 09:40:46 -01:00
|
|
|
# Temporarily replace /dev/random with /dev/urandom so as not
|
2008-07-13 01:42:46 +00:00
|
|
|
# to block automated image builds; we don't care about the
|
|
|
|
# security of this key anyway.
|
2010-09-26 08:37:54 +00:00
|
|
|
if [ -e chroot/dev/random ]
|
|
|
|
then
|
|
|
|
mv chroot/dev/random chroot/dev/random.orig
|
|
|
|
cp -a chroot/dev/urandom chroot/dev/random
|
|
|
|
fi
|
2008-07-13 01:42:46 +00:00
|
|
|
|
2008-08-09 01:20:56 +00:00
|
|
|
if Find_files cache/local-package-keyring.*
|
2008-07-04 23:40:20 +00:00
|
|
|
then
|
|
|
|
cp cache/local-package-keyring.* chroot/root
|
2008-07-13 01:42:55 +00:00
|
|
|
else
|
2008-07-04 23:40:20 +00:00
|
|
|
# Generate temporary key
|
|
|
|
echo "Key-Type: RSA
|
|
|
|
Key-Length: 1024
|
|
|
|
Subkey-Type: ELG-E
|
|
|
|
Subkey-Length: 1024
|
2010-09-02 11:22:22 +00:00
|
|
|
Name-Real: live-build local packages key
|
2010-09-07 13:11:20 +00:00
|
|
|
Name-Email: ${_LB_LOCAL_KEY_EMAIL}
|
2008-07-04 23:40:20 +00:00
|
|
|
Expire-Date: 0
|
|
|
|
%secring /root/local-package-keyring.sec
|
|
|
|
%pubring /root/local-package-keyring.pub
|
2010-09-07 13:11:20 +00:00
|
|
|
%commit" | Chroot chroot "gpg --batch --gen-key" || _LB_RET=${?}
|
2008-07-04 23:40:20 +00:00
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${_LB_RET}" in
|
2008-07-04 23:40:20 +00:00
|
|
|
""|2)
|
|
|
|
# Gnupg sometimes seems to return with a status of 2 when there was not
|
|
|
|
# enough entropy (and key creation blocks temporarily) even if the
|
|
|
|
# operation was ultimately successful.
|
|
|
|
;;
|
|
|
|
*)
|
2010-09-07 13:11:20 +00:00
|
|
|
Echo_error "GPG exited with error status %s" "${_LB_RET}"
|
|
|
|
exit ${_LB_RET}
|
2008-07-04 23:40:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Save keyrings to avoid regeneration
|
|
|
|
cp chroot/root/local-package-keyring.* cache/
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Sign release
|
2008-10-28 14:44:06 -01:00
|
|
|
Chroot chroot "gpg --no-default-keyring --secret-keyring /root/local-package-keyring.sec \
|
2008-07-04 23:40:20 +00:00
|
|
|
--keyring /root/local-package-keyring.pub -abs -o \
|
2011-06-15 20:08:23 +00:00
|
|
|
/root/packages/Release.gpg /root/packages/Release"
|
2008-07-04 23:40:20 +00:00
|
|
|
|
|
|
|
# Import key
|
2008-10-28 14:44:06 -01:00
|
|
|
Chroot chroot "gpg --no-default-keyring --secret-keyring /root/local-package-keyring.sec \
|
2008-07-04 23:40:20 +00:00
|
|
|
--keyring /root/local-package-keyring.pub --armor \
|
2010-09-07 13:11:20 +00:00
|
|
|
--export ${_LB_LOCAL_KEY_EMAIL}" | Chroot chroot "apt-key add -"
|
2008-07-04 23:40:20 +00:00
|
|
|
|
|
|
|
# Remove temporary keyrings
|
|
|
|
rm chroot/root/local-package-keyring.pub
|
|
|
|
rm chroot/root/local-package-keyring.sec
|
|
|
|
|
2008-07-13 01:42:46 +00:00
|
|
|
# Revert /dev/random
|
2010-09-26 08:37:54 +00:00
|
|
|
if [ -e chroot/dev/random.orig ]
|
|
|
|
then
|
|
|
|
mv chroot/dev/random.orig chroot/dev/random
|
|
|
|
fi
|
2008-07-13 01:42:46 +00:00
|
|
|
|
2013-02-19 10:01:27 -01:00
|
|
|
rm -rf chroot/root/.gnupg
|
|
|
|
|
|
|
|
if [ -e chroot/root/.gnupg.orig ]
|
2008-07-04 23:40:20 +00:00
|
|
|
then
|
2013-02-19 10:01:27 -01:00
|
|
|
mv chroot/root/.gnupg.orig chroot/root/.gnupg
|
2008-07-04 23:40:20 +00:00
|
|
|
fi
|
|
|
|
fi
|
2008-04-16 05:53:34 +00:00
|
|
|
|
2010-02-14 14:00:48 -01:00
|
|
|
# Add to sources.list.d
|
2011-06-15 20:08:23 +00:00
|
|
|
echo "deb file:/root/packages ./" > chroot/etc/apt/sources.list.d/packages.list
|
2008-06-15 01:55:33 +00:00
|
|
|
|
2011-10-03 10:38:51 +00:00
|
|
|
# Move top-level sources away, otherwise apt always preferes it (#644148)
|
2011-09-30 13:42:51 +00:00
|
|
|
if [ -e chroot/etc/apt/sources.list ]
|
|
|
|
then
|
|
|
|
mv chroot/etc/apt/sources.list chroot/etc/apt/sources.list.d/zz-sources.list
|
|
|
|
fi
|
2011-09-30 13:26:34 +00:00
|
|
|
|
2008-06-15 01:55:33 +00:00
|
|
|
# Removing depends
|
|
|
|
Remove_package
|
2008-04-16 05:53:34 +00:00
|
|
|
else
|
|
|
|
Echo_warning "Local packages must be named with suffix '_all.deb' or '_\$architecture.deb'."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-08-16 18:55:47 +00:00
|
|
|
if Find_files chroot/root/packages/*.deb
|
|
|
|
then
|
|
|
|
gunzip < chroot/root/packages/Packages.gz | awk '/^Package: / { print $2 }' \
|
2011-09-07 13:59:48 +00:00
|
|
|
>> chroot/root/packages.chroot
|
2011-08-16 18:55:47 +00:00
|
|
|
fi
|
|
|
|
|
2007-09-23 08:04:52 +00:00
|
|
|
# Update indices from cache
|
2012-06-04 08:52:28 +00:00
|
|
|
if [ "${LB_CACHE_INDICES}" = "true" ] && [ -d cache/indices.bootstrap ]
|
2007-09-23 08:04:49 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
if Find_files cache/indices.bootstrap/secring.gpg*
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f cache/indices.bootstrap/secring.gpg* chroot/etc/apt
|
2007-09-23 08:04:52 +00:00
|
|
|
fi
|
2007-09-23 08:04:49 +00:00
|
|
|
|
2012-06-04 08:52:28 +00:00
|
|
|
if Find_files cache/indices.bootstrap/trusted.gpg*
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -rf cache/indices.bootstrap/trusted.gpg* chroot/etc/apt
|
2007-09-23 08:04:52 +00:00
|
|
|
fi
|
2007-09-23 08:04:47 +00:00
|
|
|
|
2012-06-04 08:52:28 +00:00
|
|
|
if [ -f cache/indices.bootstrap/pkgcache.bin ]
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f cache/indices.bootstrap/pkgcache.bin chroot/var/cache/apt
|
2007-09-23 08:04:52 +00:00
|
|
|
fi
|
|
|
|
|
2012-06-04 08:52:28 +00:00
|
|
|
if [ -f cache/indices.bootstrap/srcpkgcache.bin ]
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f cache/indices.bootstrap/srcpkgcache.bin chroot/var/cache/apt
|
2007-09-23 08:04:52 +00:00
|
|
|
fi
|
|
|
|
|
2012-06-04 08:52:28 +00:00
|
|
|
if Find_files cache/indices.bootstrap/*_Packages
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f cache/indices.bootstrap/*_Packages chroot/var/lib/apt/lists
|
2007-09-23 08:04:52 +00:00
|
|
|
fi
|
|
|
|
|
2012-06-04 08:52:28 +00:00
|
|
|
if Find_files cache/indices.bootstrap/*_Sources
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f cache/indices.bootstrap/*_Sources chroot/var/lib/apt/lists
|
2007-09-23 08:04:52 +00:00
|
|
|
fi
|
|
|
|
|
2012-06-04 08:52:28 +00:00
|
|
|
if Find_files cache/indices.bootstrap/*Release*
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f cache/indices.bootstrap/*Release* chroot/var/lib/apt/lists
|
2007-09-23 08:04:52 +00:00
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ]
|
2007-09-23 08:04:46 +00:00
|
|
|
then
|
2011-04-23 15:44:01 +00:00
|
|
|
Chroot chroot "apt-get ${APT_OPTIONS} update"
|
2008-10-28 14:44:06 -01:00
|
|
|
Chroot chroot "apt-get ${APT_OPTIONS} install aptitude"
|
2007-09-23 08:04:46 +00:00
|
|
|
fi
|
2007-09-23 08:04:52 +00:00
|
|
|
else # Get fresh indices
|
2011-06-15 19:21:41 +00:00
|
|
|
# Check local archive keys
|
2011-08-05 06:53:27 +00:00
|
|
|
if Find_files config/archives/*.key || \
|
|
|
|
Find_files config/archives/*.key.chroot
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2011-08-05 06:53:27 +00:00
|
|
|
for FILE in config/archives/*.key \
|
|
|
|
config/archives/*.key.chroot
|
2007-09-23 08:04:52 +00:00
|
|
|
do
|
2011-08-09 11:05:29 +00:00
|
|
|
if [ -e "${FILE}" ]
|
|
|
|
then
|
|
|
|
cp ${FILE} chroot/root
|
|
|
|
Chroot chroot "apt-key add /root/$(basename ${FILE})"
|
|
|
|
rm -f chroot/root/$(basename ${FILE})
|
|
|
|
fi
|
2007-09-23 08:04:52 +00:00
|
|
|
done
|
|
|
|
fi
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:04:52 +00:00
|
|
|
# Check local keyring packages
|
2011-06-15 19:01:48 +00:00
|
|
|
if Find_files config/archives/*.deb
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2011-06-15 19:01:48 +00:00
|
|
|
for PACKAGE in config/archives/*.deb
|
2007-09-23 08:04:52 +00:00
|
|
|
do
|
|
|
|
cp ${PACKAGE} chroot/root
|
2008-10-28 14:44:06 -01:00
|
|
|
Chroot chroot "dpkg -i /root/$(basename ${PACKAGE})"
|
2007-09-24 06:47:42 +00:00
|
|
|
rm -f chroot/root/$(basename ${PACKAGE})
|
2007-09-23 08:04:52 +00:00
|
|
|
done
|
|
|
|
fi
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2014-11-10 17:48:53 -01:00
|
|
|
# Installing aptitude
|
|
|
|
if [ "${LB_APT}" = "aptitude" ] && [ ! -x /chroot/usr/bin/aptitude ]
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2008-10-28 14:44:06 -01:00
|
|
|
Chroot chroot "apt-get ${APT_OPTIONS} update"
|
|
|
|
Chroot chroot "apt-get ${APT_OPTIONS} install aptitude"
|
2007-09-23 08:04:52 +00:00
|
|
|
fi
|
|
|
|
|
2011-04-23 16:13:58 +00:00
|
|
|
# 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
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2010-12-05 12:06:12 -01:00
|
|
|
Apt chroot update
|
2008-02-21 18:03:57 -01:00
|
|
|
|
2007-09-23 08:04:52 +00:00
|
|
|
# Installing keyring packages
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ -n "${LB_KEYRING_PACKAGES}" ]
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2013-01-27 09:16:25 -01:00
|
|
|
Apt chroot "install ${LB_KEYRING_PACKAGES}"
|
2007-09-23 08:04:52 +00:00
|
|
|
fi
|
|
|
|
|
2011-04-23 16:13:58 +00:00
|
|
|
rm -rf chroot/var/cache/apt/*.bin
|
|
|
|
|
|
|
|
Apt chroot update
|
|
|
|
Apt chroot "upgrade"
|
|
|
|
Apt chroot "dist-upgrade"
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_CACHE_INDICES}" = "true" ]
|
2007-09-23 08:04:52 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
mkdir -p cache/indices.bootstrap
|
2007-09-23 08:04:52 +00:00
|
|
|
|
2012-07-18 15:45:52 +00:00
|
|
|
if Find_files chroot/etc/apt/secring.gpg*
|
|
|
|
then
|
|
|
|
cp -f chroot/etc/apt/secring.gpg* cache/indices.bootstrap
|
|
|
|
fi
|
|
|
|
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -rf chroot/etc/apt/trusted.gpg* cache/indices.bootstrap
|
2007-09-23 08:04:52 +00:00
|
|
|
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f chroot/var/cache/apt/pkgcache.bin cache/indices.bootstrap
|
2008-06-09 08:04:44 +00:00
|
|
|
|
2008-08-09 01:20:56 +00:00
|
|
|
if Find_files chroot/var/cache/apt/srcpkgcache.bin
|
2008-06-09 08:04:44 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f chroot/var/cache/apt/srcpkgcache.bin cache/indices.bootstrap
|
2008-06-09 08:04:44 +00:00
|
|
|
fi
|
2007-09-23 08:04:52 +00:00
|
|
|
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f chroot/var/lib/apt/lists/*_Packages cache/indices.bootstrap
|
2008-06-09 08:04:44 +00:00
|
|
|
|
2008-08-09 01:20:56 +00:00
|
|
|
if Find_files chroot/var/lib/apt/lists/*_Sources
|
2008-06-09 08:04:44 +00:00
|
|
|
then
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f chroot/var/lib/apt/lists/*_Sources cache/indices.bootstrap
|
2008-06-09 08:04:44 +00:00
|
|
|
fi
|
|
|
|
|
2012-06-04 08:52:28 +00:00
|
|
|
cp -f chroot/var/lib/apt/lists/*Release* cache/indices.bootstrap
|
2007-09-23 08:04:52 +00:00
|
|
|
fi
|
2007-09-23 08:04:49 +00:00
|
|
|
fi
|
|
|
|
|
2010-06-23 16:30:13 +00:00
|
|
|
# Saving cache
|
2012-06-04 08:52:28 +00:00
|
|
|
Save_cache cache/packages.chroot
|
2010-06-23 16:30:13 +00:00
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Creating stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Create_stagefile .build/chroot_archives
|
2007-09-23 08:04:46 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
remove)
|
2007-09-23 08:05:12 +00:00
|
|
|
Echo_message "Deconfiguring file /etc/apt/sources.list"
|
|
|
|
|
2007-09-23 08:04:50 +00:00
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
2011-09-30 13:26:34 +00:00
|
|
|
# Restore top-level sources
|
2011-09-30 13:42:51 +00:00
|
|
|
if [ -e chroot/etc/apt/sources.list.d/zz-sources.list ]
|
|
|
|
then
|
|
|
|
mv chroot/etc/apt/sources.list.d/zz-sources.list chroot/etc/apt/sources.list
|
|
|
|
fi
|
2011-09-30 13:26:34 +00:00
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Configure generic indices
|
2010-01-31 15:07:09 -01:00
|
|
|
# Don't do anything if it's not required
|
2011-02-14 11:11:26 -01:00
|
|
|
if [ "${LB_PARENT_MIRROR_CHROOT}" = "${LB_PARENT_MIRROR_BINARY}" ] && \
|
|
|
|
[ "${LB_PARENT_MIRROR_CHROOT_SECURITY}" = "${LB_PARENT_MIRROR_BINARY_SECURITY}" ] && \
|
2011-06-15 20:08:23 +00:00
|
|
|
[ ! -d chroot/root/packages ]
|
2007-09-23 08:04:46 +00:00
|
|
|
then
|
2010-01-31 15:07:09 -01:00
|
|
|
# Removing stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
rm -f .build/chroot_archives
|
2007-09-23 08:05:16 +00:00
|
|
|
|
2010-01-31 15:07:09 -01:00
|
|
|
exit 0
|
|
|
|
fi
|
2007-09-23 08:04:49 +00:00
|
|
|
|
2010-01-31 15:07:09 -01:00
|
|
|
# Cleaning apt list cache
|
|
|
|
rm -rf chroot/var/lib/apt/lists
|
|
|
|
mkdir -p chroot/var/lib/apt/lists/partial
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2011-02-14 12:32:10 -01:00
|
|
|
# Configure custom sources.list
|
|
|
|
|
2012-02-04 19:35:38 -01:00
|
|
|
cat > chroot/etc/apt/${_PARENT_FILE} << EOF
|
2012-12-19 19:48:49 -01:00
|
|
|
deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION} ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}
|
2010-09-15 11:03:04 +00:00
|
|
|
EOF
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-05-15 19:23:03 +00:00
|
|
|
then
|
2012-12-19 19:48:49 -01:00
|
|
|
echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION} ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-05-15 19:23:03 +00:00
|
|
|
fi
|
|
|
|
|
2011-02-14 12:32:10 -01:00
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]
|
|
|
|
then
|
2012-02-04 19:35:38 -01:00
|
|
|
rm -f chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2012-02-04 20:05:36 -01:00
|
|
|
_DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')"
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb ${LB_MIRROR_BINARY} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-05-15 19:23:03 +00:00
|
|
|
|
2012-02-04 20:05:36 -01:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb-src ${LB_MIRROR_BINARY} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2012-02-04 20:05:36 -01:00
|
|
|
fi
|
2010-01-31 15:07:09 -01:00
|
|
|
fi
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_SECURITY}" = "true" ]
|
2010-01-31 15:07:09 -01:00
|
|
|
then
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_MODE}" in
|
2012-10-25 11:36:12 +00:00
|
|
|
debian|progress-linux)
|
2011-05-15 18:53:24 +00:00
|
|
|
case "${LB_PARENT_DISTRIBUTION}" in
|
2012-07-18 20:44:30 +00:00
|
|
|
sid)
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2011-05-15 18:53:24 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2012-12-19 19:48:49 -01:00
|
|
|
echo "deb ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-05-15 18:53:24 +00:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-05-15 18:53:24 +00:00
|
|
|
then
|
2012-12-19 19:48:49 -01:00
|
|
|
echo "deb-src ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-05-15 18:53:24 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2007-10-19 10:45:57 +00:00
|
|
|
|
2012-10-25 11:36:12 +00:00
|
|
|
if [ "${LB_MODE}" = progress-linux ]
|
2010-01-31 15:07:09 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-05-15 18:56:26 +00:00
|
|
|
|
2012-02-04 20:05:36 -01:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb-src ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2012-02-04 20:05:36 -01:00
|
|
|
fi
|
2011-02-14 12:32:10 -01:00
|
|
|
else
|
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]
|
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb-src ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
2012-12-17 11:48:54 -01:00
|
|
|
ubuntu)
|
2012-12-19 19:48:49 -01:00
|
|
|
echo "deb ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2012-12-19 19:48:49 -01:00
|
|
|
echo "deb-src ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2010-01-31 15:07:09 -01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2012-09-20 14:53:03 +00:00
|
|
|
if [ "${LB_UPDATES}" = "true" ]
|
2010-03-06 15:23:59 -01:00
|
|
|
then
|
2013-03-21 14:58:30 -01:00
|
|
|
echo "deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION}-updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2010-03-11 16:03:29 -01:00
|
|
|
|
2011-09-14 19:02:17 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
|
|
|
then
|
2013-03-21 14:58:30 -01:00
|
|
|
echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION}-updates ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2011-09-14 19:02:17 +00:00
|
|
|
fi
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2013-03-21 14:58:30 -01:00
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb ${LB_MIRROR_BINARY} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb-src ${LB_MIRROR_BINARY} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
fi
|
|
|
|
fi
|
2010-03-06 15:23:59 -01:00
|
|
|
fi
|
|
|
|
|
2010-09-16 12:15:30 +00:00
|
|
|
if [ "${LB_BACKPORTS}" = "true" ]
|
|
|
|
then
|
|
|
|
case "${LB_MODE}" in
|
2011-01-07 19:09:49 -01:00
|
|
|
debian)
|
2011-02-14 12:32:10 -01:00
|
|
|
if [ "${LB_PARENT_DISTRIBUTION}" != "sid" ]
|
2010-09-16 12:15:30 +00:00
|
|
|
then
|
2013-03-20 10:45:36 -01:00
|
|
|
echo "deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION}-backports ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2010-09-16 12:15:30 +00:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2010-09-16 12:15:30 +00:00
|
|
|
then
|
2013-03-20 10:45:36 -01:00
|
|
|
echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION}-backports ${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
|
2010-09-16 12:15:30 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2013-03-20 10:45:36 -01:00
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb ${LB_MIRROR_BINARY} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
|
2011-08-24 21:30:22 +00:00
|
|
|
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
|
2011-02-14 12:32:10 -01:00
|
|
|
then
|
2014-12-10 05:41:29 -01:00
|
|
|
echo "deb-src ${LB_MIRROR_BINARY} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
|
2011-02-14 12:32:10 -01:00
|
|
|
fi
|
|
|
|
fi
|
2010-09-16 12:15:30 +00:00
|
|
|
fi
|
|
|
|
|
2013-09-17 11:28:00 +00:00
|
|
|
# Removing chroot-only apt sources
|
|
|
|
for FILE in config/archives/*.list.chroot
|
|
|
|
do
|
|
|
|
if [ -e "${FILE}" ]
|
|
|
|
then
|
|
|
|
rm -f "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2013-09-18 08:48:21 +00:00
|
|
|
# Removing chroot-only apt configuration
|
|
|
|
for FILE in config/archives/*.conf.chroot
|
|
|
|
do
|
|
|
|
if [ -e "${FILE}" ]
|
|
|
|
then
|
|
|
|
rm -f "chroot/etc/apt/conf.d/$(basename ${FILE} .chroot)"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Removing chroot-only apt preferences
|
|
|
|
for FILE in config/archives/*.pref.chroot
|
|
|
|
do
|
|
|
|
if [ -e "${FILE}" ]
|
|
|
|
then
|
|
|
|
rm -f "chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot)"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-12-04 10:04:47 -01:00
|
|
|
# Adding local apt sources (binary)
|
|
|
|
for FILE in config/archives/*.list config/archives/*.list.binary
|
|
|
|
do
|
|
|
|
if [ -e "${FILE}" ]
|
|
|
|
then
|
|
|
|
sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
|
|
|
|
-e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
|
2014-12-10 05:41:29 -01:00
|
|
|
-e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
|
2012-12-19 19:48:49 -01:00
|
|
|
-e "s|@PARENT_ARCHIVE_AREAS@|${LIVE_IMAGE_PARENT_ARCHIVE_AREAS}|g" \
|
2012-12-04 10:04:47 -01:00
|
|
|
"${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
|
|
|
|
|
|
|
|
if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ]
|
2011-08-09 11:05:29 +00:00
|
|
|
then
|
2012-12-04 10:04:47 -01:00
|
|
|
# Strip out source archives
|
|
|
|
sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
|
2011-08-09 11:05:29 +00:00
|
|
|
fi
|
2012-12-04 10:04:47 -01:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-12-04 10:07:51 -01:00
|
|
|
# Adding local apt configuration (binary)
|
|
|
|
for FILE in config/archives/*.conf config/archives/*.conf.binary
|
|
|
|
do
|
|
|
|
if [ -e "${FILE}" ]
|
|
|
|
then
|
|
|
|
cp ${FILE} chroot/etc/apt/conf.d/$(basename ${FILE} .binary)
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-12-04 10:04:47 -01:00
|
|
|
# Adding local apt preferences (binary)
|
|
|
|
for FILE in config/archives/*.pref config/archives/*.pref.binary
|
|
|
|
do
|
|
|
|
if [ -e "${FILE}" ]
|
|
|
|
then
|
|
|
|
cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .binary)
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Adding local apt keys (binary)
|
|
|
|
for FILE in config/archives/*.key config/archives/*.key.binary
|
|
|
|
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
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2010-01-31 15:07:09 -01:00
|
|
|
# Updating indices
|
2010-12-05 12:06:12 -01:00
|
|
|
Apt chroot update
|
2010-01-31 15:07:09 -01:00
|
|
|
|
2009-01-11 15:05:30 -01:00
|
|
|
# Cleaning apt package cache
|
2007-09-23 08:04:47 +00:00
|
|
|
rm -rf chroot/var/cache/apt
|
|
|
|
mkdir -p chroot/var/cache/apt/archives/partial
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2009-02-13 08:17:29 -01:00
|
|
|
# Cleaning apt package lists
|
2010-11-21 15:17:48 -01:00
|
|
|
if [ "${LB_APT_INDICES}" = "false" ]
|
2009-02-13 08:17:29 -01:00
|
|
|
then
|
|
|
|
rm -rf chroot/var/lib/apt/lists
|
|
|
|
mkdir -p chroot/var/lib/apt/lists/partial
|
|
|
|
fi
|
2009-01-11 15:05:30 -01:00
|
|
|
|
2008-04-16 05:53:34 +00:00
|
|
|
# Remove local package repository
|
2011-06-15 20:08:23 +00:00
|
|
|
rm -f chroot/etc/apt/sources.list.d/packages.list
|
|
|
|
rm -rf chroot/root/packages
|
2008-04-16 05:53:34 +00:00
|
|
|
|
2008-07-04 23:40:20 +00:00
|
|
|
# Remove local packages key if it exists
|
2013-01-19 10:49:56 -01:00
|
|
|
if Chroot chroot apt-key list | grep -q ${_LB_LOCAL_KEY_EMAIL}
|
2008-07-04 23:40:20 +00:00
|
|
|
then
|
2013-01-19 10:49:56 -01:00
|
|
|
Chroot chroot apt-key del ${_LB_LOCAL_KEY_EMAIL}
|
2008-07-04 23:40:20 +00:00
|
|
|
fi
|
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Removing stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
rm -f .build/chroot_archives
|
2007-09-23 08:04:46 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2007-09-23 08:04:48 +00:00
|
|
|
Usage
|
2007-09-23 08:04:46 +00:00
|
|
|
;;
|
|
|
|
esac
|