termux_step_massage: Use `if` clause in shebang fix

to avoid error exit.
This commit is contained in:
Tee KOBAYASHI 2023-01-19 05:30:19 +09:00 committed by xtkoba
parent fbb028d3ae
commit e9b1e0b2da
1 changed files with 2 additions and 1 deletions

View File

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