summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/mlinux-image.bbclass16
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