pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Can anybody come with a creative solution to the "/bin/sh: bad interpreter" problem?
On Thu, 26 Jan 2017 21:11:03 +0000 Ottavio Caruso
<ottavio2006-netbsd%yahoo.com@localhost> wrote:
> The Android filesystem is a non standard Linux-like filesystem where
> most executables reside in /system/bin.
>
> Termux adds a bunch of its own executables in
> /data/data/com.termux/files/usr/bin.
>
> [...]
>
> Or one uses the built-in script 'termux-fix-shebang', which, you
> guessed it, rewrites #!*/bin/binary to #!$PREFIX/bin/binary on a
> specified file, like this:
>
> sed -i -E "1 s@^#\!(.*)/bin/(.*)@#
> \!/data/data/com.termux/files/usr/bin/\2@" `realpath $@`
>
> All fine if you do this to each file one by one, but then bootstrap
> calls a bunch of other shell scripts, which cannot be fixed.
>
> The above mentioned script can only deal with one file at the time and
> cannot rewrite files recursively.
Well, you could use find(1) to generate out the names of all regular
files in the pkgsrc tree and pipe those to a while loop that checks
each of those for the presence of a shebang (using grep(1) ) and runs
the sed(1) script on anything that passes. This will take a while, and
will overwrite the shebang lines for all shell scripts in the tree, not
just those used in bootstrap, but it sounds like any script file that
starts with '#!/bin/sh' is useless on your system anyway.
--
IDL
Home |
Main Index |
Thread Index |
Old Index