fix(launcher): bootstrap release state and signed manifest
This commit is contained in:
+44
-2
@@ -12,7 +12,9 @@
|
||||
#include "../Common/TicketHelper.h"
|
||||
#include "../Common/DeviceIdentityHelper.h"
|
||||
#include "../Common/IntegrityHelper.h"
|
||||
#include "../Common/ManifestBootstrapPolicy.h"
|
||||
#include "../Common/TranslationHelper.h"
|
||||
#include "../Updater/UpdaterLogic.h"
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QDir>
|
||||
@@ -198,7 +200,47 @@ int main(int argc, char *argv[])
|
||||
const QString mainAppPath = QDir(appDir).filePath(mainExecutable);
|
||||
const QString updaterPath = QDir(appDir).filePath(updaterExecutable);
|
||||
IntegrityHelper integrity(config.installRoot());
|
||||
if (!integrity.verifyInstalledVersion(appId, channel, currentVersion))
|
||||
bool integrityVerified = integrity.verifyInstalledVersion(
|
||||
appId, channel, currentVersion);
|
||||
QString integrityError = integrity.errorString();
|
||||
const UpdateClient::ManifestBootstrapAction bootstrapAction =
|
||||
UpdateClient::manifestBootstrapAction(
|
||||
integrity.isManifestCacheMissing(), networkOk, needUpdate,
|
||||
targetVersionId);
|
||||
if (!integrityVerified
|
||||
&& bootstrapAction
|
||||
== UpdateClient::ManifestBootstrapAction::FetchCurrentManifest)
|
||||
{
|
||||
UpdaterLogic manifestLogic;
|
||||
manifestLogic.getManifest(
|
||||
appId, channel, currentVersion, targetVersionId);
|
||||
const QString cacheDirectory = QDir(config.updateRoot()).filePath(
|
||||
QStringLiteral("manifest_cache"));
|
||||
if (manifestLogic.verifyManifestSignature()
|
||||
&& manifestLogic.saveManifestCache(cacheDirectory))
|
||||
{
|
||||
integrityVerified = integrity.verifyInstalledVersion(
|
||||
appId, channel, currentVersion);
|
||||
integrityError = integrity.errorString();
|
||||
}
|
||||
else
|
||||
{
|
||||
integrityError = QCoreApplication::translate(
|
||||
"Launcher",
|
||||
"The signed manifest for version %1 could not be fetched or cached.")
|
||||
.arg(currentVersion);
|
||||
}
|
||||
}
|
||||
else if (!integrityVerified
|
||||
&& bootstrapAction
|
||||
== UpdateClient::ManifestBootstrapAction::CurrentVersionNotPublished)
|
||||
{
|
||||
integrityError = QCoreApplication::translate(
|
||||
"Launcher",
|
||||
"Version %1 is not published on the update server. Publish this exact installed build before distribution so its signed manifest can be verified.")
|
||||
.arg(currentVersion);
|
||||
}
|
||||
if (!integrityVerified)
|
||||
{
|
||||
progress.close();
|
||||
QMessageBox::critical(
|
||||
@@ -207,7 +249,7 @@ int main(int argc, char *argv[])
|
||||
QCoreApplication::translate(
|
||||
"Launcher",
|
||||
"Application files failed signed manifest verification:\n%1")
|
||||
.arg(integrity.errorString()));
|
||||
.arg(integrityError));
|
||||
return -1;
|
||||
}
|
||||
const auto importOfflinePackage = [&]()
|
||||
|
||||
Reference in New Issue
Block a user