summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2020-07-22 12:47:34 -0500
committerJohn Klug <john.klug@multitech.com>2020-07-22 14:20:51 -0500
commitb04248e71a5534343e3bf79bd494e9ec1cfa6bf9 (patch)
treef1470188085c2ed3b572081dff6917350014dc49
parentc001cbf9dd5ce9bec05940f7c4658c57d7a10b95 (diff)
downloadmeta-mlinux-b04248e71a5534343e3bf79bd494e9ec1cfa6bf9.tar.gz
meta-mlinux-b04248e71a5534343e3bf79bd494e9ec1cfa6bf9.tar.bz2
meta-mlinux-b04248e71a5534343e3bf79bd494e9ec1cfa6bf9.zip
Make it possible to do opkg update, even for the version
-rw-r--r--recipes-core/mlinux/mlinux-version.bb34
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
+}