From: Dominik Schmidt Date: Wed, 13 Jun 2018 12:06:37 +0000 (+0200) Subject: Run msi properly and restart client after update X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~46^2~20 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ed0dc68db28f21ed22241dfde4a99e04cf495024;p=nextcloud-desktop.git Run msi properly and restart client after update --- diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index 78e7021eb..c88eb0cca 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/src/gui/updater/ocupdater.cpp @@ -195,9 +195,18 @@ void OCUpdater::slotStartInstaller() if(updateFile.endsWith(".exe")) { QProcess::startDetached(updateFile, QStringList() << "/S" - << "/launch"); - } else { - QDesktopServices::openUrl(QUrl("file:///" + updateFile, QUrl::TolerantMode)); + << "/launch"); + } else if(updateFile.endsWith(".msi")) { + // When MSIs are installed without gui they cannot launch applications + // as they lack the user context. That is why we need to run the client + // manually here. We wrap the msiexec and client invocation in a powershell + // script because owncloud.exe will be shut down for installation. + // | Out-Null forces powershell to wait for msiexec to finish. + QString command = QString("&{msiexec /norestart /passive /i '%1' | Out-Null ; &'%2'}") + .arg(QDir::toNativeSeparators(updateFile)) + .arg(QDir::toNativeSeparators(QCoreApplication::applicationFilePath())); + + QProcess::startDetached("powershell.exe", QStringList{"-Command", command}); } }