extensions: Add "Extension: ${EXTENSION}: " prefix to some extension logs

Establish some consistency with extension logging. Some extensions use another format:
display_alert "message" "${EXTENSION}" "info"

These were *not* adapted to this new schema.
This commit is contained in:
ColorfulRhino
2024-07-05 20:07:30 +02:00
committed by Igor
parent b6b8a89f10
commit cc59d8af9e
19 changed files with 79 additions and 78 deletions

View File

@@ -1,6 +1,6 @@
function post_family_tweaks_bsp__armbian-live-patch() {
display_alert "Installing Armbian Live Patch" "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Installing Armbian Live Patch" "${EXTENSION}" "info"
run_host_command_logged cat <<- 'armbian-live-patch' > "${destination}"/etc/systemd/system/armbian-live-patch.service
# Armbian simple patch system service

View File

@@ -8,11 +8,11 @@
# To use, enable_extension bluetooth-hciattach, and set BLUETOOTH_HCIATTACH_PARAMS and BLUETOOTH_HCIATTACH_RKFILL_NUM.
function extension_prepare_config__bluetooth_hciattach() {
display_alert "${EXTENSION} ${BOARD}" "initializing config" "info"
display_alert "Extension: ${EXTENSION}: ${BOARD}" "initializing config" "info"
# Bomb if BLUETOOTH_HCIATTACH_PARAMS is not set.
if [[ -z "${BLUETOOTH_HCIATTACH_PARAMS}" ]]; then
exit_with_error "${EXTENSION} ${BOARD} - BLUETOOTH_HCIATTACH_PARAMS is not set - please set in the board file."
exit_with_error "Extension: ${EXTENSION}: ${BOARD} - BLUETOOTH_HCIATTACH_PARAMS is not set - please set in the board file."
fi
# Default BLUETOOTH_HCIATTACH_RKFILL_NUM to 0 if not set.
@@ -23,13 +23,13 @@ function extension_prepare_config__bluetooth_hciattach() {
# Add bluetooth packages to the image (not rootfs cache)
function post_family_config__bluetooth_hciattach_add_bluetooth_packages() {
display_alert "${EXTENSION} ${BOARD}" "adding bluetooth packages to image" "info"
display_alert "Extension: ${EXTENSION}: ${BOARD}" "adding bluetooth packages to image" "info"
add_packages_to_image rfkill bluetooth bluez bluez-tools
}
# Deploy the script and the systemd service in the BSP. It'll be enabled below in the image.
function post_family_tweaks_bsp__bluetooth_hciattach_add_systemd_service() {
display_alert "${EXTENSION} ${BOARD}" "adding bluetooth hciattach service to BSP" "info"
display_alert "Extension: ${EXTENSION}: ${BOARD}" "adding bluetooth hciattach service to BSP" "info"
: "${destination:?destination is not set}"
declare script_dir="/usr/local/sbin"
@@ -61,7 +61,7 @@ function post_family_tweaks_bsp__bluetooth_hciattach_add_systemd_service() {
# Enable the service created in the BSP above.
function post_family_tweaks__bluetooth_hciattach_enable_bt_service_in_image() {
display_alert "${EXTENSION} ${BOARD}" "enabling bluetooth hciattach service in the image" "info"
display_alert "Extension: ${EXTENSION}: ${BOARD}" "enabling bluetooth hciattach service in the image" "info"
chroot_sdcard systemctl --no-reload enable "bluetooth-hciattach.service"

View File

@@ -2,6 +2,6 @@
# Enable this extension if you need a C++ compiler during the build.
function add_host_dependencies__add_arm64_c_plus_plus_compiler() {
display_alert "Adding arm64 c++ compiler to host dependencies" "g++" "debug"
display_alert "Extension: ${EXTENSION}: Adding arm64 c++ compiler to host dependencies" "g++" "debug"
declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} g++-aarch64-linux-gnu g++" # @TODO: convert to array later
}

View File

@@ -22,15 +22,15 @@ function post_umount_final_image__200_zerofree() {
local partType
partType="$(file -s "${partDev}" | awk -F ': ' '{print $2}')"
if [[ "${partType}" == *"ext4"* ]]; then
display_alert "Zerofreeing ext4 partition ${partDev}" "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Zerofreeing ext4 partition ${partDev}" "${EXTENSION}" "info"
run_host_command_logged zerofree "${partDev}"
else
display_alert "Skipping zerofreeing partition ${partDev} of type '${partType}'" "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Skipping zerofreeing partition ${partDev} of type '${partType}'" "${EXTENSION}" "info"
fi
done
}
function pre_umount_final_image__999_show_space_usage() {
display_alert "Calculating used space in image" "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Calculating used space in image" "${EXTENSION}" "info"
run_host_command_logged "cd ${MOUNT} && " du -h -d 4 -x "." "| sort -h | tail -20"
}

View File

@@ -23,6 +23,7 @@ function extension_prepare_config__ci_image_suffix() {
function extension_prepare_config__prepare_ci() {
# Cloud Init related packages selected from Ubuntu RPI distirbution
display_alert "Extension: ${EXTENSION}: Adding extra packages to image" "cloud-init cloud-initramfs-dyn-netconf" "info"
add_packages_to_image cloud-init cloud-initramfs-dyn-netconf
}
@@ -30,23 +31,23 @@ function extension_prepare_config__ci_compatibility_check() {
# We require fat boot partition, will change and if the user provided another type, will fail.
if [[ -z "${BOOTFS_TYPE}" ]]; then
declare -g BOOTFS_TYPE="fat"
display_alert "Changing BOOTFS_TYPE" "cloud_init requires a fat partition" "warn"
display_alert "Extension: ${EXTENSION}: Changing BOOTFS_TYPE" "cloud_init requires a fat partition" "warn"
fi
if [[ "${BOOTFS_TYPE}" != "fat" ]]; then
exit_with_error "BOOTFS_TYPE ${BOOTFS_TYPE} not compatible with cloud-init"
exit_with_error "Extension: ${EXTENSION}: BOOTFS_TYPE ${BOOTFS_TYPE} not compatible with cloud-init"
fi
}
function pre_customize_image__inject_cloud_init_config() {
# Copy the NoCLoud Cloud-Init Configuration
display_alert "Configuring" "cloud-init" "info"
display_alert "Extension: ${EXTENSION}: Configuring" "cloud-init" "info"
local config_src="${EXTENSION_DIR}/config"
local config_dst="${SDCARD}/etc/cloud/cloud.cfg.d"
run_host_command_logged cp ${config_src}/* $config_dst
# Provide default cloud-init files
display_alert "Defaults" "cloud-init" "info"
display_alert "Extension: ${EXTENSION}: Defaults" "cloud-init" "info"
local defaults_src="${EXTENSION_DIR}/defaults"
local defaults_dst="${SDCARD}/boot"
run_host_command_logged cp ${defaults_src}/* $defaults_dst
@@ -55,7 +56,7 @@ function pre_customize_image__inject_cloud_init_config() {
# @TODO: would be better to have "armbian first run" as an extension that can be disabled
function pre_customize_image__disable_armbian_first_run() {
display_alert "Disabling" "armbian first run" "info"
display_alert "Extension: ${EXTENSION}: Disabling" "armbian firstrun" "info"
# Clean up default profile and network
rm -f ${SDCARD}/etc/profile.d/armbian-check-first-*

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
function pre_umount_final_image__install_fake_vcgencmd() {
display_alert "Installing fake vcgencmd" "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Installing fake vcgencmd" "${EXTENSION}" "info"
if [[ $BOARD != rpi4b ]]; then
run_host_command_logged curl -vo "${MOUNT}"/usr/bin/vcgencmd "https://raw.githubusercontent.com/clach04/fake_vcgencmd/0.0.2/vcgencmd"
@@ -11,6 +11,6 @@ function pre_umount_final_image__install_fake_vcgencmd() {
run_host_command_logged curl -vo "${MOUNT}"/usr/share/doc/fake_vcgencmd/LICENSE "https://raw.githubusercontent.com/clach04/fake_vcgencmd/0.0.2/LICENSE"
run_host_command_logged curl -vo "${MOUNT}"/usr/share/doc/fake_vcgencmd/README.md "https://raw.githubusercontent.com/clach04/fake_vcgencmd/0.0.2/README.md"
else
display_alert "Omitting installation on Raspberry Pi boards as these ship the original vcgencmd" "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Omitting installation on Raspberry Pi boards as these ship the original vcgencmd" "${EXTENSION}" "info"
fi
}

View File

@@ -3,11 +3,11 @@
# This is automatically enabled if ROOTFS_TYPE is set to btrfs in main-config.sh.
function extension_prepare_config__add_to_image_btrfs-progs() {
display_alert "Adding btrfs-progs extra package..." "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Adding extra package to image" "btrfs-progs" "info"
add_packages_to_image btrfs-progs
}
function add_host_dependencies__add_btrfs_tooling() {
display_alert "Adding BTRFS to host dependencies" "BTRFS" "debug"
display_alert "Extension: ${EXTENSION}: Adding packages to host dependencies" "btrfs-progs" "debug"
EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} btrfs-progs" # @TODO: convert to array later
}

View File

@@ -3,12 +3,12 @@
# This is automatically enabled if CRYPTROOT_ENABLE is set to yes in main-config.sh.
function add_host_dependencies__add_cryptroot_tooling() {
display_alert "Adding cryptroot to host dependencies" "cryptsetup LUKS" "debug"
display_alert "Extension: ${EXTENSION}: Adding packages to host dependencies" "cryptsetup openssh-client" "info"
EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} cryptsetup openssh-client" # @TODO: convert to array later
}
function extension_prepare_config__prepare_cryptroot() {
display_alert "Adding rootfs encryption related packages" "cryptsetup cryptsetup-initramfs" "info"
display_alert "Extension: ${EXTENSION}: Adding extra packages to image" "cryptsetup cryptsetup-initramfs" "info"
add_packages_to_image cryptsetup cryptsetup-initramfs
# Config for cryptroot, a boot partition is required.
@@ -16,7 +16,7 @@ function extension_prepare_config__prepare_cryptroot() {
EXTRA_IMAGE_SUFFIXES+=("-crypt")
if [[ $CRYPTROOT_SSH_UNLOCK == yes ]]; then
display_alert "Adding rootfs encryption related packages" "dropbear-initramfs" "info"
display_alert "Extension: ${EXTENSION}: Adding extra packages to image" "dropbear-initramfs" "info"
add_packages_to_image dropbear-initramfs
fi
}
@@ -24,10 +24,10 @@ function extension_prepare_config__prepare_cryptroot() {
function prepare_root_device__encrypt_root_device() {
# We encrypt the rootdevice (currently a loop device) and return the new mapped rootdevice
check_loop_device "$rootdevice"
display_alert "Encrypting root partition with LUKS..." "cryptsetup luksFormat $rootdevice" ""
display_alert "Extension: ${EXTENSION}: Encrypting root partition with LUKS..." "cryptsetup luksFormat $rootdevice" ""
echo -n $CRYPTROOT_PASSPHRASE | cryptsetup luksFormat $CRYPTROOT_PARAMETERS $rootdevice -
echo -n $CRYPTROOT_PASSPHRASE | cryptsetup luksOpen $rootdevice $ROOT_MAPPER -
display_alert "Root partition encryption complete." "" "ext"
display_alert "Extension: ${EXTENSION}: Root partition encryption complete." "" "ext"
# TODO: pass /dev/mapper to Docker
rootdevice=/dev/mapper/$ROOT_MAPPER # used by `mkfs` and `mount` commands
}
@@ -56,7 +56,7 @@ function pre_install_kernel_debs__adjust_dropbear_configuration() {
else
# generate a default ssh key for login on dropbear in initramfs
# this key should be changed by the user on first login
display_alert "Generating a new SSH key pair for dropbear (initramfs)" "" ""
display_alert "Extension: ${EXTENSION}: Generating a new SSH key pair for dropbear (initramfs)" "" ""
# Generate the SSH keys
ssh-keygen -t ecdsa -f "${dropbear_dir}"/id_ecdsa \
@@ -68,7 +68,7 @@ function pre_install_kernel_debs__adjust_dropbear_configuration() {
CRYPTROOT_SSH_UNLOCK_KEY_NAME="${VENDOR}_${REVISION}_${BOARD^}_${RELEASE}_${BRANCH}_${DESKTOP_ENVIRONMENT}".key
# copy dropbear ssh key to image output dir for convenience
cp "${dropbear_dir}"/id_ecdsa "${DEST}/images/${CRYPTROOT_SSH_UNLOCK_KEY_NAME}"
display_alert "SSH private key for dropbear (initramfs) has been copied to:" \
display_alert "Extension: ${EXTENSION}: SSH private key for dropbear (initramfs) has been copied to:" \
"$DEST/images/$CRYPTROOT_SSH_UNLOCK_KEY_NAME" "info"
fi
fi

View File

@@ -3,6 +3,6 @@
# This is automatically enabled if ROOTFS_TYPE is set to f2fs in main-config.sh.
function add_host_dependencies__add_f2fs_tooling() {
display_alert "Adding F2FS to host dependencies" "F2FS" "debug"
display_alert "Extension: ${EXTENSION}: Adding packages to host dependencies" "f2fs-tools" "debug"
EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} f2fs-tools" # @TODO: convert to array later
}

View File

@@ -2,12 +2,12 @@
# This is automatically enabled if ROOTFS_TYPE is set to nilfs2 in main-config.sh.
function extension_prepare_config__add_to_image_nilfs-tools() {
display_alert "Adding nilfs-tools extra package..." "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Adding extra packages to image" "nilfs-tools" "info"
add_packages_to_image nilfs-tools
}
function add_host_dependencies__add_nilfs_tools() {
display_alert "Adding NILFS tools to host dependencies..." "${EXTENSION}" "debug"
display_alert "Extension: ${EXTENSION}: Adding packages to host dependencies" "nilfs-tools" "debug"
EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} nilfs-tools" # @TODO: convert to array later
}

View File

@@ -3,11 +3,11 @@
# This is automatically enabled if ROOTFS_TYPE is set to xfs in main-config.sh.
function extension_prepare_config__add_to_image_xfsprogs() {
display_alert "Adding xfsprogs extra package..." "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Adding extra packages to image" "xfsprogs" "info"
add_packages_to_image xfsprogs
}
function add_host_dependencies__add_xfs_tooling() {
display_alert "Adding XFS to host dependencies" "XFS xfsprogs" "debug"
display_alert "Extension: ${EXTENSION}: Adding packages to host dependencies" "xfsprogs" "debug"
EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} xfsprogs" # @TODO: convert to array later
}

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
## Hooks
function extension_metadata_ready__499_display_docs_generation_start_info() {
display_alert "Generating hook documentation and sample extension"
display_alert "Extension: ${EXTENSION}: Generating hook documentation and sample extension"
}
function extension_metadata_ready__docs_markdown() {

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# This runs *after* user_config. Don't change anything not coming from other variables or meant to be configured by the user.
function extension_prepare_config__prepare_grub-riscv64() {
display_alert "Prepare config" "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Prepare config" "${EXTENSION}" "info"
# Extension configuration defaults.
declare -g DISTRO_GENERIC_KERNEL=${DISTRO_GENERIC_KERNEL:-no} # if yes, does not build our own kernel, instead, uses generic one from distro
declare -g UEFI_GRUB_TERMINAL="${UEFI_GRUB_TERMINAL:-serial console}" # 'serial' forces grub menu on serial console. empty to not include
@@ -20,7 +20,7 @@ function extension_prepare_config__prepare_grub-riscv64() {
declare -g UEFI_GRUB_TARGET="riscv64-efi" # Default for x86_64
if [[ "${DISTRIBUTION}" != "Ubuntu" && "${BUILDING_IMAGE}" == "yes" ]]; then
exit_with_error "${DISTRIBUTION} is not supported yet"
exit_with_error "Extension: ${EXTENSION}: ${DISTRIBUTION} is not supported yet"
fi
add_packages_to_image efibootmgr efivar cloud-initramfs-growroot busybox os-prober "grub-efi-${ARCH}-bin" "grub-efi-${ARCH}"
@@ -32,10 +32,10 @@ pre_umount_final_image__install_grub() {
configure_grub
local chroot_target="${MOUNT}"
display_alert "Installing bootloader" "GRUB" "info"
display_alert "Extension: ${EXTENSION}: Installing bootloader" "GRUB" "info"
# RiscV64 specific: actually copy the DTBs to the ESP
display_alert "Copying DTBs to ESP" "${EXTENSION}" "info"
display_alert "Extension: ${EXTENSION}: Copying DTBs to ESP" "${EXTENSION}" "info"
run_host_command_logged mkdir -pv "${chroot_target}"/boot/efi/dtb
run_host_command_logged cp -rpv "${chroot_target}"/boot/dtb/* "${chroot_target}"/boot/efi/dtb/
# RiscV64 specific: @TODO ??? what is this ??
@@ -61,15 +61,15 @@ pre_umount_final_image__install_grub() {
# shellcheck disable=SC2016 # some wierd escaping going on there.
chroot_custom "$chroot_target" mkdir -pv '/dev/disk/by-uuid/"$(grub-probe --target=fs_uuid /)"' "||" true
display_alert "Creating GRUB config..." "${EXTENSION}: grub-mkconfig / update-grub"
display_alert "Extension: ${EXTENSION}: Creating GRUB config..." "${EXTENSION}: grub-mkconfig / update-grub"
chroot_custom "$chroot_target" update-grub || {
exit_with_error "update-grub failed!"
}
local install_grub_cmdline="grub-install --target=${UEFI_GRUB_TARGET} --no-nvram --removable" # nvram is global to the host, even across chroot. take care.
display_alert "Installing GRUB EFI..." "${EXTENSION}: ${UEFI_GRUB_TARGET}"
display_alert "Extension: ${EXTENSION}: Installing GRUB EFI..." "${EXTENSION}: ${UEFI_GRUB_TARGET}"
chroot_custom "$chroot_target" "$install_grub_cmdline" || {
exit_with_error "${install_grub_cmdline} failed!"
exit_with_error "Extension: ${EXTENSION}: ${install_grub_cmdline} failed!"
}
### Sanity check. The produced "/boot/grub/grub.cfg" should:
@@ -77,23 +77,23 @@ pre_umount_final_image__install_grub() {
# - 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"
display_alert "Extension: ${EXTENSION}: 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"
display_alert "Extension: ${EXTENSION}: 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"
display_alert "Extension: ${EXTENSION}: 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"
display_alert "Extension: ${EXTENSION}: 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"
exit_with_error "Extension: ${EXTENSION}: GRUB config sanity check failed, image will be unbootable; see above errors"
fi
# Remove host-side config.
@@ -122,7 +122,7 @@ configure_grub() {
run_host_command_logged chmod -v +x "${MOUNT}"/usr/share/desktop-base/grub_background.sh
fi
display_alert "GRUB EFI kernel cmdline" "'${GRUB_CMDLINE_LINUX_DEFAULT}' distro=${UEFI_GRUB_DISTRO_NAME} timeout=${UEFI_GRUB_TIMEOUT}" ""
display_alert "Extension: ${EXTENSION}: GRUB EFI kernel cmdline" "'${GRUB_CMDLINE_LINUX_DEFAULT}' distro=${UEFI_GRUB_DISTRO_NAME} timeout=${UEFI_GRUB_TIMEOUT}" ""
cat <<- grubCfgFrag >> "${MOUNT}"/etc/default/grub.d/98-armbian.cfg
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT}"
GRUB_TIMEOUT_STYLE=menu # Show the menu with Kernel options (Armbian or -generic)...

View File

@@ -18,7 +18,7 @@ function extension_prepare_config__prepare_grub_with_dtb() {
# Make sure BOOT_FDT_FILE is set and not empty
[[ -n "${BOOT_FDT_FILE}" ]] || exit_with_error "BOOT_FDT_FILE is not set, required for grub-with-dtb"
display_alert "initializing config" "${EXTENSION} :: ${BOARD}" "info"
display_alert "Extension: ${EXTENSION}: Initializing config" "${BOARD}" "info"
}
# Hack the bsp-cli to:
@@ -27,7 +27,7 @@ function extension_prepare_config__prepare_grub_with_dtb() {
# works across Debian and Ubuntu. it reads /etc/armbian-grub-with-dtb and puts symlinks or copies in /boot/dtb-<kernel-version>
function post_family_tweaks_bsp__add_grub_with_dtb_config_file() {
: "${destination:?}"
display_alert "adding grub-with-dtb config file" "${EXTENSION} :: ${BOARD}" "info"
display_alert "Extension: ${EXTENSION}: Adding grub-with-dtb config file" "${BOARD}" "info"
# maybe add this to conffiles?
cat <<- EOD > "${destination}"/etc/armbian-grub-with-dtb
BOOT_FDT_FILE="${BOOT_FDT_FILE}"
@@ -36,7 +36,7 @@ function post_family_tweaks_bsp__add_grub_with_dtb_config_file() {
function post_family_tweaks_bsp__add_grub_with_dtb_kernel_hook() {
: "${destination:?}"
display_alert "adding grub-with-dtb kernel hook" "${EXTENSION} :: ${BOARD}" "info"
display_alert "Extension: ${EXTENSION}: Adding grub-with-dtb kernel hook" "${BOARD}" "info"
run_host_command_logged mkdir -p "${destination}"/etc/kernel/postinst.d
cat <<- 'EOD' > "${destination}"/etc/kernel/postinst.d/armbian-grub-with-dtb
#! /bin/bash
@@ -75,21 +75,21 @@ function grub_pre_install__force_run_kernel_hook_for_armbian_dtb() {
# Run the kernel hook to deploy the DTB file to the boot partition.
# This is done forcibly here during `grub_pre_install`, since the kernel hook is deployed in the bsp-cli package
# which is only deployed after the linux-image package is installed and thus is not run.
display_alert "deploy DTB for GRUB for image build" "${EXTENSION} :: ${BOARD}" "info"
display_alert "Extension: ${EXTENSION}: Deploying DTB for GRUB for image build" "${BOARD}" "info"
chroot_custom "${MOUNT}" 'for k in $(linux-version list); do /etc/kernel/postinst.d/armbian-grub-with-dtb "$k"; done'
}
function grub_late_config__check_dtb_in_grub_cfg() {
if [[ "${SHOW_DEBUG}" == "yes" ]]; then
display_alert "Debugging" "GRUB config and /boot contents" "info"
display_alert "Extension: ${EXTENSION}: Debugging" "GRUB config and /boot contents" "info"
run_tool_batcat "${MOUNT}/boot/grub/grub.cfg"
run_host_command_logged ls -la --color=always "${MOUNT}"/boot
fi
if ! grep -q 'devicetree' "${MOUNT}/boot/grub/grub.cfg"; then
display_alert "Sanity check failed" "GRUB DTB not found in grub.cfg; RELEASE=${RELEASE}" "warn"
display_alert "Extension: ${EXTENSION}: Sanity check failed" "GRUB DTB not found in grub.cfg; RELEASE=${RELEASE}" "warn"
else
display_alert "Sanity check passed" "GRUB DTB found in grub.cfg; RELEASE=${RELEASE}" "info"
display_alert "Extension: ${EXTENSION}: Sanity check passed" "GRUB DTB found in grub.cfg; RELEASE=${RELEASE}" "info"
fi
return 0
}

View File

@@ -76,12 +76,12 @@ function extension_prepare_config__prepare_grub_standard() {
# shellcheck disable=SC2086
add_packages_to_image ${DISTRO_FIRMWARE_PACKAGES} ${DISTRO_KERNEL_PACKAGES} "${packages[@]}"
display_alert "${UEFI_GRUB} activating" "GRUB with SERIALCON=${SERIALCON}; timeout ${UEFI_GRUB_TIMEOUT}; BIOS=${UEFI_GRUB_TARGET_BIOS}" ""
display_alert "Extension: ${EXTENSION}: ${UEFI_GRUB} activating" "GRUB with SERIALCON=${SERIALCON}; timeout ${UEFI_GRUB_TIMEOUT}; BIOS=${UEFI_GRUB_TARGET_BIOS}" ""
}
function post_family_tweaks_bsp__remove_uboot_grub() {
if [[ "${UEFI_GRUB}" == "skip" ]]; then
display_alert "Skipping remove uboot from BSP" "due to UEFI_GRUB:${UEFI_GRUB}" "debug"
display_alert "Extension: ${EXTENSION}: Skipping remove uboot from BSP" "due to UEFI_GRUB:${UEFI_GRUB}" "debug"
return 0
fi
@@ -95,7 +95,7 @@ function post_family_tweaks_bsp__remove_uboot_grub() {
function pre_umount_final_image__remove_uboot_initramfs_hook_grub() {
if [[ "${UEFI_GRUB}" == "skip" ]]; then
display_alert "Skipping GRUB install" "due to UEFI_GRUB:${UEFI_GRUB}" "debug"
display_alert "Extension: ${EXTENSION}: Skipping GRUB install" "due to UEFI_GRUB:${UEFI_GRUB}" "debug"
return 0
fi
@@ -106,9 +106,9 @@ function pre_umount_final_image__remove_uboot_initramfs_hook_grub() {
pre_umount_final_image__install_grub() {
if [[ "${UEFI_GRUB}" == "skip" ]]; then
display_alert "Skipping GRUB install" "due to UEFI_GRUB:${UEFI_GRUB}" "debug"
display_alert "Extension: ${EXTENSION}: Skipping GRUB install" "due to UEFI_GRUB:${UEFI_GRUB}" "debug"
if [[ "${DISTRO_GENERIC_KERNEL}" == "yes" ]]; then
display_alert "Skipping GRUB install" "due to UEFI_GRUB:${UEFI_GRUB} - calling update_initramfs directly with IMAGE_INSTALLED_KERNEL_VERSION=${DISTRO_KERNEL_VER}" "debug"
display_alert "Extension: ${EXTENSION}: Skipping GRUB install" "due to UEFI_GRUB:${UEFI_GRUB} - calling update_initramfs directly with IMAGE_INSTALLED_KERNEL_VERSION=${DISTRO_KERNEL_VER}" "debug"
IMAGE_INSTALLED_KERNEL_VERSION="${DISTRO_KERNEL_VER}" update_initramfs "${MOUNT}"
fi
return 0
@@ -116,7 +116,7 @@ pre_umount_final_image__install_grub() {
configure_grub
local chroot_target="${MOUNT}"
display_alert "Installing bootloader" "GRUB" "info"
display_alert "Extension: ${EXTENSION}: Installing bootloader" "GRUB" "info"
# Ubuntu's grub (10_linux) will look for /boot/dtb, /boot/dtb-<version> ...
# ... unfortunately it does not account for the fact those might be a directories (as in Armbian's linux-dtb case).
@@ -141,7 +141,7 @@ pre_umount_final_image__install_grub() {
cp "${SRC}"/packages/blobs/splash/grub.png "${MOUNT}"/usr/share/images/grub/wallpaper.png
if [[ "${DISTRO_GENERIC_KERNEL}" == "yes" ]]; then
display_alert "Using Distro Generic Kernel" "${EXTENSION}: update_initramfs with IMAGE_INSTALLED_KERNEL_VERSION: ${DISTRO_KERNEL_VER}" "debug"
display_alert "Extension: ${EXTENSION}: Using Distro Generic Kernel" "${EXTENSION}: update_initramfs with IMAGE_INSTALLED_KERNEL_VERSION: ${DISTRO_KERNEL_VER}" "debug"
IMAGE_INSTALLED_KERNEL_VERSION="${DISTRO_KERNEL_VER}" update_initramfs "${MOUNT}"
fi
@@ -154,14 +154,14 @@ pre_umount_final_image__install_grub() {
GRUB_PRE_INSTALL
if [[ "${UEFI_GRUB_TARGET_BIOS}" != "" ]]; then
display_alert "Installing GRUB BIOS..." "${UEFI_GRUB_TARGET_BIOS} device ${LOOP}" ""
display_alert "Extension: ${EXTENSION}: Installing GRUB BIOS..." "${UEFI_GRUB_TARGET_BIOS} device ${LOOP}" ""
chroot_custom "$chroot_target" grub-install --target=${UEFI_GRUB_TARGET_BIOS} "${LOOP}" || {
exit_with_error "${install_grub_cmdline} failed!"
}
fi
local install_grub_cmdline="grub-install --target=${UEFI_GRUB_TARGET} --no-nvram --removable" # nvram is global to the host, even across chroot. take care.
display_alert "Installing GRUB EFI..." "${UEFI_GRUB_TARGET}" ""
display_alert "Extension: ${EXTENSION}: Installing GRUB EFI..." "${UEFI_GRUB_TARGET}" ""
chroot_custom "$chroot_target" "$install_grub_cmdline" || {
exit_with_error "${install_grub_cmdline} failed!"
}
@@ -174,7 +174,7 @@ pre_umount_final_image__install_grub() {
# shellcheck disable=SC2016 # some wierd escaping going on there.
chroot_custom "$chroot_target" mkdir -pv '/dev/disk/by-uuid/"$(grub-probe --target=fs_uuid /)"' "||" true
display_alert "Creating GRUB config..." "grub-mkconfig" ""
display_alert "Extension: ${EXTENSION}: Creating GRUB config..." "grub-mkconfig" ""
chroot_custom "$chroot_target" update-grub || {
display_alert "GRUB grub-mkconfig failed" "update-grub failed; dumping full config" "err"
@@ -202,7 +202,7 @@ pre_umount_final_image__install_grub() {
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"
display_alert "Extension: ${EXTENSION}: GRUB config sanity check passed" "no '/dev' found in grub.cfg" "info"
fi
# - HAVE references to initrd, otherwise going to fail.
@@ -210,22 +210,22 @@ pre_umount_final_image__install_grub() {
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"
display_alert "Extension: ${EXTENSION}: 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"
exit_with_error "Extension: ${EXTENSION}: GRUB config sanity check failed, image will be unbootable; see above errors"
fi
# Check and warn if the wallpaper was not picked up by grub-mkconfig, if UEFI_GRUB_TERMINAL==gfxterm
if [[ "${UEFI_GRUB_TERMINAL}" =~ "gfxterm" ]]; then
if ! grep -q "background_image" "${chroot_target}/boot/grub/grub.cfg"; then
display_alert "GRUB mkconfig problem" "no wallpaper detected in generated grub.cfg" "warn"
display_alert "Extension: ${EXTENSION}: GRUB mkconfig problem" "no wallpaper detected in generated grub.cfg" "warn"
else
display_alert "GRUB config sanity check passed" "wallpaper setup" "debug"
display_alert "Extension: ${EXTENSION}: GRUB config sanity check passed" "wallpaper setup" "debug"
fi
else
display_alert "GRUB config sanity check passed" "UEFI_GRUB_TERMINAL!=gfxterm, skipping wallpaper check" "debug"
display_alert "Extension: ${EXTENSION}: GRUB config sanity check passed" "UEFI_GRUB_TERMINAL!=gfxterm, skipping wallpaper check" "debug"
fi
# Remove host-side config.
@@ -237,7 +237,7 @@ pre_umount_final_image__install_grub() {
pre_umount_final_image__900_export_kernel_and_initramfs() {
if [[ "${UEFI_EXPORT_KERNEL_INITRD}" == "yes" ]]; then
display_alert "Exporting Kernel and Initrd for" "kexec" "info"
display_alert "Extension: ${EXTENSION}: Exporting Kernel and Initrd for" "kexec" "info"
# this writes to ${DESTIMG} directly, since debootstrap.sh will move them later.
# capture the $MOUNT/boot/vmlinuz and initrd and send it out ${DESTIMG}
run_host_command_logged ls -la "${MOUNT}"/boot/vmlinuz-* "${MOUNT}"/boot/initrd.img-* || true
@@ -256,7 +256,7 @@ configure_grub() {
# Enable Armbian Wallpaper on GRUB
if [[ "${VENDOR}" == Armbian ]]; then
display_alert "Enabling" "Armbian Wallpaper on GRUB" "info"
display_alert "Extension: ${EXTENSION}: Enabling" "Armbian Wallpaper on GRUB" "info"
mkdir -p "${MOUNT}"/usr/share/desktop-base/
cat <<- grubWallpaper >> "${MOUNT}"/usr/share/desktop-base/grub_background.sh
WALLPAPER=/usr/share/images/grub/wallpaper.png
@@ -266,7 +266,7 @@ configure_grub() {
run_host_command_logged chmod -v +x "${MOUNT}"/usr/share/desktop-base/grub_background.sh
fi
display_alert "GRUB EFI kernel cmdline" "${GRUB_CMDLINE_LINUX_DEFAULT} distro=${UEFI_GRUB_DISTRO_NAME} timeout=${UEFI_GRUB_TIMEOUT}" ""
display_alert "Extension: ${EXTENSION}: GRUB EFI kernel cmdline" "${GRUB_CMDLINE_LINUX_DEFAULT} distro=${UEFI_GRUB_DISTRO_NAME} timeout=${UEFI_GRUB_TIMEOUT}" ""
cat <<- grubCfgFrag >> "${MOUNT}"/etc/default/grub.d/98-armbian.cfg
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT}"
GRUB_TIMEOUT_STYLE=menu # Show the menu with Kernel options (Armbian or -generic)...

View File

@@ -2,6 +2,6 @@
# Extension to manage network time synchronization with Chrony
#
function extension_prepare_config__install_chrony() {
display_alert "Extension: ${EXTENSION}: Installing additional packages" "chrony" "info"
display_alert "Extension: ${EXTENSION}: Adding extra package to image" "chrony" "info"
add_packages_to_image chrony
}

View File

@@ -7,16 +7,16 @@ function extension_prepare_config__install_network_manager() {
exit_with_error "Extension: ${EXTENSION}: requires NETWORKING_STACK='network-manager', currently set to '${NETWORKING_STACK}'"
fi
display_alert "Extension: ${EXTENSION}: Installing additional packages" "network-manager network-manager-openvpn netplan.io" "info"
display_alert "Extension: ${EXTENSION}: Adding extra packages to image" "network-manager network-manager-openvpn netplan.io" "info"
add_packages_to_image network-manager network-manager-openvpn netplan.io
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then
display_alert "Extension: ${EXTENSION}: Installing additional packages for desktop" "network-manager-gnome network-manager-ssh network-manager-vpnc" "info"
display_alert "Extension: ${EXTENSION}: Adding extra packages for desktop to image" "network-manager-gnome network-manager-ssh network-manager-vpnc" "info"
add_packages_to_image network-manager-gnome network-manager-ssh network-manager-vpnc
fi
if [[ "${DISTRIBUTION}" == "Ubuntu" ]]; then
display_alert "Extension: ${EXTENSION}: Installing additional packages for Ubuntu" "network-manager-config-connectivity-ubuntu" "info"
display_alert "Extension: ${EXTENSION}: Adding extra packages for Ubuntu to image" "network-manager-config-connectivity-ubuntu" "info"
add_packages_to_image network-manager-config-connectivity-ubuntu
fi
}

View File

@@ -7,7 +7,7 @@ function extension_prepare_config__install_systemd_networkd() {
exit_with_error "Extension: ${EXTENSION}: requires NETWORKING_STACK='systemd-networkd', currently set to '${NETWORKING_STACK}'"
fi
display_alert "Extension: ${EXTENSION}: Installing additional packages" "netplan.io" "info"
display_alert "Extension: ${EXTENSION}: Adding extra packages to image" "netplan.io" "info"
add_packages_to_image netplan.io
}
@@ -20,7 +20,7 @@ function pre_install_kernel_debs__configure_systemd_networkd() {
chroot_sdcard systemctl enable systemd-resolved.service || display_alert "Failed to enable systemd-resolved.service" "" "wrn"
# Copy network config files into the appropriate folders
display_alert "Configuring" "systemd-networkd and Netplan" "info"
display_alert "Extension: ${EXTENSION}: Configuring" "systemd-networkd and Netplan" "info"
local netplan_config_src_folder="${EXTENSION_DIR}/config-networkd/netplan/"
local netplan_config_dst_folder="${SDCARD}/etc/netplan/"

View File

@@ -2,7 +2,7 @@
# Extension to manage network time synchronization with systemd-timesyncd
#
function extension_prepare_config__install_systemd-timesyncd() {
display_alert "Extension: ${EXTENSION}: Installing additional packages" "systemd-timesyncd" "info"
display_alert "Extension: ${EXTENSION}: Adding extra packages to image" "systemd-timesyncd" "info"
add_packages_to_image systemd-timesyncd
}