diff options
author | Saul Wold <sgw@linux.intel.com> | 2011-02-25 16:17:28 -0800 |
---|---|---|
committer | Saul Wold <sgw@linux.intel.com> | 2011-02-25 16:20:31 -0800 |
commit | 9c63e3fd295e4fceb196baadd53801bba3e3e1b3 (patch) | |
tree | 16a7caebb62b669dd90bccb07da23cf86a9192ba | |
parent | 73553e7850874133d65804719303a08eddd92df0 (diff) | |
download | poky-9c63e3fd295e4fceb196baadd53801bba3e3e1b3.tar.gz |
utils.bbclass: add new wrapper script
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>
-rw-r--r-- | meta/classes/utils.bbclass | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index 455b49d54a..e923789c14 100644 --- a/meta/classes/utils.bbclass +++ b/meta/classes/utils.bbclass | |||
@@ -271,6 +271,29 @@ oe_machinstall() { | |||
271 | fi | 271 | fi |
272 | } | 272 | } |
273 | 273 | ||
274 | create_cmdline_wrapper () { | ||
275 | # Create a wrapper script | ||
276 | # | ||
277 | # These are useful to work around relocation issues, by setting environment | ||
278 | # variables which point to paths in the filesystem. | ||
279 | # | ||
280 | # Usage: create_wrapper FILENAME [[VAR=VALUE]..] | ||
281 | |||
282 | cmd=$1 | ||
283 | shift | ||
284 | |||
285 | # run echo via env to test syntactic validity of the variable arguments | ||
286 | echo "Generating wrapper script for $cmd" | ||
287 | |||
288 | mv $cmd $cmd.real | ||
289 | cmdname=`basename $cmd`.real | ||
290 | cat <<END >$cmd | ||
291 | #!/bin/sh | ||
292 | exec \`dirname \$0\`/$cmdname "\$@" | ||
293 | END | ||
294 | chmod +x $cmd | ||
295 | } | ||
296 | |||
274 | create_wrapper () { | 297 | create_wrapper () { |
275 | # Create a wrapper script | 298 | # Create a wrapper script |
276 | # | 299 | # |