From e190d999908fc85814792c3b7ecdb3dd3c03e24b Mon Sep 17 00:00:00 2001 From: Steve McIntyre Date: Mon, 19 Jun 2017 01:32:30 +0100 Subject: [PATCH] Add explicit support for firmware packages These are treated like "extra" packages during image creation, but are also copied into /firmware in the cdroot. That's where d-i will look for them on firmware-included images. --- hooks/customise.sh | 8 +++++++- lwr/run.py | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/hooks/customise.sh b/hooks/customise.sh index acc6a02..df32dcd 100755 --- a/hooks/customise.sh +++ b/hooks/customise.sh @@ -17,7 +17,13 @@ cat /etc/resolv.conf > ${rootdir}/etc/resolv.conf prepare_apt_source "${LWR_MIRROR}" "${LWR_DISTRIBUTION}" -chroot ${rootdir} apt-get -y install initramfs-tools live-boot live-config ${LWR_TASK_PACKAGES} ${LWR_EXTRA_PACKAGES} task-laptop task-english libnss-myhostname +${LWR_EXTRA_PACKAGES} task-laptop task-english libnss-myhostname +for PKG in ${FIRMWARE_PKGS}; do + echo "$PKG $PKG/license/accepted boolean true" | \ + chroot ${rootdir} debconf-set-selections +done + +chroot ${rootdir} apt-get -q -y install initramfs-tools live-boot live-config ${LWR_TASK_PACKAGES} ${LWR_EXTRA_PACKAGES} ${LWR_FIRMWARE_PACKAGES} task-laptop task-english libnss-myhostname >> vmdebootstrap.log 2>&1 # Temporary fix for #843983 chroot ${rootdir} chmod 755 / diff --git a/lwr/run.py b/lwr/run.py index 4ef0440..c2b385c 100644 --- a/lwr/run.py +++ b/lwr/run.py @@ -82,6 +82,10 @@ class LiveWrapper(cliapp.Application): ['e', 'extra'], 'Extra packages to install', metavar='"PKG1 PKG2 ..."', group='Packages') + self.settings.string( + ['f', 'firmware'], 'Firmware packages to install', + metavar='"PKG1 PKG2 ..."', + group='Packages') self.settings.boolean( ['isolinux'], 'Add isolinux bootloader to the image ' '(default: %default)', default=True, group="Bootloaders") @@ -205,6 +209,7 @@ class LiveWrapper(cliapp.Application): os.environ['LWR_DISTRIBUTION'] = self.settings['distribution'] os.environ['LWR_TASK_PACKAGES'] = self.settings['tasks'] os.environ['LWR_EXTRA_PACKAGES'] = self.settings['extra'] + os.environ['LWR_FIRMWARE_PACKAGES'] = self.settings['firmware'] for envvar in os.environ.keys(): if envvar.startswith('LWR_'): @@ -263,6 +268,21 @@ class LiveWrapper(cliapp.Application): print("... completed udeb downloads") logging.info("... completed udeb downloads") + # Download the firmware debs if desired + if len(self.settings['firmware']) > 0: + logging.info("Downloading firmware debs...") + + # FIXME: may need a change to the download location + fw_root = self.cdroot['firmware'].path + handler = get_apt_handler(fw_root, + self.settings['mirror'], + self.settings['distribution'], + self.settings['architecture']) + for pkg in self.settings['firmware'].split(' '): + filename = handler.download_package(pkg, fw_root) + handler.clean_up_apt() + logging.info("... firmware deb downloads") + # Generate boot config bootconfig = BootloaderConfig(self.cdroot.path)