armbian-next: aggregation.py and package-lists.sh usage in core grub-* extensions

- fix grub-riscv64.sh; this needs merging into grub itself later
This commit is contained in:
Ricardo Pardini 2022-11-23 00:52:51 +01:00
parent adce39d3b7
commit 0dba98b6e8
No known key found for this signature in database
GPG Key ID: 3D38CA12A66C5D02
2 changed files with 30 additions and 2 deletions

View File

@ -35,7 +35,9 @@ function extension_prepare_config__prepare_grub-riscv64() {
DISTRO_KERNEL_PACKAGES=""
DISTRO_FIRMWARE_PACKAGES=""
export PACKAGE_LIST_BOARD="${PACKAGE_LIST_BOARD} ${DISTRO_FIRMWARE_PACKAGES} ${DISTRO_KERNEL_PACKAGES} ${uefi_packages}"
# @TODO: use actual arrays. Yeah...
# shellcheck disable=SC2086
add_packages_to_image ${DISTRO_FIRMWARE_PACKAGES} ${DISTRO_KERNEL_PACKAGES} ${uefi_packages}
display_alert "Activating" "GRUB with SERIALCON=${SERIALCON}; timeout ${UEFI_GRUB_TIMEOUT}; BIOS=${UEFI_GRUB_TARGET_BIOS}" ""
}
@ -73,6 +75,30 @@ pre_umount_final_image__install_grub() {
exit_with_error "${install_grub_cmdline} failed!"
}
### Sanity check. The produced "/boot/grub/grub.cfg" should:
declare -i has_failed_sanity_check=0
# - NOT have any mention of `/dev` inside; otherwise something is going to fail
if grep -q '/dev' "${chroot_target}/boot/grub/grub.cfg"; then
display_alert "GRUB sanity check failed" "grub.cfg contains /dev" "err"
SHOW_LOG=yes run_host_command_logged grep '/dev' "${chroot_target}/boot/grub/grub.cfg" "||" true
has_failed_sanity_check=1
else
display_alert "GRUB config sanity check passed" "no '/dev' found in grub.cfg" "info"
fi
# - HAVE references to initrd, otherwise going to fail.
if ! grep -q 'initrd.img' "${chroot_target}/boot/grub/grub.cfg"; then
display_alert "GRUB config sanity check failed" "no initrd.img references found in /boot/grub/grub.cfg" "err"
has_failed_sanity_check=1
else
display_alert "GRUB config sanity check passed" "initrd.img references found OK in /boot/grub/grub.cfg" "debug"
fi
if [[ ${has_failed_sanity_check} -gt 0 ]]; then
exit_with_error "GRUB config sanity check failed, image will be unbootable; see above errors"
fi
# Remove host-side config.
rm -f "${MOUNT}"/etc/default/grub.d/99-armbian-host-side.cfg

View File

@ -61,7 +61,9 @@ function extension_prepare_config__prepare_flash_kernel() {
DISTRO_FIRMWARE_PACKAGES=""
fi
export PACKAGE_LIST_BOARD="${PACKAGE_LIST_BOARD} ${DISTRO_FIRMWARE_PACKAGES} ${DISTRO_KERNEL_PACKAGES} ${uefi_packages}"
# @TODO: use actual arrays. Yeah...
# shellcheck disable=SC2086
add_packages_to_image ${DISTRO_FIRMWARE_PACKAGES} ${DISTRO_KERNEL_PACKAGES} ${uefi_packages}
display_alert "Activating" "GRUB with SERIALCON=${SERIALCON}; timeout ${UEFI_GRUB_TIMEOUT}; BIOS=${UEFI_GRUB_TARGET_BIOS}" ""
}