Skip to content

Commit 2cd18f4

Browse files
Get installed version from EDITION_ID first, then VERSION_ID if previous not available
1 parent 0c59596 commit 2cd18f4

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Diff for: src/Install/DBusRaucInstaller.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,13 @@ namespace sua {
163163
g_main_context_iteration(g_main_loop_get_context(loop), FALSE);
164164

165165
if(bundleVersion == VERSION_UNAVAILABLE) {
166-
bundleVersion = getOsVersionId();
166+
bundleVersion = getOsVersionId("EDITION_ID");
167+
168+
if(bundleVersion == VERSION_UNAVAILABLE) {
169+
bundleVersion = getOsVersionId("VERSION_ID");
170+
}
167171
}
172+
168173
return bundleVersion;
169174
}
170175

@@ -385,7 +390,7 @@ namespace sua {
385390
return bundleVersion;
386391
}
387392

388-
std::string DBusRaucInstaller::getOsVersionId() const
393+
std::string DBusRaucInstaller::getOsVersionId(const std::string & version_key) const
389394
{
390395
Logger::trace("DBusRaucInstaller::getOsVersionId");
391396
std::string versionId = VERSION_UNAVAILABLE;
@@ -399,7 +404,7 @@ namespace sua {
399404
std::string key;
400405
std::getline(ss, key, '=');
401406

402-
if(key == "VERSION_ID") {
407+
if(key == version_key) {
403408
std::string value;
404409
std::getline(ss, value, '=');
405410
value.erase(std::remove(value.begin(), value.end(), '"'), value.end());

Diff for: src/Install/DBusRaucInstaller.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace sua {
6060
std::string getDBusRaucProperty(const gchar* propertyKey) const;
6161
std::string getDBusRaucBundleVersion() const;
6262
std::string getDBusRaucBundleVersion(const std::string& input) const;
63-
std::string getOsVersionId() const;
63+
std::string getOsVersionId(const std::string & version_key) const;
6464
};
6565

6666
} // namespace sua

0 commit comments

Comments
 (0)