pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Can anybody come with a creative solution to the "/bin/sh: bad interpreter" problem?



Hi all,

I've been away from pkgsrc and all things Netbsd for a while.

I've always toyed with the idea of bootstrapping pkgsrc on my Nexus 7 (Android 6.1) and I decided to give it a go.

Ive installed the excellent Termux app:
https://termux.com/

Installed a bunch of packages from the built in package manager apt, finally downloaded pkgsrc via CVS and then proceeded to bootstrap.

This is where problems start.

Most, if not all, pkgsrc scripta are simple shell scripts that start with the canonical shebang:
#! /bin/sh

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.

The /bin directory does not exist and cannot be created unless one roots the device, which I'm not willing to do yet. As a consequence one cannot create a link to /bin/sh.

On a single basis there are two solutions: 

Either one launches a script like this:

sh bootstrap --unprivileged

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.

You guys know pkgscr from the inside out. I wonder if you can come with a solution before I give up on it.

Thanks

Ottavio


Home | Main Index | Thread Index | Old Index