]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
utils: create_cmdline_shebang_wrapper whitespace and sed refactor
authorPaulo Neves <ptsneves@gmail.com>
Sun, 3 Jul 2022 11:41:12 +0000 (13:41 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 4 Jul 2022 14:13:18 +0000 (15:13 +0100)
Correct whitespace to match the rest of the code in utils.
Refactored sed expression with a simpler equivalent.

Signed-off-by: Paulo Neves <ptsneves@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/utils.bbclass

index b617632d9f92176a01921e9ef7166f006a59e550..b58c22771f02f13849e79d175d6fc7a77e3fbcb1 100644 (file)
@@ -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 <extra-options>
@@ -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=$@