Skip to content

Commit 1dbc267

Browse files
committed
feat(plugins): initrd: fix removal ordering
On amd64, the CPU microcode packages get removed if we rm -rf ${INITRD_ROOT}/lib/firmware *after* we configure the chroot, because chroot_configure() installs the microcode packages! Clean firmware, modules first. Then configure. Signed-off-by: Dilyn Corner <dilyn.corner@canonical.com>
1 parent 65ad34f commit 1dbc267

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

snapcraft/parts/plugins/initrd_build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,13 @@ run() {
489489

490490
# Configure chroot
491491
[ -e "${BASE_CONFIGURED}" ] || {
492-
chroot_configure
493-
494-
echo "Installing kernel, firmware, and modules into chroot"
495492
# Remove any existing firmware and modules first
496-
rm -rf "${INITRD_ROOT}/usr/lib/firmware/"* \
497-
"${INITRD_ROOT}/usr/lib/modules"/*
493+
[ ! -e "${INITRD_ROOT}/usr/lib/modules" ] || rm -rf "${INITRD_ROOT}/usr/lib/modules"
494+
[ ! -e "${INITRD_ROOT}/usr/lib/firmware" ] || rm -rf "${INITRD_ROOT}/usr/lib/firmware"
495+
496+
chroot_configure
498497
# Install kernel, firmware, modules into chroot
498+
echo "Installing kernel, firmware, and modules into chroot"
499499
cp --archive --link --force "${KERNEL_FIRMWARE}" \
500500
"${KERNEL_MODULES}" \
501501
"${INITRD_ROOT}/usr/lib"

0 commit comments

Comments
 (0)