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 /functions | |
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 'functions')
-rwxr-xr-x | functions/packagelists.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/functions/packagelists.sh b/functions/packagelists.sh index 906697264..8470d9af9 100755 --- a/functions/packagelists.sh +++ b/functions/packagelists.sh @@ -118,3 +118,30 @@ Expand_packagelist () done done } + +Discover_package_architectures () +{ + _LB_EXPANDED_PKG_LIST="${1}" + _LB_DISCOVERED_ARCHITECTURES="" + + shift + + if [ -e "${_LB_EXPANDED_PKG_LIST}" ] && [ -s "${_LB_EXPANDED_PKG_LIST}" ] + then + while read _LB_PACKAGE_LINE + do + # Lines from the expanded package list may have multiple, space-separated packages + for _LB_PACKAGE_LINE_PART in ${_LB_PACKAGE_LINE} + do + # Looking for <package>:<architecture> + if [ -n "$(echo ${_LB_PACKAGE_LINE_PART} | awk -F':' '{print $2}')" ] + then + _LB_DISCOVERED_ARCHITECTURES="${_LB_DISCOVERED_ARCHITECTURES} $(echo ${_LB_PACKAGE_LINE_PART} | awk -F':' '{print $2}')" + fi + done + done < "${_LB_EXPANDED_PKG_LIST}" + + # Output unique architectures, alpha-sorted, one per line + echo "${_LB_DISCOVERED_ARCHITECTURES}" | tr -s '[:space:]' '\n' | sort | uniq + fi +} |