-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstaller.iss
More file actions
85 lines (76 loc) · 6.06 KB
/
Copy pathinstaller.iss
File metadata and controls
85 lines (76 loc) · 6.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
; Inno Setup Script for IppPrinter
; See http://www.jrsoftware.org/ishelp/ for details on Inno Setup script format.
#define MyAppName "IppPrinter"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "Daniel Klecha"
#define MyAppExeName "IppPrinter.exe"
[Setup]
AppId={{E8C7A3F0-DE9E-4B07-AB7E-3DFB54C8D003}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL=https://github.com/danielklecha/IppPrinter
AppSupportURL=https://github.com/danielklecha/IppPrinter/issues
UninstallDisplayIcon={app}\{#MyAppExeName}
MinVersion=10.0.17763
DefaultDirName={commonpf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=IppPrinterSetup
OutputDir=Output
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
SetupLogging=yes
SetupArchitecture=x64
ArchitecturesInstallIn64BitMode=x64compatible
LicenseFile=..\IppPrinter\bin\Release\net10.0\win-x64\publish\LICENSE.txt
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
[Icons]
Name: "{autodesktop}\IppPrinter Jobs"; Filename: "{code:GetJobsDir}"; Check: IsDesktopIconSelected
Name: "{autostartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: IsStartupAppSelected
[Files]
; Source files should be published before running this script
Source: "..\IppPrinter\bin\Release\net10.0\win-x64\publish\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "Add-Printer.ps1"; DestDir: "{app}\Setup"; Flags: ignoreversion
Source: "Remove-Printer.ps1"; DestDir: "{app}\Setup"; Flags: ignoreversion
Source: "Add-Certificate.ps1"; DestDir: "{app}\Setup"; Flags: ignoreversion
Source: "Remove-Certificate.ps1"; DestDir: "{app}\Setup"; Flags: ignoreversion
Source: "Update-AppSettings.ps1"; DestDir: "{app}\Setup"; Flags: ignoreversion
[Run]
; 0.5 Configure Kestrel via PowerShell
Filename: "{sys}\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "-NoProfile -ExecutionPolicy Bypass -File ""{app}\Setup\Update-AppSettings.ps1"" -Scheme {code:GetProtocolScheme} -AppDir ""{app}"" -JobsDir ""{code:GetJobsDir}"" -PostProcessName ""{code:GetPostProcessName}"" -PostProcessArguments ""{code:GetPostProcessArguments}"""; Flags: runhidden waituntilterminated; StatusMsg: "Configuring AppSettings..."
; 1. Run PowerShell script to generate and trust certificate (HTTPS only)
Filename: "{sys}\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "-NoProfile -ExecutionPolicy Bypass -File ""{app}\Setup\Add-Certificate.ps1"""; Flags: runhidden waituntilterminated; StatusMsg: "Generating self-signed certificate..."; Check: IsHttpsSelected
; 1.5 Create Windows Service (Service mode only)
Filename: "{sys}\sc.exe"; Parameters: "create {#MyAppName} binPath= ""{app}\{#MyAppExeName}"" start= auto DisplayName= ""{#MyAppName}"""; Flags: runhidden waituntilterminated; StatusMsg: "Registering Windows Service..."; Check: IsServiceSelected
; 2. Add Windows Firewall Rule
Filename: "{sys}\netsh.exe"; Parameters: "advfirewall firewall add rule name=""{#MyAppName}"" dir=in action=allow protocol=TCP localport=631 program=""{app}\{#MyAppExeName}"" enable=yes"; Flags: runhidden waituntilterminated; StatusMsg: "Configuring Windows Firewall..."
; 3. Start Windows Service (Service mode only)
Filename: "{sys}\sc.exe"; Parameters: "start {#MyAppName}"; Flags: runhidden waituntilterminated; StatusMsg: "Starting Windows Service..."; Check: IsServiceSelected
; 3.5. Start Startup Application immediately so port 631 is open for Add-Printer.ps1 (Startup App mode only)
Filename: "{app}\{#MyAppExeName}"; Flags: nowait runhidden runasoriginaluser; StatusMsg: "Starting Startup Application..."; Check: IsStartupAppSelected
; 4. Run PowerShell script to add Windows Printer Queue
Filename: "{sys}\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "-NoProfile -ExecutionPolicy Bypass -Command ""& '{app}\Setup\Add-Printer.ps1' -Scheme {code:GetProtocolScheme} *>&1 | Out-File -FilePath '{app}\printer_setup.log' -Encoding utf8"""; Flags: runhidden waituntilterminated; StatusMsg: "Installing IPP Printer queue..."
; 5. Post-install options
Filename: "{code:GetJobsDir}"; Description: "Open jobs folder"; Flags: postinstall shellexec skipifsilent unchecked
Filename: "{app}"; Description: "Open installation folder"; Flags: postinstall shellexec skipifsilent unchecked
Filename: "ms-settings:printers"; Description: "Open Windows Printers & Scanners settings"; Flags: postinstall shellexec skipifsilent unchecked
Filename: "{code:GetInstallLogPath}"; Description: "View installation log"; Flags: postinstall shellexec skipifsilent unchecked
Filename: "{app}\THIRD-PARTY-NOTICES.txt"; Description: "View third-party licenses and notices"; Flags: postinstall shellexec skipifsilent unchecked
[UninstallRun]
; 0.5 Stop Windows Service and process synchronously if running
Filename: "{sys}\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "-NoProfile -ExecutionPolicy Bypass -Command ""Stop-Service -Name '{#MyAppName}' -Force -ErrorAction SilentlyContinue; Stop-Process -Name '{#MyAppName}' -Force -ErrorAction SilentlyContinue"""; Flags: runhidden waituntilterminated; RunOnceId: "StopIppPrinterApp"
; 1. Run PowerShell script to remove Windows Printer Queue
Filename: "{sys}\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "-NoProfile -ExecutionPolicy Bypass -File ""{app}\Setup\Remove-Printer.ps1"""; Flags: runhidden waituntilterminated; RunOnceId: "RemovePrinterQueue"
; 1.5. Run PowerShell script to remove certificate
Filename: "{sys}\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "-NoProfile -ExecutionPolicy Bypass -File ""{app}\Setup\Remove-Certificate.ps1"""; Flags: runhidden waituntilterminated; RunOnceId: "RemoveCertificate"
; 2. Delete Windows Firewall Rule
Filename: "{sys}\netsh.exe"; Parameters: "advfirewall firewall delete rule name=""{#MyAppName}"""; Flags: runhidden waituntilterminated; RunOnceId: "RemoveFirewallRule"
; 3. Delete Windows Service
Filename: "{sys}\sc.exe"; Parameters: "delete {#MyAppName}"; Flags: runhidden waituntilterminated; RunOnceId: "DeleteService"
[Code]
#include "installer.pas"