diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/utils.bbclass | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index 549e4b82f5..fe75f73a77 100644 --- a/meta/classes/utils.bbclass +++ b/meta/classes/utils.bbclass | |||
@@ -264,10 +264,17 @@ create_cmdline_wrapper () { | |||
264 | 264 | ||
265 | mv $cmd $cmd.real | 265 | mv $cmd $cmd.real |
266 | cmdname=`basename $cmd` | 266 | cmdname=`basename $cmd` |
267 | dirname=`dirname $cmd` | ||
268 | cmdoptions=$@ | ||
269 | if [ "${base_prefix}" != "" ]; then | ||
270 | relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"` | ||
271 | cmdoptions=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"` | ||
272 | fi | ||
267 | cat <<END >$cmd | 273 | cat <<END >$cmd |
268 | #!/bin/bash | 274 | #!/bin/bash |
269 | realpath=\`readlink -fn \$0\` | 275 | realpath=\`readlink -fn \$0\` |
270 | exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $@ "\$@" | 276 | realdir=\`dirname \$realpath\` |
277 | exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $cmdoptions "\$@" | ||
271 | END | 278 | END |
272 | chmod +x $cmd | 279 | chmod +x $cmd |
273 | } | 280 | } |
@@ -287,10 +294,17 @@ create_wrapper () { | |||
287 | 294 | ||
288 | mv $cmd $cmd.real | 295 | mv $cmd $cmd.real |
289 | cmdname=`basename $cmd` | 296 | cmdname=`basename $cmd` |
297 | dirname=`dirname $cmd` | ||
298 | exportstring=$@ | ||
299 | if [ "${base_prefix}" != "" ]; then | ||
300 | relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"` | ||
301 | exportstring=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"` | ||
302 | fi | ||
290 | cat <<END >$cmd | 303 | cat <<END >$cmd |
291 | #!/bin/bash | 304 | #!/bin/bash |
292 | realpath=\`readlink -fn \$0\` | 305 | realpath=\`readlink -fn \$0\` |
293 | export $@ | 306 | realdir=\`dirname \$realpath\` |
307 | export $exportstring | ||
294 | exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real "\$@" | 308 | exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real "\$@" |
295 | END | 309 | END |
296 | chmod +x $cmd | 310 | chmod +x $cmd |