2015-06-13 01:03:31 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ $# = 0 -o "$1" = "-h" ]; then
|
|
|
|
echo 'usage: termux-fix-shebang <files>'
|
|
|
|
echo 'Rewrite shebangs in specified files for running under Termux,'
|
|
|
|
echo 'which is done by rewriting #!*/bin/binary to #!$PREFIX/bin/binary.'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-09-09 00:36:35 +02:00
|
|
|
for file in $@; do
|
|
|
|
# Do realpath to avoid breaking symlinks (modify original file):
|
2016-03-17 16:38:03 +01:00
|
|
|
sed -i -E "1 s@^#\!(.*)/bin/(.*)@#\!/data/data/com.termux/files/usr/bin/\2@" `realpath $@`
|
2015-09-09 00:36:35 +02:00
|
|
|
done
|