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

Description

  1.  

    1.  

      1. Which feature would you like to have?

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:
```diff
— 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
+

  1. Caching.

  2. Find all modules and all firmware in the target.

  3. 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() {

  1. 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"
    ```

  1.  

    1.  

      1. Funding

Raised by: https://github.com/amateur80lvl

https://github.com/armbian/build/issues/7430

Checklist

hide

Activity

Show:

Details

Assignee

Reporter

Priority

Created November 3, 2024 at 6:35 AM
Updated November 3, 2024 at 6:35 AM