From efdd47a63da92d19bcfee0f781a90e5df750eddc Mon Sep 17 00:00:00 2001 From: aiamnezia Date: Thu, 28 Nov 2024 11:36:50 +0400 Subject: [PATCH] Created a scaffold for Linux installation --- client/ui/controllers/updateController.cpp | 11 ++++++----- ipc/ipc_interface.rep | 1 + ipc/ipcserver.cpp | 8 ++++++++ ipc/ipcserver.h | 1 + 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/client/ui/controllers/updateController.cpp b/client/ui/controllers/updateController.cpp index 6bf6f9fd2..dfabd7cdf 100644 --- a/client/ui/controllers/updateController.cpp +++ b/client/ui/controllers/updateController.cpp @@ -62,7 +62,7 @@ void UpdateController::checkForUpdates() for (auto asset : assets) { QJsonObject assetObject = asset.toObject(); - if (assetObject.value("name").toString().contains(".dmg")) { + if (assetObject.value("name").toString().contains(".tar.gz")) { m_downloadUrl = assetObject.value("browser_download_url").toString(); } } @@ -112,10 +112,11 @@ void UpdateController::runInstaller() QFutureWatcher watcher; QFuture future = QtConcurrent::run([this]() { QString t = installerPath; - QRemoteObjectPendingReply ipcReply = IpcClient::Interface()->mountDmg(t, true); - ipcReply.waitForFinished(); - QProcess::execute("/Volumes/AmneziaVPN/AmneziaVPN.app/Contents/MacOS/AmneziaVPN"); - ipcReply = IpcClient::Interface()->mountDmg(t, false); + QRemoteObjectPendingReply ipcReply = IpcClient::Interface()->installApp(t); + // QRemoteObjectPendingReply ipcReply = IpcClient::Interface()->mountDmg(t, true); + // ipcReply.waitForFinished(); + // QProcess::execute("/Volumes/AmneziaVPN/AmneziaVPN.app/Contents/MacOS/AmneziaVPN"); + // ipcReply = IpcClient::Interface()->mountDmg(t, false); ipcReply.waitForFinished(); return ipcReply.returnValue(); }); diff --git a/ipc/ipc_interface.rep b/ipc/ipc_interface.rep index 1647ea190..7dad63bd4 100644 --- a/ipc/ipc_interface.rep +++ b/ipc/ipc_interface.rep @@ -34,5 +34,6 @@ class IpcInterface SLOT( bool updateResolvers(const QString& ifname, const QList& resolvers) ); SLOT( int mountDmg(const QString &path, bool mount) ); + SLOT (int installApp(const QString &path)); }; diff --git a/ipc/ipcserver.cpp b/ipc/ipcserver.cpp index 2565fc996..c4fe804ea 100644 --- a/ipc/ipcserver.cpp +++ b/ipc/ipcserver.cpp @@ -377,3 +377,11 @@ int IpcServer::mountDmg(const QString &path, bool mount) #endif return 0; } + +int IpcServer::installApp(const QString &path) +{ +#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) + return QProcess::execute(QString("sudo dpkg -i %1").arg(path)); +#endif + return 0; +} diff --git a/ipc/ipcserver.h b/ipc/ipcserver.h index 5d8b61a25..7e5b21d11 100644 --- a/ipc/ipcserver.h +++ b/ipc/ipcserver.h @@ -39,6 +39,7 @@ class IpcServer : public IpcInterfaceSource virtual bool disableKillSwitch() override; virtual bool updateResolvers(const QString& ifname, const QList& resolvers) override; virtual int mountDmg(const QString &path, bool mount) override; + virtual int installApp(const QString &path) override; private: int m_localpid = 0;