2008-04-17 03:13:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2020-03-11 09:07:21 -01:00
|
|
|
## Copyright (C) 2016-2020 The Debian Live team
|
2015-01-04 18:05:39 -01:00
|
|
|
## Copyright (C) 2006-2015 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.
|
|
|
|
|
2008-04-17 03:13:49 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# 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
|
2008-04-17 03:13:49 +00:00
|
|
|
|
|
|
|
# Setting static variables
|
2015-02-05 02:30:47 -01:00
|
|
|
DESCRIPTION="Install queued packages into chroot"
|
2011-06-11 14:36:44 +00:00
|
|
|
USAGE="${PROGRAM} {install|live} [--force]"
|
|
|
|
|
|
|
|
_PASS="${1}"
|
|
|
|
shift
|
2008-04-17 03:13:49 +00:00
|
|
|
|
2015-02-05 02:30:47 -01:00
|
|
|
# Processing arguments and configuration files
|
|
|
|
Init_config_data "${@}"
|
2008-04-17 03:13:49 +00:00
|
|
|
|
2011-06-11 14:36:44 +00:00
|
|
|
Echo_message "Begin installing packages (${_PASS} pass)..."
|
2008-04-17 03:13:49 +00:00
|
|
|
|
|
|
|
# Requiring stage file
|
2020-03-15 12:05:44 -01:00
|
|
|
Require_stagefiles config bootstrap
|
2008-04-17 03:13:49 +00:00
|
|
|
|
2020-03-17 21:09:51 -01:00
|
|
|
# Set non-default stage file name
|
2020-03-13 16:11:53 -01:00
|
|
|
# Setting to default name with appended action name
|
|
|
|
STAGE_FILE="$(Stagefile_name "${_PASS}")"
|
|
|
|
|
2008-04-17 03:13:49 +00:00
|
|
|
# Checking stage file
|
2020-03-12 00:21:39 -01:00
|
|
|
Check_stagefile "${STAGE_FILE}"
|
2008-04-17 03:13:49 +00:00
|
|
|
|
2020-03-13 15:19:59 -01:00
|
|
|
# Acquire lock file
|
2015-02-05 02:30:47 -01:00
|
|
|
Acquire_lockfile
|
2008-04-17 03:13:49 +00:00
|
|
|
|
2013-06-20 15:36:01 +00:00
|
|
|
# Check for packages specified with foreign architecture
|
|
|
|
_FOREIGN_ARCHITECTURES_FILE="chroot/root/packages.foreign-architectures"
|
|
|
|
if [ -e "${_FOREIGN_ARCHITECTURES_FILE}" ] && [ -s "${_FOREIGN_ARCHITECTURES_FILE}" ]
|
|
|
|
then
|
|
|
|
_APT_ARCHITECTURES_ADDED="0"
|
|
|
|
|
|
|
|
# Check if version of dpkg in chroot supports multiarch
|
|
|
|
if Chroot chroot dpkg --print-foreign-architectures > /dev/null 2>&1
|
|
|
|
then
|
|
|
|
# Add foregin architectures
|
|
|
|
while read _ARCHITECTURES_LINE
|
|
|
|
do
|
|
|
|
Echo_message "Adding foreign architecture ${_ARCHITECTURES_LINE} to dpkg"
|
|
|
|
Chroot chroot dpkg --add-architecture ${_ARCHITECTURES_LINE}
|
|
|
|
|
|
|
|
_APT_ARCHITECTURES_ADDED="1"
|
|
|
|
done < "${_FOREIGN_ARCHITECTURES_FILE}"
|
|
|
|
|
|
|
|
# Tidy up
|
|
|
|
rm -f "${_FOREIGN_ARCHITECTURES_FILE}"
|
|
|
|
else
|
|
|
|
Echo_error "Version of dpkg in chroot does not support foreign architectures."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Update apt if foreign architectures were added
|
|
|
|
if [ "${_APT_ARCHITECTURES_ADDED}" -ne "0" ]
|
|
|
|
then
|
|
|
|
Echo_message "Added foreign architectures, updating apt..."
|
|
|
|
Apt chroot update
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-09-07 13:59:48 +00:00
|
|
|
if [ -e chroot/root/packages.chroot ] && [ -s chroot/root/packages.chroot ]
|
2008-04-17 03:13:49 +00:00
|
|
|
then
|
|
|
|
# Restoring cache
|
2015-01-06 02:46:37 -01:00
|
|
|
Restore_package_cache chroot
|
2008-04-17 03:13:49 +00:00
|
|
|
|
2024-06-25 09:35:35 +00:00
|
|
|
if [ "${LB_INITRAMFS}" = "dracut-live" ]; then
|
|
|
|
# Install each package separately, because the list contains conflicts
|
|
|
|
_INSTALL_ONE_BY_ONE="--max-args 1"
|
|
|
|
else
|
|
|
|
_INSTALL_ONE_BY_ONE=""
|
|
|
|
fi
|
2008-04-17 03:13:49 +00:00
|
|
|
# Installing packages
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_APT}" in
|
2008-04-17 03:13:49 +00:00
|
|
|
apt|apt-get)
|
2024-06-25 09:35:35 +00:00
|
|
|
Chroot chroot "xargs ${_INSTALL_ONE_BY_ONE} --arg-file=/root/packages.chroot apt-get ${APT_OPTIONS} install"
|
2008-04-17 03:13:49 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
aptitude)
|
2024-06-25 09:35:35 +00:00
|
|
|
Chroot chroot "xargs ${_INSTALL_ONE_BY_ONE} --arg-file=/root/packages.chroot aptitude ${APTITUDE_OPTIONS} install"
|
2008-04-17 03:13:49 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2008-08-07 21:05:08 +00:00
|
|
|
# Tidying up
|
2011-09-07 13:59:48 +00:00
|
|
|
rm -f chroot/root/packages.chroot
|
2008-04-17 03:13:49 +00:00
|
|
|
|
|
|
|
# Saving cache
|
2015-01-06 02:46:37 -01:00
|
|
|
Save_package_cache chroot
|
2008-04-17 03:13:49 +00:00
|
|
|
|
|
|
|
fi
|
2008-08-12 05:44:21 +00:00
|
|
|
|
|
|
|
# Creating stage file
|
2020-03-12 00:21:39 -01:00
|
|
|
Create_stagefile "${STAGE_FILE}"
|