From 0e84a9d697842fce615f2d6a9fbbae121955051c Mon Sep 17 00:00:00 2001 From: Paulo Neves Date: Sun, 3 Jul 2022 13:41:12 +0200 Subject: 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. (From OE-Core rev: 68f49af704a4e808ad274d689e884923776edfec) Signed-off-by: Paulo Neves Signed-off-by: Richard Purdie --- meta/classes/utils.bbclass | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'meta/classes/utils.bbclass') diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index b617632d9f..b58c22771f 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=$@ -- cgit v1.2.3-54-g00ecf