All of lore.kernel.org
 help / color / mirror / Atom feed
* bash specific syntax in bbclass files
@ 2013-05-02  0:13 seth bollinger
  2013-05-02  8:07 ` Paul Eggleton
  0 siblings, 1 reply; 7+ messages in thread
From: seth bollinger @ 2013-05-02  0:13 UTC (permalink / raw)
  To: yocto@yoctoproject.org

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-05-03 12:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-02  0:13 bash specific syntax in bbclass files seth bollinger
2013-05-02  8:07 ` 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

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.