Advertisement
Guest User

Psi+ setup

a guest
Jun 2nd, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [Components]
  2. Name: "common"; Description: "Common files"; Types: Psi+ Psi+WebKit
  3. Name: "libs32"; Description: "Libs for x32"; Types: Psi+ Psi+WebKit
  4. Name: "plugins32"; Description: "Psi+ plugins x32"; Types: Psi+ Psi+WebKit
  5. Name: "bin32"; Description: "Psi+ binary x32"; Types: Psi+
  6. Name: "bin32w"; Description: "Psi+ binary webkit x32"; Types: Psi+WebKit
  7.  
  8. [Languages]
  9. Name: "english"; MessagesFile: "compiler:Default.isl"
  10. Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
  11. Name: "french"; MessagesFile: "compiler:Languages\French.isl"
  12.  
  13. [Setup]
  14. #define AppVer "1.0." + GetDateTimeString('yyyy/mm/dd', '.', '')
  15. AppName=Psi+
  16. AppVersion={#AppVer}-qt4
  17. AppCopyright2008-2017 Psi+ Project
  18. VersionInfoVersion={#AppVer}
  19. VersionInfoCompany=Psi+ Project
  20. VersionInfoTextVersion={VersionInfoVersion}-qt4
  21. VersionInfoCopyright=© 2008-2017 Psi+ Project
  22. VersionInfoProductName=Psi+
  23. VersionInfoProductVersion={#AppVer}
  24. VersionInfoProductTextVersion={#AppVer}
  25. AppId={{1C1C14F3-28EB-4A16-82BC-99977A774C2E}
  26. AppPublisher=Psi+ Project
  27. AppPublisherURL=http://psi-plus.com/
  28. LicenseFile=E:\Temp\psi-dev\dev\common\copying.txt
  29. SetupIconFile=E:\build\psibuild\work\win32\app.ico
  30. OutputDir=E:\Temp\psi-dev\dev
  31. OutputBaseFilename=psi-plus-{#AppVer}-qt4-setup
  32. Compression=lzma2/ultra64
  33. InternalCompressLevel=ultra
  34. AlwaysShowComponentsList=False
  35. DefaultDirName={pf}\Psi-plus-qt4
  36. UninstallDisplayName=Psi+ {#AppVer}-qt4
  37. AllowNoIcons=True
  38. DefaultGroupName=Psi+ (Qt4)
  39. AppSupportURL=https://github.com/psi-plus/main/issues
  40. AppUpdatesURL=http://yadi.sk/d/FD8HHORTQ5HYc
  41. UninstallDisplayIcon={app}\psi-plus.exe
  42. UninstallLogMode=new
  43.  
  44. [Types]
  45. Name: "Psi+"; Description: "Install Psi+"
  46. Name: "Psi+WebKit"; Description: "Install Psi+ with WebKit support"
  47.  
  48. [Files]
  49. Source: "E:\Temp\psi-dev\dev\common\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: common
  50. Source: "E:\Temp\psi-dev\dev\translations\*"; DestDir: "{app}\translations"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: common
  51. Source: "E:\Temp\psi-dev\dev\lib32\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs32
  52. Source: "E:\Temp\psi-dev\dev\psimedia\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs32
  53. Source: "E:\Temp\psi-dev\dev\plugins32\*"; DestDir: "{app}\plugins"; Flags: ignoreversion createallsubdirs recursesubdirs confirmoverwrite; Components: plugins32
  54. Source: "E:\Temp\psi-dev\dev\bin32\psi-plus.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: bin32
  55. Source: "E:\Temp\psi-dev\dev\bin32-w\psi-plus.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: bin32w
  56. Source: "E:\Temp\psi-dev\dev\common\copying.txt"; DestDir: "{app}"; Flags: ignoreversion
  57.  
  58. [Dirs]
  59. Name: "{app}\plugins"
  60.  
  61. [Run]
  62. Filename: "{app}\psi-plus.exe"; WorkingDir: "{app}"; Flags: postinstall nowait skipifsilent
  63.  
  64. [Icons]
  65. Name: "{userdesktop}\Psi+(Qt4)"; Filename: "{app}\psi-plus.exe"; WorkingDir: "{app}"; Flags: createonlyiffileexists; IconFilename: "{app}\psi-plus.exe"; IconIndex: 0; Tasks: desktopitems
  66. Name: "{group}\Uninstall Psi+(Qt4)"; Filename: "{uninstallexe}"; Flags: createonlyiffileexists; IconFilename: "{app}\psi-plus.exe"; IconIndex: 0; Tasks: uninstallitems
  67. Name: "{group}\Psi+(Qt4)"; Filename: "{app}\psi-plus.exe"; WorkingDir: "{app}"; Flags: createonlyiffileexists; IconFilename: "{app}\psi-plus.exe"
  68.  
  69. [ThirdParty]
  70. UseRelativePaths=True
  71.  
  72. [Tasks]
  73. Name: "desktopitems"; Description: "{cm:InstallDS}"; Components: common
  74. Name: "uninstallitems"; Description: "{cm:InstallUN}"; Components: common
  75.  
  76. [CustomMessages]
  77. english.InstallDS=Create Psi+ desktop shortcut
  78. russian.InstallDS=Установить иконку Psi+ на Рабочий стол
  79. french.InstallDS=Créer un raccourci de bureau
  80. english.InstallUN=Create Uninstall icon in Program Group
  81. russian.InstallUN=Создать иконку Uninstall в меню программы
  82. french.InstallUN=Créer un raccourci de désinstallation dans le groupe du logiciel
  83.  
  84. [Code]
  85. function GetNumber(var temp: String): Integer;
  86. var
  87.   part: String;
  88.   pos1: Integer;
  89. begin
  90.   if Length(temp) = 0 then
  91.   begin
  92.     Result := -1;
  93.     Exit;
  94.   end;
  95.     pos1 := Pos('.', temp);
  96.     if (pos1 = 0) then
  97.     begin
  98.       Result := StrToInt(temp);
  99.     temp := '';
  100.     end
  101.     else
  102.     begin
  103.     part := Copy(temp, 1, pos1 - 1);
  104.       temp := Copy(temp, pos1 + 1, Length(temp));
  105.       Result := StrToInt(part);
  106.     end;
  107. end;
  108.  
  109. function CompareInner(var temp1, temp2: String): Integer;
  110. var
  111.   num1, num2: Integer;
  112. begin
  113.     num1 := GetNumber(temp1);
  114.   num2 := GetNumber(temp2);
  115.   if (num1 = -1) or (num2 = -1) then
  116.   begin
  117.     Result := 0;
  118.     Exit;
  119.   end;
  120.       if (num1 > num2) then
  121.       begin
  122.         Result := 1;
  123.       end
  124.       else if (num1 < num2) then
  125.       begin
  126.         Result := -1;
  127.       end
  128.       else
  129.       begin
  130.         Result := CompareInner(temp1, temp2);
  131.       end;
  132. end;
  133.  
  134. function CompareVersion(str1, str2: String): Integer;
  135. var
  136.   temp1, temp2: String;
  137. begin
  138.     temp1 := str1;
  139.     temp2 := str2;
  140.     Result := CompareInner(temp1, temp2);
  141. end;
  142.  
  143. function InitializeSetup(): Boolean;
  144. var
  145.   oldVersion: String;
  146.   uninstaller: String;
  147.   ErrorCode: Integer;
  148.   vCurID      :String;
  149.   vCurAppName :String;
  150. begin
  151.   vCurID:= '{#SetupSetting("AppId")}';
  152.   vCurAppName:= '{#SetupSetting("AppName")}';
  153.   //remove first "{" of ID
  154.   vCurID:= Copy(vCurID, 2, Length(vCurID) - 1);
  155.   //
  156.   if RegKeyExists(HKEY_LOCAL_MACHINE,
  157.     'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + vCurID + '_is1') then
  158.   begin
  159.     RegQueryStringValue(HKEY_LOCAL_MACHINE,
  160.       'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + vCurID + '_is1',
  161.       'DisplayVersion', oldVersion);
  162.     if (CompareVersion(oldVersion, '{#SetupSetting("AppVersion")}') < 0) then      
  163.     begin
  164.       if MsgBox('Previous version - v' + oldVersion + ' of "' + vCurAppName + '" detected. ' + ' Setup will remove ' + oldVersion + ' version . Do you want to continue?',
  165.         mbConfirmation, MB_YESNO) = IDNO then
  166.       begin
  167.         Result := False;
  168.       end
  169.       else
  170.       begin
  171.           RegQueryStringValue(HKEY_LOCAL_MACHINE,
  172.             'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + vCurID + '_is1',
  173.             'UninstallString', uninstaller);
  174.           ShellExec('runas', uninstaller, '/SILENT', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
  175.           Result := True;
  176.       end;
  177.     end
  178.     else
  179.     begin
  180.       MsgBox('The same version ' + oldVersion + ' of ' + vCurAppName + ' or newer is already installed. This installer will exit now.',
  181.         mbInformation, MB_OK);
  182.       Result := False;
  183.     end;
  184.   end
  185.   else
  186.   begin
  187.     Result := True;
  188.   end;
  189. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement