All of lore.kernel.org
 help / color / mirror / Atom feed
From: seth bollinger <seth.boll@gmail.com>
To: "yocto@yoctoproject.org" <yocto@yoctoproject.org>
Subject: bash specific syntax in bbclass files
Date: Wed, 01 May 2013 19:13:19 -0500	[thread overview]
Message-ID: <5181AF9F.8040702@gmail.com> (raw)

Hello All,

I recently ran into a problem in 
meta-raspberrypi/classes/sdcard_image-rpi.bbclass

The following was run through my default debian dash shell (I thought I 
switched a while back, but I must have reverted my VM image or 
something...).

   # If SDIMG_ROOTFS_TYPE is a .xz file use xzcat
   if [[ "$SDIMG_ROOTFS_TYPE" == *.xz ]]
   then

The bash specific syntax ([[) failed in dash causing the "else" path to 
be traversed instead of the correct "then" path.  The failure was silent 
and resulted in a blind copy of a compressed rootfs to the sdcard 
image.  Of course this didn't run.  :)

1.  Is there particular shell syntax that class files should stick too?
2.  I couldn't find a wildcard string search in dash.  Can anyone 
suggest a more shell agnostic way to do this?
3.  Is there a way to guarantee we're running in bash if we're using 
bash specific syntax?

My solution was the following, but it's less readable.

if echo "${SDIMG_ROOTFS_TYPE}" | egrep -q "*\.xz"

Thanks,

Seth



             reply	other threads:[~2013-05-02  0:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02  0:13 seth bollinger [this message]
2013-05-02  8:07 ` bash specific syntax in bbclass files Paul Eggleton
2013-05-03  6:36   ` Gaurang Shastri
2013-05-03  6:58     ` Paul Eggleton
2013-05-03 11:40       ` Trevor Woerner
2013-05-03 12:12         ` Robert P. J. Day
2013-05-03 12:25         ` Paul Eggleton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5181AF9F.8040702@gmail.com \
    --to=seth.boll@gmail.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.