- cp $TERMUX_PKG_BUILDER_DIR/{am,pm,termux-fix-shebang,termux-reload-settings,termux-setup-storage,chsh,termux-open-url} $TERMUX_PREFIX/bin/
+ # Remove LD_LIBRARY_PATH from environment to avoid conflicting
+ # with system libraries that am may link against.
+ for tool in am dalvikvm df getprop logcat ping ping6 ip pm; do
+ WRAPPER_FILE=$TERMUX_PREFIX/bin/$tool
+ echo '#!/bin/sh' > $WRAPPER_FILE
+ if [ $tool = am -o $tool = pm ]; then
+ # These tools require having /system/bin/app_process in the PATH,
+ # at least on a Nexus 6p running Android 6.0.
+ echo -n 'PATH=$PATH:/system/bin ' >> $WRAPPER_FILE
+ fi
+ echo "LD_LIBRARY_PATH= exec /system/bin/$tool \$@" >> $WRAPPER_FILE
+ chmod +x $TERMUX_PREFIX/bin/$tool
+ done