[Feature Request]: allow /bin for other distros, hardcoded /usr/bin/run-parts makes build to fail
Description
Checklist
hideActivity
Show:
Details
Details
Assignee
Unassigned
UnassignedReporter

Priority
Created November 3, 2024 at 6:35 AM
Updated November 3, 2024 at 6:35 AM
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:
Alpine: `/bin/run-parts` https://pkgs.alpinelinux.org/contents?name=run-parts&repo=main&branch=edge&arch=armhf
Arch: `/usr/bin/run-parts` https://archlinux.org/packages/extra/x86_64/run-parts/
Gentoo: as I see, they dobin into /, not into /usr: https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-apps/debianutils/debianutils-5.14-r1.ebuild#n36
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
+
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
[ ] [I am willing to cover expenses](https://www.armbian.com/contact/)
Raised by: https://github.com/amateur80lvl
https://github.com/armbian/build/issues/7430