From 41bcfb3c07861bf960816927d7f90bea9708d3b9 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sat, 29 Jun 2024 03:44:49 -0700 Subject: [PATCH 1/4] Fix #2586 non portable linux update technically works even if not genraly a good idea. Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- launcher/updater/prismupdater/PrismUpdater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/updater/prismupdater/PrismUpdater.cpp b/launcher/updater/prismupdater/PrismUpdater.cpp index 83d8efa22..96ef48b12 100644 --- a/launcher/updater/prismupdater/PrismUpdater.cpp +++ b/launcher/updater/prismupdater/PrismUpdater.cpp @@ -1020,7 +1020,7 @@ void PrismUpdaterApp::performInstall(QFileInfo file) FS::write(changelog_path, m_install_release.body.toUtf8()); logUpdate(tr("Updating from %1 to %2").arg(m_prismVersion).arg(m_install_release.tag_name)); - if (m_isPortable || file.suffix().toLower() == "zip") { + if (m_isPortable || file.fileName().endsWith(".zip") || file.fileName().endsWith(".tar.gz")) { write_lock_file(update_lock_path, QDateTime::currentDateTime(), m_prismVersion, m_install_release.tag_name, m_rootPath, m_dataPath); logUpdate(tr("Updating portable install at %1").arg(m_rootPath)); unpackAndInstall(file); From 9d1fffff27854c3895ab316981d76d61c7e4f3ae Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sat, 29 Jun 2024 03:57:30 -0700 Subject: [PATCH 2/4] reject zsync file as valid build artifact Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- launcher/updater/prismupdater/PrismUpdater.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/launcher/updater/prismupdater/PrismUpdater.cpp b/launcher/updater/prismupdater/PrismUpdater.cpp index 96ef48b12..b335a19f9 100644 --- a/launcher/updater/prismupdater/PrismUpdater.cpp +++ b/launcher/updater/prismupdater/PrismUpdater.cpp @@ -787,6 +787,10 @@ QList PrismUpdaterApp::validReleaseArtifacts(const GitHubRel if (BuildConfig.BUILD_ARTIFACT.isEmpty()) qWarning() << "Build platform is not set!"; for (auto asset : release.assets) { + if (asset.name.endsWith("zsync")) { + qDebug() << "Rejecting zsync file" << asset.name; + continue; + } if (!m_isAppimage && asset.name.toLower().endsWith("appimage")) { qDebug() << "Rejecting" << asset.name << "because it is an AppImage"; continue; From b4f5c3d241c6e9c8525d786c0bbaf860a18032b0 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sat, 29 Jun 2024 04:08:04 -0700 Subject: [PATCH 3/4] Update launcher/updater/prismupdater/PrismUpdater.cpp Co-authored-by: TheKodeToad Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- launcher/updater/prismupdater/PrismUpdater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/updater/prismupdater/PrismUpdater.cpp b/launcher/updater/prismupdater/PrismUpdater.cpp index b335a19f9..76ba483f0 100644 --- a/launcher/updater/prismupdater/PrismUpdater.cpp +++ b/launcher/updater/prismupdater/PrismUpdater.cpp @@ -787,7 +787,7 @@ QList PrismUpdaterApp::validReleaseArtifacts(const GitHubRel if (BuildConfig.BUILD_ARTIFACT.isEmpty()) qWarning() << "Build platform is not set!"; for (auto asset : release.assets) { - if (asset.name.endsWith("zsync")) { + if (asset.name.endsWith(".zsync")) { qDebug() << "Rejecting zsync file" << asset.name; continue; } From ae3e4ed528aace5385c99047e9c7c431a26b8506 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sat, 29 Jun 2024 04:29:19 -0700 Subject: [PATCH 4/4] fix Build Artifact Checks Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- launcher/updater/prismupdater/PrismUpdater.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/launcher/updater/prismupdater/PrismUpdater.cpp b/launcher/updater/prismupdater/PrismUpdater.cpp index 76ba483f0..de862b96e 100644 --- a/launcher/updater/prismupdater/PrismUpdater.cpp +++ b/launcher/updater/prismupdater/PrismUpdater.cpp @@ -244,8 +244,9 @@ PrismUpdaterApp::PrismUpdaterApp(int& argc, char** argv) : QApplication(argc, ar auto updater_executable = QCoreApplication::applicationFilePath(); - if (BuildConfig.BUILD_ARTIFACT.toLower() == "macos") - showFatalErrorMessage(tr("MacOS Not Supported"), tr("The updater does not support installations on MacOS")); +#ifdef Q_OS_MACOS + showFatalErrorMessage(tr("MacOS Not Supported"), tr("The updater does not support installations on MacOS")); +#endif if (updater_executable.startsWith("/tmp/.mount_")) { m_isAppimage = true; @@ -580,12 +581,6 @@ void PrismUpdaterApp::run() return exit(result ? 0 : 1); } - if (BuildConfig.BUILD_ARTIFACT.toLower() == "linux" && !m_isPortable) { - showFatalErrorMessage(tr("Updating Not Supported"), - tr("Updating non-portable linux installations is not supported. Please use your system package manager")); - return; - } - if (need_update || m_forceUpdate || !m_userSelectedVersion.isEmpty()) { GitHubRelease update_release = latest; if (!m_userSelectedVersion.isEmpty()) { @@ -1098,7 +1093,7 @@ void PrismUpdaterApp::backupAppDir() if (file_list.isEmpty()) { // best guess - if (BuildConfig.BUILD_ARTIFACT.toLower() == "linux") { + if (BuildConfig.BUILD_ARTIFACT.toLower().contains("linux")) { file_list.append({ "PrismLauncher", "bin", "share", "lib" }); } else { // windows by process of elimination file_list.append({