Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: allow /bin for other distros, hardcoded /usr/bin/run-parts makes build to fail #7430

Open
1 task
amateur80lvl opened this issue Nov 3, 2024 · 1 comment
Assignees
Labels
Feature Request Feature suggestion

Comments

@amateur80lvl
Copy link

amateur80lvl commented Nov 3, 2024

Hello,
while playing with Devuan daedalus I found bash and run-parts are located in /bin. I know, daedalus seems to be phased out soon and excalibur has everything in place, but I checked other distros not following ubuntu way:

2 of 3, as an excuse for this issue. Ah, plus 0.5 points for Devuan.

This may save time for those who want their Armpines or Armtoos. Below is my fix, I believe you can do that better:

--- a/lib/functions/image/initrd.sh
+++ b/lib/functions/image/initrd.sh
@@ -42,6 +42,15 @@ update_initramfs() {
                exit_with_error "No kernel installed for the version" "${IMAGE_INSTALLED_KERNEL_VERSION}"
        fi
 
+       local bash_location=/usr/bin/bash
+       if [ ! -x "${chroot_target}{bash_location}" ] ; then
+               bash_location=/bin/bash
+       fi
+       local run_parts_location=/usr/bin/run-parts
+       if [ ! -x "${chroot_target}{run_parts_location}" ] ; then
+               run_parts_location=/bin/run-parts
+       fi
+
        # Caching.
        # Find all modules and all firmware in the target.
        # Find all initramfs configuration in /etc
@@ -53,7 +62,7 @@ update_initramfs() {
        mkdir -p "${SRC}/cache/initrd"
        initrd_cache_current_manifest_filepath="${WORKDIR}/initrd.img-${initrd_kern_ver}.${ARMBIAN_BUILD_UUID}.manifest"
        initrd_cache_last_manifest_filepath="${SRC}/cache/initrd/initrd.manifest-${initrd_kern_ver}.last.manifest"
-       initrd_files_to_hash=("${chroot_target}/usr/bin/bash" "${chroot_target}/etc/initramfs")
+       initrd_files_to_hash=("${chroot_target}{bash_location}" "${chroot_target}/etc/initramfs")
        initrd_files_to_hash+=("${chroot_target}/etc/initramfs-tools" "${chroot_target}/usr/share/initramfs-tools/")
        initrd_files_to_hash+=("${chroot_target}/etc/modprobe.d") # for MODULES_BLACKLIST
 
@@ -89,7 +98,7 @@ update_initramfs() {
 
                # Convert to bootscript expected format, by calling into the script manually.
                if [[ -d "${chroot_target}"/etc/initramfs/post-update.d/ ]]; then
-                       chroot_custom "$chroot_target" /usr/bin/run-parts -a "${initrd_kern_ver}" -a "/boot/initrd.img-${initrd_kern_ver}" /etc/initramfs/post-update.d/
+                       chroot_custom "$chroot_target" "${run_parts_location}" -a "${initrd_kern_ver}" -a "/boot/initrd.img-${initrd_kern_ver}" /etc/initramfs/post-update.d/
                fi
        else
                display_alert "Cache miss for initrd cache" "${initrd_cache_key}" "debug"

Funding

Copy link

github-actions bot commented Nov 3, 2024

Jira ticket: AR-2523

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Feature suggestion
Development

No branches or pull requests

2 participants