From cceafdaca0756947b5054dc280196baf6eaa35a7 Mon Sep 17 00:00:00 2001 From: Douglas Teles Date: Wed, 24 Jun 2026 01:51:41 -0300 Subject: [PATCH] pacman: rewrite /usr/sbin/bash shebangs to /usr/bin/bash Upstream pacman ships pacman-key, makepkg, vercmp and friends as bash scripts whose shebang is built against the configured sbindir (/usr/sbin on Arch). Arch ships /usr/sbin as a symlink to /usr/bin via the usrmerge package, so the shebang resolves fine. ArchR (LibreELEC heritage) does NOT merge sbin: /usr/sbin is a real directory and bash lives at /usr/bin/bash only. Result on a fresh boot: archr:~ # pacman-key --init -sh: /usr/bin/pacman-key: /usr/sbin/bash: bad interpreter: No such file or directory which also makes the pacman-init.service silently miss the keyring populate step. Post-install pass that rewrites every "#!/usr/sbin/bash" first line to "#!/usr/bin/bash" anywhere under ${INSTALL}/usr fixes the lot in one shot. The pkg.tar.zst we ship in the repo will need the same treatment, but that's handled at build time too because gen-pacman-repo packages whatever install_pkg holds. Co-Authored-By: Claude Opus 4.7 --- projects/ArchR/packages/sysutils/pacman/package.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/ArchR/packages/sysutils/pacman/package.mk b/projects/ArchR/packages/sysutils/pacman/package.mk index 2e06360c79..926cd6f7b3 100644 --- a/projects/ArchR/packages/sysutils/pacman/package.mk +++ b/projects/ArchR/packages/sysutils/pacman/package.mk @@ -63,6 +63,16 @@ post_makeinstall_target() { mkdir -p ${INSTALL}/usr/bin cp ${PKG_DIR}/scripts/pacman-init ${INSTALL}/usr/bin/pacman-init chmod +x ${INSTALL}/usr/bin/pacman-init + + # Pacman ships several bash scripts (pacman-key, makepkg, vercmp, etc.) + # whose shebang is built against the upstream sbindir which on Arch + # is /usr/sbin (with /usr/sbin -> /usr/bin via usrmerge). LibreELEC + # does not merge usr/sbin, so /usr/sbin/bash does not exist and every + # one of these scripts dies with "bad interpreter: No such file or + # directory". Rewrite the shebangs to /usr/bin/bash where bash + # actually lives in our rootfs. + find ${INSTALL}/usr -type f -exec \ + sed -i '1s|^#!/usr/sbin/bash$|#!/usr/bin/bash|' {} + } post_install() {