summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-02-11 17:44:31 +0000
committerLuca Boccassi <bluca@debian.org>2020-03-05 22:13:57 +0000
commitaa745de0bbdfec3a2e23f4d76b081664d5d24673 (patch)
tree74349789de9bf07af8c773e750311f14414910dc /functions
parent4933beffce1f4467bf93ef5fc6711e4d2dff901f (diff)
downloadvyos-live-build-aa745de0bbdfec3a2e23f4d76b081664d5d24673.tar.gz
vyos-live-build-aa745de0bbdfec3a2e23f4d76b081664d5d24673.zip
firmware: de-dup firmware list parsing
Edit: There were four copies of the same logic to keep in sync; Originally this patch deduplicated each file, but leaving a copy of the new function in each, thus reducing the duplication but not eliminating it. A later patch moved it into a shared function file following further enhancements to the code in question. This has since been revised to have the function moved to a shared file here, which simplifies and gives a cleaner diff. Gbp-Dch: Short Closes: #952908
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/firmwarelists.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/functions/firmwarelists.sh b/functions/firmwarelists.sh
new file mode 100755
index 000000000..5c552fc98
--- /dev/null
+++ b/functions/firmwarelists.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+##
+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+# Updates FIRMWARE_PACKAGES with list of packages determined from specified
+# archive areas of specified distro, based upon reading archive content file.
+#
+# Shared by chroot_firmware and installer_debian-installer
+#
+# Assumption: firmware packages install files into /lib/firmware
+Firmware_List_From_Contents () {
+ local MIRROR_CHROOT="${1}"
+ local DISTRO_CHROOT="${2}"
+ local ARCHIVE_AREAS="${3}"
+
+ local CONTENTS_FILE="cache/contents.chroot/contents.${DISTRO_CHROOT}.${LB_ARCHITECTURES}"
+
+ # Ensure fresh
+ rm -f "${CONTENTS_FILE}"
+
+ for _ARCHIVE_AREA in ${ARCHIVE_AREAS}
+ do
+ local CONTENTS_URL="${MIRROR_CHROOT}/dists/${DISTRO_CHROOT}/${_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz"
+
+ wget ${WGET_OPTIONS} "${CONTENTS_URL}" -O - | gunzip -c >> "${CONTENTS_FILE}"
+ done
+
+ FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' "${CONTENTS_FILE}" | sort -u)"
+
+ # Don't waste disk space preserving since always getting fresh
+ rm -f "${CONTENTS_FILE}"
+}