Merge pull request #2164 from devinbileck/update_windows_install_experience

Update windows install experience
This commit is contained in:
Christoph Atteneder 2019-01-04 12:09:27 +01:00 committed by GitHub
commit d1a5aaec3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 76 additions and 40 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

View File

@ -1,14 +1,17 @@
;This file will be executed next to the application bundle image
;This file will be executed next to the application bundle image
;I.e. current directory will contain folder Bisq with application files
[Setup]
;Note: This file must use UTF-8 encoding with BOM
#define SourceDir GetEnv('package_dir') + '\windows'
[Setup]
AppId={{bisq}}
AppName=Bisq
AppVersion=0.9.1
AppVerName=Bisq
AppPublisher=Bisq
AppComments=Bisq
AppCopyright=Copyright (C) 2018
AppComments={cm:AppComments}
AppPublisherURL=https://bisq.network
AppSupportURL=https://bisq.network
;AppUpdatesURL=http://java.com/
@ -16,55 +19,55 @@ DefaultDirName={localappdata}\Bisq
DisableStartupPrompt=Yes
DisableDirPage=Yes
DisableProgramGroupPage=Yes
DisableReadyPage=Yes
DisableFinishedPage=Yes
DisableReadyPage=No
DisableFinishedPage=No
DisableWelcomePage=Yes
DefaultGroupName=Bisq
;Optional License
LicenseFile=
;WinXP or above
MinVersion=0,5.1
OutputBaseFilename=Bisq
;Windows 7 with Service Pack 1 or above
MinVersion=0,6.1.7601
Compression=lzma
SolidCompression=yes
PrivilegesRequired=lowest
SetupIconFile=Bisq\Bisq.ico
UninstallDisplayIcon={app}\Bisq.ico
UninstallDisplayName=Bisq
WizardImageFile={#SourceDir}\Bisq-setup-image.bmp
WizardImageStretch=No
WizardSmallImageFile=Bisq-setup-icon.bmp
ArchitecturesInstallIn64BitMode=x64
ChangesAssociations=Yes
ShowLanguageDialog=No
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: en; MessagesFile: "compiler:Default.isl"
Name: de; MessagesFile: "compiler:Languages\German.isl"
Name: fr; MessagesFile: "compiler:Languages\French.isl"
Name: sp; MessagesFile: "compiler:Languages\Spanish.isl"
[CustomMessages]
en.AppComments=The decentralized exchange network
en.AppIsRunning=Bisq is running, please close it and run setup again.
de.AppComments=Das dezentrale Austauschnetzwerk
de.AppIsRunning=Bisq läuft, bitte schließen Sie es und führen Sie das Setup erneut aus.
fr.AppComments=Le réseau d'échange décentralisé
fr.AppIsRunning=Bisq est en cours d'exécution, fermez-le et exécutez à nouveau le programme d'installation.
sp.AppComments=La red de intercambio descentralizado
sp.AppIsRunning=Bisq se está ejecutando, ciérrelo y vuelva a ejecutar la configuración.
[Files]
Source: "Bisq\Bisq.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Bisq\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico"; Check: returnTrue()
Name: "{commondesktop}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico"; Check: returnFalse()
Name: "{group}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico"
Name: "{userdesktop}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico"
[Run]
Filename: "{app}\Bisq.exe"; Description: "{cm:LaunchProgram,Bisq}"; Flags: nowait postinstall skipifsilent; Check: returnTrue()
Filename: "{app}\Bisq.exe"; Parameters: "-install -svcName ""Bisq"" -svcDesc ""Bisq"" -mainExe ""Bisq.exe"" "; Check: returnFalse()
[UninstallRun]
Filename: "{app}\Bisq.exe "; Parameters: "-uninstall -svcName Bisq -stopOnUninstall"; Check: returnFalse()
Filename: "{app}\Bisq.exe"; Description: "{cm:LaunchProgram,Bisq}"; Flags: nowait postinstall skipifsilent
[Code]
function returnTrue(): Boolean;
begin
Result := True;
end;
function returnFalse(): Boolean;
begin
Result := False;
end;
procedure DirectoryCopy(SourcePath, DestPath: string);
var
FindRec: TFindRec;
@ -122,7 +125,7 @@ begin
entry := ExpandConstant('{localappdata}') + '\Bisq\';
if DirExists(entry) then begin
DelTree(entry, true, true, true);
end
end;
end;
procedure DeleteTorFiles;
@ -137,15 +140,15 @@ begin
hiddenServiceDir := mainnetDir + '\tor\hiddenservice';
hiddenServiceBackupDir := mainnetDir + '\hiddenservice_backup';
if DirExists(hiddenServiceDir) then begin
if DirExists(hiddenServiceBackupDir) then begin
DelTree(hiddenServiceBackupDir, true, true, true);
end
CreateDir(hiddenServiceBackupDir);
DirectoryCopy(hiddenServiceDir, hiddenServiceBackupDir);
DelTree(torDir, false, true, true);
CreateDir(hiddenServiceDir);
DirectoryCopy(hiddenServiceBackupDir, hiddenServiceDir);
end
if DirExists(hiddenServiceBackupDir) then begin
DelTree(hiddenServiceBackupDir, true, true, true);
end;
CreateDir(hiddenServiceBackupDir);
DirectoryCopy(hiddenServiceDir, hiddenServiceBackupDir);
DelTree(torDir, false, true, true);
CreateDir(hiddenServiceDir);
DirectoryCopy(hiddenServiceBackupDir, hiddenServiceDir);
end;
end;
function PrepareToInstall(var NeedsRestart: Boolean): String;
@ -155,11 +158,44 @@ begin
Result := '';
end;
function IsAppRunning(): Boolean;
var
FSWbemLocator : Variant;
FWMIService : Variant;
FWbemObjectSet : Variant;
ExecutablePath : String;
begin
Result := False;
ExecutablePath := Format('%s\Bisq\Bisq.exe', [ExpandConstant('{localappdata}')])
StringChangeEx(ExecutablePath, '\', '\\', True);
try
FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator');
FWMIService := FSWbemLocator.ConnectServer('localhost', 'root\CIMV2', '', '');
FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where ExecutablePath="%s"', [ExecutablePath]));
Result := (FWbemObjectSet.Count > 0);
FWbemObjectSet := Unassigned;
FWMIService := Unassigned;
FSWbemLocator := Unassigned;
except
end;
end;
function InitializeSetup(): Boolean;
begin
// Possible future improvements:
// if version less or same => just launch app
// if upgrade => check if same app is running and wait for it to exit
// Add pack200/unpack200 support?
Result := True;
if IsAppRunning() then
begin
MsgBox(ExpandConstant('{cm:AppIsRunning}'), mbCriticalError, MB_OK);
Result := False;
end;
end;
function InitializeUninstall(): Boolean;
begin
Result := True;
if IsAppRunning() then
begin
MsgBox(ExpandConstant('{cm:AppIsRunning}'), mbCriticalError, MB_OK);
Result := False;
end;
end;