From: Paulo Neves Date: Sun, 3 Jul 2022 11:41:12 +0000 (+0200) Subject: utils: create_cmdline_shebang_wrapper whitespace and sed refactor X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~3713 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68f49af704a4e808ad274d689e884923776edfec;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git utils: create_cmdline_shebang_wrapper whitespace and sed refactor Correct whitespace to match the rest of the code in utils. Refactored sed expression with a simpler equivalent. Signed-off-by: Paulo Neves Signed-off-by: Richard Purdie --- diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index b617632d9f9..b58c22771f0 100644 --- a/meta/classes/utils.bbclass +++ b/meta/classes/utils.bbclass @@ -188,7 +188,7 @@ create_cmdline_shebang_wrapper () { # Create a wrapper script where commandline options are needed # # These are useful to work around shebang relocation issues, where shebangs are too - # long or have arguments in them, thus preventing them from using the /usr/bin/env + # long or have arguments in them, thus preventing them from using the /usr/bin/env # shebang # # Usage: create_cmdline_wrapper FILENAME @@ -198,10 +198,10 @@ create_cmdline_shebang_wrapper () { echo "Generating wrapper script for $cmd" - # Strip #! and get remaining interpreter + arg - argument="$(basename "$(head -n1 $cmd | sed -e 's|#![ ]*||g' )")" - # strip the shebang from the real script as we do not want it to be usable anyway - tail -n +2 $cmd > $cmd.real + # Strip #! and get remaining interpreter + arg + argument="$(sed -ne 's/^#! *//p;q' $cmd)" + # strip the shebang from the real script as we do not want it to be usable anyway + tail -n +2 $cmd > $cmd.real cmdname=$(basename $cmd) dirname=$(dirname $cmd) cmdoptions=$@