All of lore.kernel.org
 help / color / mirror / Atom feed
* Identifying image in os-release
@ 2015-02-03 19:42 Moore, Thomas (FtWorth)
  2015-02-03 20:49 ` Randy Witt
  0 siblings, 1 reply; 3+ messages in thread
From: Moore, Thomas (FtWorth) @ 2015-02-03 19:42 UTC (permalink / raw)
  To: yocto@yoctoproject.org

For my system, we are generating two images: a release image and a debug image. The debug image simply adds the debug image features (tools-debug, eclipse-debug, and dbg-pkgs). This approach looks like it is going to work well for our needs. However, the one issue that I have is that there doesn't appear to be a way to easily tell which image is running. My current plan for version identification is to make use of the /etc/os-release file that is generated during the build, which is suitable for determining the version of the base distribution. However, I can't find a way to influence any of those values from within my image recipes, which I image is by design.

It would seem to me that having a way to assign a version, or some other identifying information, to a final image would be very important. The DISTRO_VERSION is nice, but it doesn't seem like it's enough considering that you can write an image recipe to add any number of additional packages.

Any suggestions on how I can achieve this?

Thanks,

Thomas 




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

* Re: Identifying image in os-release
  2015-02-03 19:42 Identifying image in os-release Moore, Thomas (FtWorth)
@ 2015-02-03 20:49 ` Randy Witt
  2015-02-03 22:25   ` Moore, Thomas (FtWorth)
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Witt @ 2015-02-03 20:49 UTC (permalink / raw)
  To: Moore, Thomas (FtWorth), yocto@yoctoproject.org

On 02/03/2015 11:42 AM, Moore, Thomas (FtWorth) wrote:
> For my system, we are generating two images: a release image and a debug image. The debug image simply adds the debug image features (tools-debug, eclipse-debug, and dbg-pkgs). This approach looks like it is going to work well for our needs. However, the one issue that I have is that there doesn't appear to be a way to easily tell which image is running. My current plan for version identification is to make use of the /etc/os-release file that is generated during the build, which is suitable for determining the version of the base distribution. However, I can't find a way to influence any of those values from within my image recipes, which I image is by design.
>
> It would seem to me that having a way to assign a version, or some other identifying information, to a final image would be very important. The DISTRO_VERSION is nice, but it doesn't seem like it's enough considering that you can write an image recipe to add any number of additional packages.
>
> Any suggestions on how I can achieve this?

If you are willing to use a file other than os-release, I've often seen this 
done using a function in ROOTFS_POSTPROCESS_COMMAND 
https://www.yoctoproject.org/docs/1.7/ref-manual/ref-manual.html#var-ROOTFS_POSTPROCESS_COMMAND. 
For example:

add_releaseinfo () {
     echo "foo: ${FOOVAR}" > ${IMAGE_ROOTFS}/${sysconfdir}/somefile
     echo "bar: ${BARVAR}" >> ${IMAGE_ROOTFS}/${sysconfdir}/somefile
}

ROOTFS_POSTPROCESS_COMMAND += " add_releaseinfo ; "
> Thanks,
>
> Thomas
>
>



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

* Re: Identifying image in os-release
  2015-02-03 20:49 ` Randy Witt
@ 2015-02-03 22:25   ` Moore, Thomas (FtWorth)
  0 siblings, 0 replies; 3+ messages in thread
From: Moore, Thomas (FtWorth) @ 2015-02-03 22:25 UTC (permalink / raw)
  To: Randy Witt, yocto@yoctoproject.org

Randy,

Thanks for the tip. Here's what I ended up with:

add_releaseinfo () {
    sed -i "/NAME=/s/${DISTRO_NAME}/${DISTRO_NAME} (Debug)/" ${IMAGE_ROOTFS}/${sysconfdir}/os-release
}

ROOTFS_POSTPROCESS_COMMAND += " add_releaseinfo ; "

Thomas 


-----Original Message-----
From: Randy Witt [mailto:randy.e.witt@linux.intel.com] 
Sent: Tuesday, February 03, 2015 2:49 PM
To: Moore, Thomas (FtWorth); yocto@yoctoproject.org
Subject: Re: [yocto] Identifying image in os-release

On 02/03/2015 11:42 AM, Moore, Thomas (FtWorth) wrote:
> For my system, we are generating two images: a release image and a debug image. The debug image simply adds the debug image features (tools-debug, eclipse-debug, and dbg-pkgs). This approach looks like it is going to work well for our needs. However, the one issue that I have is that there doesn't appear to be a way to easily tell which image is running. My current plan for version identification is to make use of the /etc/os-release file that is generated during the build, which is suitable for determining the version of the base distribution. However, I can't find a way to influence any of those values from within my image recipes, which I image is by design.
>
> It would seem to me that having a way to assign a version, or some other identifying information, to a final image would be very important. The DISTRO_VERSION is nice, but it doesn't seem like it's enough considering that you can write an image recipe to add any number of additional packages.
>
> Any suggestions on how I can achieve this?

If you are willing to use a file other than os-release, I've often seen this done using a function in ROOTFS_POSTPROCESS_COMMAND https://www.yoctoproject.org/docs/1.7/ref-manual/ref-manual.html#var-ROOTFS_POSTPROCESS_COMMAND. 
For example:

add_releaseinfo () {
     echo "foo: ${FOOVAR}" > ${IMAGE_ROOTFS}/${sysconfdir}/somefile
     echo "bar: ${BARVAR}" >> ${IMAGE_ROOTFS}/${sysconfdir}/somefile
}

ROOTFS_POSTPROCESS_COMMAND += " add_releaseinfo ; "
> Thanks,
>
> Thomas
>
>



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

end of thread, other threads:[~2015-02-03 22:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-03 19:42 Identifying image in os-release Moore, Thomas (FtWorth)
2015-02-03 20:49 ` Randy Witt
2015-02-03 22:25   ` Moore, Thomas (FtWorth)

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.