diff options
Diffstat (limited to 'recipes-core')
-rw-r--r-- | recipes-core/mlinux/mlinux-version.bb | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/recipes-core/mlinux/mlinux-version.bb b/recipes-core/mlinux/mlinux-version.bb index 85adfbb..0c68942 100644 --- a/recipes-core/mlinux/mlinux-version.bb +++ b/recipes-core/mlinux/mlinux-version.bb @@ -7,7 +7,7 @@ inherit mlinux_metadata_scm BB_DONT_CACHE = "1" PV = "${DISTRO_VERSION}_${MLINUX_METADATA_REVISION}" -PR = "r2" +PR = "r3" PE = "1" PACKAGES = "${PN}" @@ -20,3 +20,35 @@ do_install() { echo "Revision: ${MLINUX_METADATA_REVISION}" >> ${D}${sysconfdir}/mlinux-version echo "${MLINUX_LAYERS}" > ${D}${sysconfdir}/mlinux-layers } + +image_version = "${@define_iv(d)}" + +def define_iv(d): + import subprocess + source_dir = d.getVar('TOPDIR',True) + "/.." + cmd = "git describe" + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, cwd=source_dir) + out, err = proc.communicate() + return out.decode("utf-8").rstrip() + +# For mLinux only, update the version on postinst +# Should not affect Convergence. +pkg_postinst_${PN}() { + +# Not for image builds + if [ -n "$D" ] ; then + return 0 + fi + +# If this is mLinux, update the version + mlinux="^MultiTech Systems mLinux GNU/Linux$" + version="Version: " + if grep "${mlinux}" /etc/issue ; then + tmpf=$(mktemp) + cp -a /etc/issue $tmpf + sed -i "s/^${version}.*/${version}${image_version}/" ${tmpf} + if ! cmp /etc/issue ${tmpf} ; then + mv ${tmpf} /etc/issue + fi + fi +} |