mirror of
https://github.com/tnodir/fort
synced 2024-11-15 03:56:18 +00:00
UI: AutoUpdateManager: Run Installer via Service
This commit is contained in:
parent
f97f307b52
commit
beeb294476
@ -87,7 +87,8 @@ Name: "{commondesktop}\{#APP_NAME}"; Filename: "{#APP_EXE}"; WorkingDir: "{app}"
|
|||||||
[Run]
|
[Run]
|
||||||
; 1. Uninstall -> 2. Install Driver -> 3. Portable -> 4. Service
|
; 1. Uninstall -> 2. Install Driver -> 3. Portable -> 4. Service
|
||||||
Filename: "{#APP_EXE}"; Parameters: "-u"
|
Filename: "{#APP_EXE}"; Parameters: "-u"
|
||||||
Filename: "{app}\driver\scripts\reinstall.bat"; Description: "Re-install driver"
|
Filename: "{app}\driver\scripts\reinstall.bat"; Parameters: {code:DriverInstallArgs}; \
|
||||||
|
Description: "Re-install driver"
|
||||||
|
|
||||||
Filename: "{#APP_EXE}"; Parameters: "-i portable"; Tasks: portable
|
Filename: "{#APP_EXE}"; Parameters: "-i portable"; Tasks: portable
|
||||||
Filename: "{#APP_EXE}"; Parameters: "-i service"; Tasks: service
|
Filename: "{#APP_EXE}"; Parameters: "-i service"; Tasks: service
|
||||||
@ -138,6 +139,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function DriverInstallArgs(Value: string): string;
|
||||||
|
begin
|
||||||
|
if ParamExists('/VERYSILENT') then
|
||||||
|
begin
|
||||||
|
Result := '/SILENT';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function ShouldLaunch: Boolean;
|
function ShouldLaunch: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := ParamExists('/LAUNCH') or not (ParamExists('/SILENT') or ParamExists('/VERYSILENT'));
|
Result := ParamExists('/LAUNCH') or not (ParamExists('/SILENT') or ParamExists('/VERYSILENT'));
|
||||||
|
@ -51,7 +51,8 @@ sc start %DRIVERSVC%
|
|||||||
|
|
||||||
:EXIT
|
:EXIT
|
||||||
@echo End execution... Result Code = %RCODE%
|
@echo End execution... Result Code = %RCODE%
|
||||||
@if %RCODE% neq 0 (
|
@if %RCODE% neq 0 if "%1" neq "/SILENT" (
|
||||||
|
@echo ARGS: %*
|
||||||
@pause
|
@pause
|
||||||
)
|
)
|
||||||
@exit /b %RCODE%
|
@exit /b %RCODE%
|
||||||
|
@ -5,4 +5,4 @@
|
|||||||
|
|
||||||
%COMSPEC% /C "%~dp0uninstall.bat"
|
%COMSPEC% /C "%~dp0uninstall.bat"
|
||||||
|
|
||||||
"%~dp0install.bat"
|
"%~dp0install.bat" %*
|
||||||
|
@ -23,6 +23,7 @@ const char *const commandString(Command cmd)
|
|||||||
CASE_STRING(Rpc_AppInfoManager_checkLookupInfoFinished)
|
CASE_STRING(Rpc_AppInfoManager_checkLookupInfoFinished)
|
||||||
|
|
||||||
CASE_STRING(Rpc_AutoUpdateManager_startDownload)
|
CASE_STRING(Rpc_AutoUpdateManager_startDownload)
|
||||||
|
CASE_STRING(Rpc_AutoUpdateManager_runInstaller)
|
||||||
CASE_STRING(Rpc_AutoUpdateManager_updateState)
|
CASE_STRING(Rpc_AutoUpdateManager_updateState)
|
||||||
CASE_STRING(Rpc_AutoUpdateManager_restartClients)
|
CASE_STRING(Rpc_AutoUpdateManager_restartClients)
|
||||||
|
|
||||||
@ -129,6 +130,7 @@ RpcManager managerByCommand(Command cmd)
|
|||||||
Rpc_AppInfoManager, // Rpc_AppInfoManager_checkLookupFinished,
|
Rpc_AppInfoManager, // Rpc_AppInfoManager_checkLookupFinished,
|
||||||
|
|
||||||
Rpc_AutoUpdateManager, // Rpc_AutoUpdateManager_startDownload,
|
Rpc_AutoUpdateManager, // Rpc_AutoUpdateManager_startDownload,
|
||||||
|
Rpc_AutoUpdateManager, // Rpc_AutoUpdateManager_runInstaller,
|
||||||
Rpc_AutoUpdateManager, // Rpc_AutoUpdateManager_updateState,
|
Rpc_AutoUpdateManager, // Rpc_AutoUpdateManager_updateState,
|
||||||
Rpc_AutoUpdateManager, // Rpc_AutoUpdateManager_restartClients,
|
Rpc_AutoUpdateManager, // Rpc_AutoUpdateManager_restartClients,
|
||||||
|
|
||||||
@ -214,6 +216,7 @@ bool commandRequiresValidation(Command cmd)
|
|||||||
0, // Rpc_AppInfoManager_checkLookupFinished,
|
0, // Rpc_AppInfoManager_checkLookupFinished,
|
||||||
|
|
||||||
true, // Rpc_AutoUpdateManager_startDownload,
|
true, // Rpc_AutoUpdateManager_startDownload,
|
||||||
|
true, // Rpc_AutoUpdateManager_runInstaller,
|
||||||
0, // Rpc_AutoUpdateManager_updateState,
|
0, // Rpc_AutoUpdateManager_updateState,
|
||||||
0, // Rpc_AutoUpdateManager_restartClients,
|
0, // Rpc_AutoUpdateManager_restartClients,
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ enum Command : qint8 {
|
|||||||
Rpc_AppInfoManager_checkLookupInfoFinished,
|
Rpc_AppInfoManager_checkLookupInfoFinished,
|
||||||
|
|
||||||
Rpc_AutoUpdateManager_startDownload,
|
Rpc_AutoUpdateManager_startDownload,
|
||||||
|
Rpc_AutoUpdateManager_runInstaller,
|
||||||
Rpc_AutoUpdateManager_updateState,
|
Rpc_AutoUpdateManager_updateState,
|
||||||
Rpc_AutoUpdateManager_restartClients,
|
Rpc_AutoUpdateManager_restartClients,
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <form/controls/controlutil.h>
|
#include <form/controls/controlutil.h>
|
||||||
#include <form/home/homecontroller.h>
|
#include <form/home/homecontroller.h>
|
||||||
|
#include <fortsettings.h>
|
||||||
#include <manager/autoupdatemanager.h>
|
#include <manager/autoupdatemanager.h>
|
||||||
#include <task/taskinfoupdatechecker.h>
|
#include <task/taskinfoupdatechecker.h>
|
||||||
#include <task/taskmanager.h>
|
#include <task/taskmanager.h>
|
||||||
@ -99,6 +100,8 @@ QLayout *AboutPage::setupButtonsLayout()
|
|||||||
m_btDownload = ControlUtil::createFlatToolButton(
|
m_btDownload = ControlUtil::createFlatToolButton(
|
||||||
":/icons/download.png", [&] { autoUpdateManager()->startDownload(); });
|
":/icons/download.png", [&] { autoUpdateManager()->startDownload(); });
|
||||||
|
|
||||||
|
m_btDownload->setEnabled(!settings()->isPortable());
|
||||||
|
|
||||||
// Install
|
// Install
|
||||||
m_btInstall = ControlUtil::createFlatToolButton(
|
m_btInstall = ControlUtil::createFlatToolButton(
|
||||||
":/icons/tick.png", [&] { autoUpdateManager()->runInstaller(); });
|
":/icons/tick.png", [&] { autoUpdateManager()->runInstaller(); });
|
||||||
|
@ -180,23 +180,25 @@ bool AutoUpdateManager::runInstaller()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCDebug(LC) << "Run Installer:" << installerPath << args;
|
||||||
|
|
||||||
if (settings->hasService()) {
|
if (settings->hasService()) {
|
||||||
emit restartClients(installerPath);
|
emit restartClients(installerPath);
|
||||||
} else {
|
|
||||||
OsUtil::quit("new version install");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(LC) << "Run Installer:" << installerPath << args;
|
if (settings->isMaster()) {
|
||||||
|
OsUtil::quit("new version install");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList AutoUpdateManager::installerArgs(FortSettings *settings)
|
QStringList AutoUpdateManager::installerArgs(FortSettings *settings)
|
||||||
{
|
{
|
||||||
QStringList args;
|
QStringList args = { "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NOCANCEL" };
|
||||||
|
|
||||||
if (!settings->isPortable()) {
|
if (settings->forceDebug()) {
|
||||||
args << "/SILENT";
|
args << "/LOG";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!settings->hasService()) {
|
if (!settings->hasService()) {
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
virtual bool startDownload();
|
virtual bool startDownload();
|
||||||
|
|
||||||
bool runInstaller();
|
virtual bool runInstaller();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void flagsChanged();
|
void flagsChanged();
|
||||||
@ -66,6 +66,7 @@ protected:
|
|||||||
void setupDownloader() override;
|
void setupDownloader() override;
|
||||||
|
|
||||||
QString installerPath() const { return m_updatePath + m_fileName; }
|
QString installerPath() const { return m_updatePath + m_fileName; }
|
||||||
|
QString installerLogPath() const { return m_updatePath + "log.txt"; }
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void downloadFinished(const QByteArray &data, bool success) override;
|
void downloadFinished(const QByteArray &data, bool success) override;
|
||||||
|
@ -23,6 +23,8 @@ ServiceManager::ServiceManager(QObject *parent) : QObject(parent) { }
|
|||||||
|
|
||||||
void ServiceManager::setUp()
|
void ServiceManager::setUp()
|
||||||
{
|
{
|
||||||
|
qApp->connect(qApp, &QObject::destroyed, [] { reportStatus(SERVICE_STOPPED); });
|
||||||
|
|
||||||
setupControlManager();
|
setupControlManager();
|
||||||
setupConfManager();
|
setupConfManager();
|
||||||
}
|
}
|
||||||
@ -110,8 +112,6 @@ void ServiceManager::processControl(quint32 code, quint32 eventType)
|
|||||||
Q_FALLTHROUGH();
|
Q_FALLTHROUGH();
|
||||||
case FORT_SERVICE_CONTROL_UNINSTALL:
|
case FORT_SERVICE_CONTROL_UNINSTALL:
|
||||||
case SERVICE_CONTROL_SHUTDOWN: {
|
case SERVICE_CONTROL_SHUTDOWN: {
|
||||||
qApp->connect(qApp, &QObject::destroyed, [] { reportStatus(SERVICE_STOPPED); });
|
|
||||||
|
|
||||||
OsUtil::quit("service control"); // it's threadsafe
|
OsUtil::quit("service control"); // it's threadsafe
|
||||||
|
|
||||||
state = SERVICE_STOP_PENDING;
|
state = SERVICE_STOP_PENDING;
|
||||||
|
@ -36,11 +36,18 @@ bool processAutoUpdateManager_startDownload(AutoUpdateManager *autoUpdateManager
|
|||||||
return autoUpdateManager->startDownload();
|
return autoUpdateManager->startDownload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool processAutoUpdateManager_runInstaller(AutoUpdateManager *autoUpdateManager,
|
||||||
|
const ProcessCommandArgs & /*p*/, QVariantList & /*resArgs*/)
|
||||||
|
{
|
||||||
|
return autoUpdateManager->runInstaller();
|
||||||
|
}
|
||||||
|
|
||||||
using processAutoUpdateManager_func = bool (*)(
|
using processAutoUpdateManager_func = bool (*)(
|
||||||
AutoUpdateManager *autoUpdateManager, const ProcessCommandArgs &p, QVariantList &resArgs);
|
AutoUpdateManager *autoUpdateManager, const ProcessCommandArgs &p, QVariantList &resArgs);
|
||||||
|
|
||||||
static processAutoUpdateManager_func processAutoUpdateManager_funcList[] = {
|
static processAutoUpdateManager_func processAutoUpdateManager_funcList[] = {
|
||||||
&processAutoUpdateManager_startDownload, // Rpc_AutoUpdateManager_startDownload,
|
&processAutoUpdateManager_startDownload, // Rpc_AutoUpdateManager_startDownload,
|
||||||
|
&processAutoUpdateManager_runInstaller, // Rpc_AutoUpdateManager_runInstaller,
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool processAutoUpdateManagerRpcResult(
|
inline bool processAutoUpdateManagerRpcResult(
|
||||||
@ -48,7 +55,7 @@ inline bool processAutoUpdateManagerRpcResult(
|
|||||||
{
|
{
|
||||||
const processAutoUpdateManager_func func = RpcManager::getProcessFunc(p.command,
|
const processAutoUpdateManager_func func = RpcManager::getProcessFunc(p.command,
|
||||||
processAutoUpdateManager_funcList, Control::Rpc_AutoUpdateManager_startDownload,
|
processAutoUpdateManager_funcList, Control::Rpc_AutoUpdateManager_startDownload,
|
||||||
Control::Rpc_AutoUpdateManager_startDownload);
|
Control::Rpc_AutoUpdateManager_runInstaller);
|
||||||
|
|
||||||
return func ? func(autoUpdateManager, p, resArgs) : false;
|
return func ? func(autoUpdateManager, p, resArgs) : false;
|
||||||
}
|
}
|
||||||
@ -137,6 +144,11 @@ bool AutoUpdateManagerRpc::startDownload()
|
|||||||
return IoC<RpcManager>()->doOnServer(Control::Rpc_AutoUpdateManager_startDownload);
|
return IoC<RpcManager>()->doOnServer(Control::Rpc_AutoUpdateManager_startDownload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AutoUpdateManagerRpc::runInstaller()
|
||||||
|
{
|
||||||
|
return IoC<RpcManager>()->doOnServer(Control::Rpc_AutoUpdateManager_runInstaller);
|
||||||
|
}
|
||||||
|
|
||||||
void AutoUpdateManagerRpc::setupManager()
|
void AutoUpdateManagerRpc::setupManager()
|
||||||
{
|
{
|
||||||
setupClientSignals();
|
setupClientSignals();
|
||||||
|
@ -32,6 +32,8 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
bool startDownload() override;
|
bool startDownload() override;
|
||||||
|
|
||||||
|
bool runInstaller() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setupManager() override;
|
void setupManager() override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user