From: Michael Tremer Date: Fri, 23 Dec 2011 19:23:29 +0000 (+0100) Subject: Fix detection of interpreters. X-Git-Tag: 0.9.20~33^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7709931085230499a594ff47760fd9d41f603839;p=pakfire.git Fix detection of interpreters. --- diff --git a/tools/find-requires b/tools/find-requires index c65a894da..8bb6fb984 100755 --- a/tools/find-requires +++ b/tools/find-requires @@ -82,7 +82,7 @@ interpreters= for file in ${script_files}; do [ -r ${file} -a -x ${file} ] || continue - interp=$(head -n 1 ${file} | sed -e 's/^\#\![ ]*//' | cut -d" " -f1) + interp=$(file_get_script_interpreter ${file}) interpreters="${interpreters} ${interp}" # Collect all perl files. diff --git a/tools/functions-files b/tools/functions-files index b35439d3e..ab0ba34a7 100644 --- a/tools/functions-files +++ b/tools/functions-files @@ -62,11 +62,17 @@ function file_get_script_interpreter() { local first_line=$(head -n1 ${file}) + # Return nothing if no shebang was found. + [ "${first_line:0:2}" = "#!" ] || return + first_line="${first_line:2:${#first_line}}" # Choose the first argument and strip any parameters if available local interpreter for interpreter in ${first_line}; do + # Skip interpreters that do that have an absolute path. + [ "${interpreter:0:1}" = "/" ] || break + echo "${interpreter}" return done