diff options
author | Kiel Christofferson <kiel@endpoint.com> | 2013-06-20 11:36:01 -0400 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2014-03-02 06:22:13 +0100 |
commit | 3c69e6b56c381f62790b449d5d7661e712eb920c (patch) | |
tree | f98fb72401aedac076730749c1f2c3f0c0b905f6 /scripts/build/chroot_install-packages | |
parent | 9240aa3d3ef3c23b3dfea1deb066efdc56dc0e38 (diff) | |
download | vyos-live-build-3c69e6b56c381f62790b449d5d7661e712eb920c.tar.gz vyos-live-build-3c69e6b56c381f62790b449d5d7661e712eb920c.zip |
Auto-detect foreign architectures in packagelist.
* Add function to output unique list of foreign architectures from an
expanded package list.
* If foreign architectures are detected, add unique architectures
to dpkg and update apt.
* This requires users to explicitly list at least _one_ package of a
foreign architecture in their package list (e.g. foo:arch) for any other
foreign arch dependencies to be handled appropriately.
Diffstat (limited to 'scripts/build/chroot_install-packages')
-rwxr-xr-x | scripts/build/chroot_install-packages | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/build/chroot_install-packages b/scripts/build/chroot_install-packages index 930ececf0..a578a659a 100755 --- a/scripts/build/chroot_install-packages +++ b/scripts/build/chroot_install-packages @@ -42,6 +42,38 @@ Check_lockfile .lock # Creating lock file Create_lockfile .lock +# 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 + if [ -e chroot/root/packages.chroot ] && [ -s chroot/root/packages.chroot ] then # Restoring cache |