From 4714ce6dcd7584a60344ed8651b58ab4a2b3f5bc Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Fri, 25 Mar 2016 19:12:58 +0100 Subject: [PATCH] hooks/post-install: fix python shebang rewriting. --- common/hooks/post-install/07-rewrite-python-shebang.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/hooks/post-install/07-rewrite-python-shebang.sh b/common/hooks/post-install/07-rewrite-python-shebang.sh index 0443640954..8030e68035 100644 --- a/common/hooks/post-install/07-rewrite-python-shebang.sh +++ b/common/hooks/post-install/07-rewrite-python-shebang.sh @@ -15,7 +15,8 @@ hook() { : ${pyver:=2.7} shebang="#!/usr/bin/python$pyver" find ${PKGDESTDIR} -type f -print0 | \ - xargs -0 grep -l -m 1 "^#!.*\([[:space:]]\|/\)python\([[:space:]]\|$\)" -- | while IFS= read -r f; do + xargs -0 grep -H -b -m 1 "^#!.*\([[:space:]]\|/\)python\([[:space:]]\|$\)" -- | while IFS=: read -r f off _; do + [ "$off" -eq 0 ] || continue if [ "$warn" ]; then msg_warn "$pkgname: multiple python versions defined!" msg_warn "$pkgname: using $pyver for shebang"