From eb7b39cc3a2a47fbbce7f51dad888fade297d467 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 9 Jun 2024 16:00:18 +0200 Subject: [PATCH] Enhance build times disabling command-not-found during rootfs creation (#6616) --- lib/functions/configuration/main-config.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh index 4f7c13c5cd..241396be5c 100644 --- a/lib/functions/configuration/main-config.sh +++ b/lib/functions/configuration/main-config.sh @@ -571,3 +571,19 @@ function check_filesystem_compatibility_on_host() { fi return 0 } + +function pre_install_distribution_specific__disable_cnf_apt_hook(){ + if [[ $(dpkg --print-architecture) != "${ARCH}" && -f "${SDCARD}"/etc/apt/apt.conf.d/50command-not-found ]]; then #disable command-not-found (60% build-time saved under qemu) + display_alert "Disabling command-not-found during build-time to speed up image creation" "${BOARD}:${RELEASE}-${BRANCH}" "info" + run_host_command_logged mv "${SDCARD}"/etc/apt/apt.conf.d/50command-not-found "${SDCARD}"/etc/apt/apt.conf.d/50command-not-found.disabled + fi +} + + +function post_post_debootstrap_tweaks__restore_cnf_apt_hook(){ + if [ -f "${SDCARD}"/etc/apt/apt.conf.d/50command-not-found.disabled ]; then # (re-enable command-not-found after building rootfs if it's been disabled) + display_alert "Enabling command-not-found after build-time " "${BOARD}:${RELEASE}-${BRANCH}" "info" + run_host_command_logged mv "${SDCARD}"/etc/apt/apt.conf.d/50command-not-found.disabled "${SDCARD}"/etc/apt/apt.conf.d/50command-not-found + fi + +}