summaryrefslogtreecommitdiff
path: root/recipes-core
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-11-12 09:02:27 -0600
commit0a4904f55b389c8ed9dc34cc26317b86653b57ef (patch)
treef1470188085c2ed3b572081dff6917350014dc49 /recipes-core
parent2fad347926a4aba37866dcb3e078f2627fa14a8f (diff)
downloadmeta-mlinux-0a4904f55b389c8ed9dc34cc26317b86653b57ef.tar.gz
meta-mlinux-0a4904f55b389c8ed9dc34cc26317b86653b57ef.tar.bz2
meta-mlinux-0a4904f55b389c8ed9dc34cc26317b86653b57ef.zip
Make it possible to do opkg update, even for the version
Diffstat (limited to 'recipes-core')
-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
+}