-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new pkg gpkg/patchelf new pkg gpkg/strace
- Loading branch information
Showing
6 changed files
with
336 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,5 @@ | ||
#!@TERMUX_PREFIX_CLASSICAL@/bin/bash | ||
#!@SHELL_PATH@ | ||
|
||
# version: 1.4 | ||
# This script allows you to: | ||
# - run glibc-based binaries with ld.so. | ||
# - configure glibc-based binaries to work in Termux. | ||
# - start a special shell with access to glibc commands. | ||
# version: 2.0 | ||
|
||
if [[ -z "$1" ]]; then | ||
echo "Help message from $0-@TERMUX_PKG_VERSION@" | ||
echo "" | ||
echo "This script allows you to:" | ||
echo " - run glibc-based binaries with ld.so." | ||
echo " - configure glibc-based binary to work in Termux." | ||
echo " - start a special shell with access to glibc commands." | ||
echo "" | ||
echo "Flags:" | ||
echo " --shell - launching a customized shell" | ||
echo " --set - binary setup" | ||
echo " --help - print help text from ld.so command" | ||
echo "" | ||
echo "Variables:" | ||
echo " WITH_LIBTERMUX_EXEC_GLIBC=[false|true] - enable the termux-exec-glibc library (default: false)" | ||
echo "" | ||
echo "Example: grun [--set] ./binary || [WITH_LIBTERMUX_EXEC=true|false] grun --shell [gcc -v]" | ||
echo "Bug report: https://github.com/termux-pacman/glibc-packages/issues" | ||
exit 0 | ||
fi | ||
|
||
unset LD_PRELOAD | ||
export GLIBC_PREFIX="@TERMUX_PREFIX@" | ||
export LIBTERMUX_EXEC="${GLIBC_PREFIX}/lib/libtermux-exec.so" | ||
export PATH="${GLIBC_PREFIX}/bin:${PATH}" | ||
|
||
if [ -f "${GLIBC_PREFIX}/etc/locale.conf" ]; then | ||
source "${GLIBC_PREFIX}/etc/locale.conf" | ||
fi | ||
|
||
if [ "$WITH_LIBTERMUX_EXEC_GLIBC" = "true" ]; then | ||
if [ ! -f $LIBTERMUX_EXEC ]; then | ||
echo "Error: not found '$LIBTERMUX_EXEC'" | ||
exit 1 | ||
fi | ||
export LD_PRELOAD=$LIBTERMUX_EXEC | ||
fi | ||
|
||
if [ "$1" = "--shell" ]; then | ||
if [[ -z "$2" ]]; then | ||
exec $SHELL | ||
else | ||
commands="$@" | ||
exec bash -c "${commands#* }" | ||
fi | ||
elif [ "$1" = "--set" ]; then | ||
if [ -z "$2" ]; then | ||
echo "Error: binary not specified" | ||
exit 1 | ||
fi | ||
if [ ! -f "$2" ]; then | ||
echo "Error: binary not found" | ||
exit 1 | ||
fi | ||
if $(type patchelf &> /dev/null); then | ||
LD_FILE=$(ls $GLIBC_PREFIX/lib/ld-* 2> /dev/null) | ||
if [ -n "$LD_FILE" ]; then | ||
patchelf --set-rpath $GLIBC_PREFIX/lib \ | ||
--set-interpreter $LD_FILE \ | ||
"$2" | ||
else | ||
echo "Error: interpreter not found in lib directory" | ||
exit 1 | ||
fi | ||
else | ||
@TERMUX_PREFIX_CLASSICAL@/libexec/termux/command-not-found patchelf | ||
exit 1 | ||
fi | ||
else | ||
exec ld.so $@ | ||
fi | ||
|
||
exit $? | ||
@SHELL_PATH@ @TERMUX_PREFIX_CLASSICAL@/opt/glibc-runner/glibc-runner.sh $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# @TERMUX_PREFIX_CLASSICAL@/etc/glibc-runner.bashrc | ||
# this script is for setting up the glibc-runner shell environment | ||
|
||
if [ -f "${GLIBC_PREFIX}/etc/locale.conf" ]; then | ||
source "${GLIBC_PREFIX}/etc/locale.conf" | ||
fi | ||
|
||
#unset SHELL |
Oops, something went wrong.