[yocto] bash specific syntax in bbclass files

Gaurang Shastri gmshastri at gmail.com
Thu May 2 23:36:45 PDT 2013


I usually do following before starting Yocto on Ubuntu:
--
# dpkg-reconfigure dash
and select "NO" on the prompt
--

The above will at least make bash as default shell.

//Gaurang Shastri


On Thu, May 2, 2013 at 1:37 PM, Paul Eggleton <paul.eggleton at linux.intel.com
> wrote:

> On Wednesday 01 May 2013 19:13:19 seth bollinger wrote:
> > 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?
>
> No bashisms should be used, so the above should really be changed.
>
> > 2.  I couldn't find a wildcard string search in dash.  Can anyone
> > suggest a more shell agnostic way to do this?
>
> AFAIK grep or awk is the only way.
>
> > 3.  Is there a way to guarantee we're running in bash if we're using
> > bash specific syntax?
>
> Not that I'm aware of.
>
> Cheers,
> Paul
>
> --
>
> Paul Eggleton
> Intel Open Source Technology Centre
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20130503/bd393de9/attachment.html>


More information about the yocto mailing list