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

_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to