Update termux_step_massage.sh: changing how `fix shebang paths` works

This commit is contained in:
Ivan Max 2023-09-10 14:02:41 +03:00 committed by GitHub
parent 276ebf803d
commit d375d7c8e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -61,12 +61,8 @@ termux_step_massage() {
if [ "$TERMUX_PKG_NO_SHEBANG_FIX" != "true" ]; then
# Fix shebang paths:
while IFS= read -r -d '' file; do
if head -c 100 "$file" | head -n 1 | grep -E "^#!.*/bin/.*" | grep -q -E -v "^#! ?/system"; then
if [ "$TERMUX_PACKAGE_LIBRARY" = "bionic" ]; then
sed --follow-symlinks -i -E "1 s@^#\!(.*)/bin/(.*)@#\!$TERMUX_PREFIX/bin/\2@" "$file"
elif [ "$TERMUX_PACKAGE_LIBRARY" = "glibc" ]; then
sed --follow-symlinks -i -E "1 s@^#\!(.*)/bin/(.*)@#\!$TERMUX_PREFIX_CLASSICAL/bin/\2@" "$file"
fi
if head -c 100 "$file" | head -n 1 | grep -E "^#!.*/bin/.*" | grep -q -E -v -e "^#! ?/system" -e "^#! ?$TERMUX_PREFIX_CLASSICAL"; then
sed --follow-symlinks -i -E "1 s@^#\!(.*)/bin/(.*)@#\!$TERMUX_PREFIX/bin/\2@" "$file"
fi
done < <(find -L . -type f -print0)
fi