diff options
author | Brandon Bayer <bbayer@multitech.com> | 2016-10-31 16:53:25 -0500 |
---|---|---|
committer | Brandon Bayer <bbayer@multitech.com> | 2016-11-17 15:45:37 -0600 |
commit | 16aa38da51b9129733673ed27e0cf8ab5e6aa9cc (patch) | |
tree | cad5d2a5861d2a9befa5154e741a10b75f58b3d7 | |
parent | 691f45a5599196d201464e2b8be6433d6e28026c (diff) | |
download | meta-mlinux-16aa38da51b9129733673ed27e0cf8ab5e6aa9cc.tar.gz meta-mlinux-16aa38da51b9129733673ed27e0cf8ab5e6aa9cc.tar.bz2 meta-mlinux-16aa38da51b9129733673ed27e0cf8ab5e6aa9cc.zip |
feat: add firmware version to /etc/issue for annex-client
-rw-r--r-- | classes/mlinux-image.bbclass | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/classes/mlinux-image.bbclass b/classes/mlinux-image.bbclass index 13cacb5..4af7d9e 100644 --- a/classes/mlinux-image.bbclass +++ b/classes/mlinux-image.bbclass @@ -12,18 +12,24 @@ mlinux_set_root_password () { } ROOTFS_POSTPROCESS_COMMAND += "mlinux_set_root_password;" -# set custom product sw version to /etc/issue file if $FIRMWARE_PRODUCT_VER is set +# set custom product sw version to /etc/issue file mlinux_set_product_version () { - if [ -n "${FIRMWARE_PRODUCT_VER}" ]; then + PREV_DIR=$(pwd) + cd "$TOPDIR" + PRODUCT_VER=$(git describe) + cd "$PREV_DIR" + PRODUCT_DATE=$(date +%Y-%m-%dT%H:%M:%S) + + if [ -n "${PRODUCT_VER}" ]; then # set issue if cat ${IMAGE_ROOTFS}/etc/issue | grep "Version: " > /dev/null 2>&1 ; then # replace - sed -i "s/^Version: .*$/Version: $FIRMWARE_PRODUCT_VER/g" ${IMAGE_ROOTFS}/etc/issue - sed -i "s/^Date: .*$/Date: $FIRMWARE_PRODUCT_DATE/g" ${IMAGE_ROOTFS}/etc/issue + sed -i "s/^Version: .*$/Version: $PRODUCT_VER/g" ${IMAGE_ROOTFS}/etc/issue + sed -i "s/^Date: .*$/Date: $PRODUCT_DATE/g" ${IMAGE_ROOTFS}/etc/issue else # add echo "" >> ${IMAGE_ROOTFS}/etc/issue - echo "Version: ${FIRMWARE_PRODUCT_VER}" >> ${IMAGE_ROOTFS}/etc/issue + echo "Version: ${PRODUCT_VER}" >> ${IMAGE_ROOTFS}/etc/issue echo "Date: $(date +%Y-%m-%dT%H:%M:%S)" >> ${IMAGE_ROOTFS}/etc/issue fi fi |