Browse Source

Remove duplication in installer scripts

Antony Male 9 years ago
parent
commit
802c5811db
3 changed files with 122 additions and 228 deletions
  1. 118 0
      installer/common.iss
  2. 2 115
      installer/x64/installer-x64.iss
  3. 2 113
      installer/x86/installer-x86.iss

+ 118 - 0
installer/common.iss

@@ -0,0 +1,118 @@
+#define AppExeName "SyncTrayzor.exe"
+#define AppRoot "..\.."
+#define AppSrc AppRoot + "\src\SyncTrayzor"
+#define AppBin AppRoot +"\bin\" + Arch + "\Release"
+#define AppExe AppBin + "\SyncTrayzor.exe"
+#define AppName GetStringFileInfo(AppExe, "ProductName")
+#define AppVersion GetFileVersion(AppExe)
+#define AppPublisher "SyncTrayzor"
+#define AppURL "https://github.com/canton7/SyncTrayzor"
+#define AppDataFolder "SyncTrayzor"
+#define RunRegKey "Software\Microsoft\Windows\CurrentVersion\Run"
+
+
+[Setup]
+AppId={{#AppId}
+AppName={#AppName} ({#Arch})
+AppVersion={#AppVersion}
+;AppVerName={#AppName} {#AppVersion}
+AppPublisher={#AppPublisher}
+AppPublisherURL={#AppURL}
+AppSupportURL={#AppURL}
+AppUpdatesURL={#AppURL}
+DefaultDirName={pf}\{#AppName}
+DefaultGroupName={#AppName}
+AllowNoIcons=yes
+LicenseFile={#AppRoot}\LICENSE.txt
+OutputDir="."
+OutputBaseFilename={#AppName}Setup-{#Arch}
+SetupIconFile={#AppSrc}\Icons\default.ico
+Compression=lzma2/max
+;Compression=None
+SolidCompression=yes
+PrivilegesRequired=admin
+CloseApplications=yes
+RestartApplications=no
+; If we try and close CefSharp.BrowserSubprocess.exe we'll fail - it doesn't respond well
+; However if we close *just* SyncTrayzor, that will take care of shutting down CefSharp and syncthing
+CloseApplicationsFilter=SyncTrayzor.exe
+TouchDate=current
+#if "x64" == Arch
+ArchitecturesInstallIn64BitMode=x64
+ArchitecturesAllowed=x64
+#endif
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+[Tasks]
+Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
+
+[Dirs]
+Name: "{userappdata}\{#AppDataFolder}"
+
+[Files]
+Source: "{#AppBin}\*"; DestDir: "{app}"; Excludes: "*.xml,*.vshost.*,*.config,*.log,FluentValidation.resources.dll,System.Windows.Interactivity.resources.dll,syncthing.exe,data,logs,ffmpegsumo.dll,d3dcompiler_43.dll,d3dcompiler_47.dll,libEGL.dll,libGLESv2.dll,pdf.dll"; Flags: ignoreversion recursesubdirs
+Source: "{#AppBin}\SyncTrayzor.exe.Installer.config"; DestDir: "{app}"; DestName: "SyncTrayzor.exe.config"; Flags: ignoreversion
+Source: "{#AppSrc}\Icons\default.ico"; DestDir: "{app}"; Flags: ignoreversion
+Source: "{#AppRoot}\*.md"; DestDir: "{app}"; Flags: ignoreversion
+Source: "{#AppRoot}\*.txt"; DestDir: "{app}"; Flags: ignoreversion
+Source: "*.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "syncthing.exe"; DestDir: "{app}"; DestName: "syncthing.exe"; Flags: ignoreversion
+
+Source: "..\dotNet451Setup.exe"; DestDir: {tmp}; Flags: deleteafterinstall; Check: FrameworkIsNotInstalled
+
+[Icons]
+Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"
+Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
+Name: "{commondesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon
+
+[Run]
+Filename: "{tmp}\dotNet451Setup.exe"; Parameters: "/passive /promptrestart"; Check: FrameworkIsNotInstalled; StatusMsg: "Microsoft .NET Framework 4.5.1 is being installed. Please wait..."
+Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(AppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
+
+[Code]
+function FrameworkIsNotInstalled: Boolean;
+var 
+  exists: boolean;
+  release: cardinal;
+begin
+  exists := RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', release);
+  result := not exists or (release < 378758);
+end;
+
+procedure BumpInstallCount;
+var
+  fileContents: AnsiString;
+  installCount: integer;
+begin
+  { Increment the install count in InstallCount.txt if it exists, or create it with the contents '1' if it doesn't }
+  if LoadStringFromFile(ExpandConstant('{app}\InstallCount.txt'), fileContents) then
+  begin
+    installCount := StrTointDef(Trim(string(fileContents)), 0) + 1;
+  end
+  else
+  begin
+    installCount := 1;
+  end;
+
+  SaveStringToFile(ExpandConstant('{app}\InstallCount.txt'), IntToStr(installCount), False);
+end;
+
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+  if CurStep = ssInstall then
+  begin
+    BumpInstallCount();
+
+    { We might be being run from ProcessRunner.exe, *and* we might be trying to update it. Funsies. Let's rename it (which Windows lets us do) }
+    DeleteFile(ExpandConstant('{app}\ProcessRunner.exe.old'));
+    RenameFile(ExpandConstant('{app}\ProcessRunner.exe'), ExpandConstant('{app}\ProcessRunner.exe.old'));
+  end
+end;
+
+[UninstallDelete]
+Type: files; Name: "{app}\ProcessRunner.exe.old"
+Type: files; Name: "{app}\InstallCount.txt"
+Type: filesandordirs; Name: "{userappdata}\{#AppDataFolder}"
+Type: filesandordirs; Name: "{localappdata}\{#AppDataFolder}"

+ 2 - 115
installer/x64/installer-x64.iss

@@ -1,117 +1,4 @@
-#define AppExeName "SyncTrayzor.exe"
-#define AppRoot "..\.."
 #define Arch "x64"
-#define AppSrc AppRoot + "\src\SyncTrayzor"
-#define AppBin AppRoot +"\bin\" + Arch + "\Release"
-#define AppExe AppBin + "\SyncTrayzor.exe"
-#define AppName GetStringFileInfo(AppExe, "ProductName")
-#define AppVersion GetFileVersion(AppExe)
-#define AppPublisher "SyncTrayzor"
-#define AppURL "https://github.com/canton7/SyncTrayzor"
-#define AppDataFolder "SyncTrayzor"
-#define RunRegKey "Software\Microsoft\Windows\CurrentVersion\Run"
+#define AppId "{c004dcef-b848-46a5-9c30-4dbf736396fa}"
 
-
-[Setup]
-AppId={{c004dcef-b848-46a5-9c30-4dbf736396fa}
-AppName={#AppName} ({#Arch})
-AppVersion={#AppVersion}
-;AppVerName={#AppName} {#AppVersion}
-AppPublisher={#AppPublisher}
-AppPublisherURL={#AppURL}
-AppSupportURL={#AppURL}
-AppUpdatesURL={#AppURL}
-DefaultDirName={pf}\{#AppName}
-DefaultGroupName={#AppName}
-AllowNoIcons=yes
-LicenseFile={#AppRoot}\LICENSE.txt
-OutputDir="."
-OutputBaseFilename={#AppName}Setup-{#Arch}
-SetupIconFile={#AppSrc}\Icons\default.ico
-Compression=lzma2/max
-;Compression=None
-SolidCompression=yes
-PrivilegesRequired=admin
-ArchitecturesInstallIn64BitMode=x64
-ArchitecturesAllowed=x64
-CloseApplications=yes
-RestartApplications=no
-; If we try and close CefSharp.BrowserSubprocess.exe we'll fail - it doesn't respond well
-; However if we close *just* SyncTrayzor, that will take care of shutting down CefSharp and syncthing
-CloseApplicationsFilter=SyncTrayzor.exe
-TouchDate=current
-
-[Languages]
-Name: "english"; MessagesFile: "compiler:Default.isl"
-
-[Tasks]
-Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked           
-
-[Dirs]
-Name: "{userappdata}\{#AppDataFolder}"
-
-[Files]
-Source: "{#AppBin}\*"; DestDir: "{app}"; Excludes: "*.xml,*.vshost.*,*.config,*.log,FluentValidation.resources.dll,System.Windows.Interactivity.resources.dll,syncthing.exe,data,logs,ffmpegsumo.dll,d3dcompiler_43.dll,d3dcompiler_47.dll,libEGL.dll,libGLESv2.dll,pdf.dll"; Flags: ignoreversion recursesubdirs
-Source: "{#AppBin}\SyncTrayzor.exe.Installer.config"; DestDir: "{app}"; DestName: "SyncTrayzor.exe.config"; Flags: ignoreversion
-Source: "{#AppSrc}\Icons\default.ico"; DestDir: "{app}"; Flags: ignoreversion
-Source: "{#AppRoot}\*.md"; DestDir: "{app}"; Flags: ignoreversion
-Source: "{#AppRoot}\*.txt"; DestDir: "{app}"; Flags: ignoreversion
-Source: "*.dll"; DestDir: "{app}"; Flags: ignoreversion
-Source: "syncthing.exe"; DestDir: "{app}"; DestName: "syncthing.exe"; Flags: ignoreversion
-
-Source: "..\dotNet451Setup.exe"; DestDir: {tmp}; Flags: deleteafterinstall; Check: FrameworkIsNotInstalled
-
-[Icons]
-Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"
-Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
-Name: "{commondesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon
-
-[Run]
-Filename: "{tmp}\dotNet451Setup.exe"; Parameters: "/passive /promptrestart"; Check: FrameworkIsNotInstalled; StatusMsg: "Microsoft .NET Framework 4.5.1 is being installed. Please wait..."
-Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(AppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
-
-[Code]
-function FrameworkIsNotInstalled: Boolean;
-var 
-  exists: boolean;
-  release: cardinal;
-begin
-  exists := RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', release);
-  result := not exists or (release < 378758);
-end;
-
-procedure BumpInstallCount;
-var
-  fileContents: AnsiString;
-  installCount: integer;
-begin
-  { Increment the install count in InstallCount.txt if it exists, or create it with the contents '1' if it doesn't }
-  if LoadStringFromFile(ExpandConstant('{app}\InstallCount.txt'), fileContents) then
-  begin
-    installCount := StrTointDef(Trim(string(fileContents)), 0) + 1;
-  end
-  else
-  begin
-    installCount := 1;
-  end;
-
-  SaveStringToFile(ExpandConstant('{app}\InstallCount.txt'), IntToStr(installCount), False);
-end;
-
-procedure CurStepChanged(CurStep: TSetupStep);
-begin
-  if CurStep = ssInstall then
-  begin
-    BumpInstallCount();
-
-    { We might be being run from ProcessRunner.exe, *and* we might be trying to update it. Funsies. Let's rename it (which Windows lets us do) }
-    DeleteFile(ExpandConstant('{app}\ProcessRunner.exe.old'));
-    RenameFile(ExpandConstant('{app}\ProcessRunner.exe'), ExpandConstant('{app}\ProcessRunner.exe.old'));
-  end
-end;
-
-[UninstallDelete]
-Type: files; Name: "{app}\ProcessRunner.exe.old"
-Type: files; Name: "{app}\InstallCount.txt"
-Type: filesandordirs; Name: "{userappdata}\{#AppDataFolder}"
-Type: filesandordirs; Name: "{localappdata}\{#AppDataFolder}"
+#include "../common.iss"

+ 2 - 113
installer/x86/installer-x86.iss

@@ -1,115 +1,4 @@
-#define AppExeName "SyncTrayzor.exe"
-#define AppRoot "..\.."
 #define Arch "x86"
-#define AppSrc AppRoot + "\src\SyncTrayzor"
-#define AppBin AppRoot +"\bin\" + Arch + "\Release"
-#define AppExe AppBin + "\SyncTrayzor.exe"
-#define AppName GetStringFileInfo(AppExe, "ProductName")
-#define AppVersion GetFileVersion(AppExe)
-#define AppPublisher "SyncTrayzor"
-#define AppURL "https://github.com/canton7/SyncTrayzor"
-#define AppDataFolder "SyncTrayzor"
-#define RunRegKey "Software\Microsoft\Windows\CurrentVersion\Run"
+#define AppId "{c9bab27b-d754-4b62-ad8c-3509e1cac15c}"
 
-
-[Setup]
-AppId={{c9bab27b-d754-4b62-ad8c-3509e1cac15c}
-AppName={#AppName} ({#Arch})
-AppVersion={#AppVersion}
-;AppVerName={#AppName} {#AppVersion}
-AppPublisher={#AppPublisher}
-AppPublisherURL={#AppURL}
-AppSupportURL={#AppURL}
-AppUpdatesURL={#AppURL}
-DefaultDirName={pf}\{#AppName}
-DefaultGroupName={#AppName}
-AllowNoIcons=yes
-LicenseFile={#AppRoot}\LICENSE.txt
-OutputDir="."
-OutputBaseFilename={#AppName}Setup-{#Arch}
-SetupIconFile={#AppSrc}\Icons\default.ico
-Compression=lzma2/max
-;Compression=None
-SolidCompression=yes
-PrivilegesRequired=admin
-CloseApplications=yes
-RestartApplications=no
-; If we try and close CefSharp.BrowserSubprocess.exe we'll fail - it doesn't respond well
-; However if we close *just* SyncTrayzor, that will take care of shutting down CefSharp and syncthing
-CloseApplicationsFilter=SyncTrayzor.exe
-TouchDate=current
-
-[Languages]
-Name: "english"; MessagesFile: "compiler:Default.isl"
-
-[Tasks]
-Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
-
-[Dirs]
-Name: "{userappdata}\{#AppDataFolder}"
-
-[Files]
-Source: "{#AppBin}\*"; DestDir: "{app}"; Excludes: "*.xml,*.vshost.*,*.config,*.log,FluentValidation.resources.dll,System.Windows.Interactivity.resources.dll,syncthing.exe,data,logs,ffmpegsumo.dll,d3dcompiler_43.dll,d3dcompiler_47.dll,libEGL.dll,libGLESv2.dll,pdf.dll"; Flags: ignoreversion recursesubdirs
-Source: "{#AppBin}\SyncTrayzor.exe.Installer.config"; DestDir: "{app}"; DestName: "SyncTrayzor.exe.config"; Flags: ignoreversion
-Source: "{#AppSrc}\Icons\default.ico"; DestDir: "{app}"; Flags: ignoreversion
-Source: "{#AppRoot}\*.md"; DestDir: "{app}"; Flags: ignoreversion
-Source: "{#AppRoot}\*.txt"; DestDir: "{app}"; Flags: ignoreversion
-Source: "*.dll"; DestDir: "{app}"; Flags: ignoreversion
-Source: "syncthing.exe"; DestDir: "{app}"; DestName: "syncthing.exe"; Flags: ignoreversion
-
-Source: "..\dotNet451Setup.exe"; DestDir: {tmp}; Flags: deleteafterinstall; Check: FrameworkIsNotInstalled
-
-[Icons]
-Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"
-Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
-Name: "{commondesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon
-
-[Run]
-Filename: "{tmp}\dotNet451Setup.exe"; Parameters: "/passive /promptrestart"; Check: FrameworkIsNotInstalled; StatusMsg: "Microsoft .NET Framework 4.5.1 is being installed. Please wait..."
-Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(AppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
-
-[Code]
-function FrameworkIsNotInstalled: Boolean;
-var 
-  exists: boolean;
-  release: cardinal;
-begin
-  exists := RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', release);
-  result := not exists or (release < 378758);
-end;
-
-procedure BumpInstallCount;
-var
-  fileContents: AnsiString;
-  installCount: integer;
-begin
-  { Increment the install count in InstallCount.txt if it exists, or create it with the contents '1' if it doesn't }
-  if LoadStringFromFile(ExpandConstant('{app}\InstallCount.txt'), fileContents) then
-  begin
-    installCount := StrTointDef(Trim(string(fileContents)), 0) + 1;
-  end
-  else
-  begin
-    installCount := 1;
-  end;
-
-  SaveStringToFile(ExpandConstant('{app}\InstallCount.txt'), IntToStr(installCount), False);
-end;
-
-procedure CurStepChanged(CurStep: TSetupStep);
-begin
-  if CurStep = ssInstall then
-  begin
-    BumpInstallCount();
-
-    { We might be being run from ProcessRunner.exe, *and* we might be trying to update it. Funsies. Let's rename it (which Windows lets us do) }
-    DeleteFile(ExpandConstant('{app}\ProcessRunner.exe.old'));
-    RenameFile(ExpandConstant('{app}\ProcessRunner.exe'), ExpandConstant('{app}\ProcessRunner.exe.old'));
-  end
-end;
-
-[UninstallDelete]
-Type: files; Name: "{app}\ProcessRunner.exe.old"
-Type: files; Name: "{app}\InstallCount.txt"
-Type: filesandordirs; Name: "{userappdata}\{#AppDataFolder}"
-Type: filesandordirs; Name: "{localappdata}\{#AppDataFolder}"
+#include "../common.iss"