mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-07-12 18:19:42 -07:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user