]> code.ossystems Code Review - openembedded-core.git/commitdiff
utils.bbclass: add new wrapper script
authorSaul Wold <sgw@linux.intel.com>
Sat, 26 Feb 2011 00:17:28 +0000 (16:17 -0800)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 1 Mar 2011 11:46:47 +0000 (11:46 +0000)
Add a new create_cmdline_wrapper() function that takes cmdline options
for commands that need different directories

Related to [BUGID #775

Signed-off-by: Saul Wold <sgw@linux.intel.com>
meta/classes/utils.bbclass

index 455b49d54ab1f2e5c5a5e8ce9d48c676e279a6ac..e923789c14340b49ffdd685d0bba6a2ea50b12e3 100644 (file)
@@ -271,6 +271,29 @@ oe_machinstall() {
        fi
 }
 
+create_cmdline_wrapper () {
+   # Create a wrapper script
+   #
+   # These are useful to work around relocation issues, by setting environment
+   # variables which point to paths in the filesystem.
+   #
+   # Usage: create_wrapper FILENAME [[VAR=VALUE]..]
+
+   cmd=$1
+   shift
+
+   # run echo via env to test syntactic validity of the variable arguments
+   echo "Generating wrapper script for $cmd"
+
+   mv $cmd $cmd.real
+   cmdname=`basename $cmd`.real
+   cat <<END >$cmd
+#!/bin/sh
+exec \`dirname \$0\`/$cmdname "\$@"
+END
+   chmod +x $cmd
+}
+
 create_wrapper () {
    # Create a wrapper script
    #