diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh index 40487d73a7..81e45b9821 100644 --- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh +++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh @@ -19,9 +19,9 @@ hook() { fi shebang="#!/usr/bin/python${pyver%.*}" - find ${PKGDESTDIR} -type f -print0 | \ - xargs -0 grep -H -b -m 1 "^#!.*\([[:space:]]\|/\)python\([[:space:]]*\|$\)" -- | while IFS=: read -r f off _; do - [ -z "$off" ] && continue + find "${PKGDESTDIR}" -type f -print0 | \ + xargs -0 grep -H -b -m 1 "^#!.*\([[:space:]]\|/\)python\([0-9]\.[0-9]\)\?\([[:space:]]\+\|$\)" -- | while IFS=: read -r f off _; do + [ -z "$off" ] && continue echo " Shebang converted to '$shebang': ${f#$PKGDESTDIR}" sed -i "1s@.*python.*@${shebang}@" -- "$f" done