From b0bde88b67dab42a40040f919b221a883c01d6e8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 30 Dec 2019 17:40:32 +0100 Subject: [PATCH] imageinfo: more align to OE image data Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a1429b9123b1a7bced5265bfac95c39afc03318c Author: Thilo Graf Date: 2019-12-30 (Mon, 30 Dec 2019) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/imageinfo.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index c3b8cb5b0..b50025b2e 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -53,8 +53,9 @@ #include #define VERSION_FILE TARGET_PREFIX "/.version" -#define RELEASE_FILE "/etc/os-release" +#define OS_RELEASE_FILE "/etc/os-release" +#define OE_IMAGE_VERSION_FILE "/etc/image-version" using namespace std; @@ -288,13 +289,20 @@ void CImageInfo::InitInfoData() v_info.clear(); image_info_t pretty_name = {g_Locale->getText(LOCALE_IMAGEINFO_OS),""}; - if (file_exists(RELEASE_FILE)){ - config.loadConfig(RELEASE_FILE); + if (file_exists(OS_RELEASE_FILE)){ + config.loadConfig(OS_RELEASE_FILE); string tmpstr = config.getString("PRETTY_NAME", ""); pretty_name.info_text = str_replace("\"", "", tmpstr); config.clear(); } + string oe_image_version = ""; + if (file_exists(OE_IMAGE_VERSION_FILE)){ + config.loadConfig(OE_IMAGE_VERSION_FILE); + oe_image_version = config.getString("imageversion", ""); + config.clear(); + } + config.loadConfig(VERSION_FILE); #ifdef BUILT_DATE @@ -317,12 +325,15 @@ void CImageInfo::InitInfoData() } if (is_version_code && version_string.size() == 16){ static CFlashVersionInfo versionInfo(version_string.c_str()); - version_string = versionInfo.getVersionString(); - version_string += " "; - version_string += versionInfo.getType(); - version_string += " ("; - version_string += versionInfo.getDate(); - version_string += ")"; + if (oe_image_version.empty()){ + version_string = versionInfo.getVersionString(); + version_string += " "; + version_string += versionInfo.getType(); + version_string += " ("; + version_string += versionInfo.getDate(); + version_string += ")"; + }else + version_string = oe_image_version; }else printf("[CImageInfo]\t[%s - %d], WARNING! %s contains possible wrong version format, content = [%s]\n", __func__, __LINE__, VERSION_FILE, version_string.c_str()); #endif