From 41bb5ff36d823b41be2835f59625fa584e9cb7cf Mon Sep 17 00:00:00 2001 From: 3405691582 Date: Tue, 4 Aug 2026 19:01:02 +0000 Subject: [PATCH] Fail more quickly if the deb argument is wrong. If there's a mistake or issue with the linux_image_deb argument, then this only gets detected later in the process after several minutes. This hopefully should check the argument earlier, failing a little more quicker. --- tools/baseimage/pkg/gce/scripts/install_kernel_main.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/baseimage/pkg/gce/scripts/install_kernel_main.sh b/tools/baseimage/pkg/gce/scripts/install_kernel_main.sh index 73d1fe49653..6780bf80596 100644 --- a/tools/baseimage/pkg/gce/scripts/install_kernel_main.sh +++ b/tools/baseimage/pkg/gce/scripts/install_kernel_main.sh @@ -27,13 +27,21 @@ arch=$(uname -m) [ "${arch}" = "aarch64" ] && arch=arm64 sudo apt-get update +sudo chroot /mnt/image /usr/bin/apt-get update + +if ! sudo chroot /mnt/image /usr/bin/apt-get install --dry-run \ + "${linux_image_deb}" > /dev/null; then + echo "CREATE IMAGE FAILED!!!" + echo "Package not found: ${linux_image_deb}" + exit 1 +fi + sudo apt-get upgrade -y version=$(sudo chroot /mnt/image/ /usr/bin/dpkg -s linux-image-cloud-${arch} | grep ^Depends: | \ cut -d: -f2 | cut -d" " -f2 ) echo "START VERSION: ${version}" -sudo chroot /mnt/image /usr/bin/apt-get update sudo chroot /mnt/image /usr/bin/apt-get dist-upgrade -y version=$(sudo chroot /mnt/image/ /usr/bin/dpkg -s linux-image-cloud-${arch} | grep ^Depends: | \