Skip to content

Commit

Permalink
[WIP] Fix path of the windows installers
Browse files Browse the repository at this point in the history
  • Loading branch information
vlabo committed Oct 11, 2024
1 parent 6be7330 commit eb74b6c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 54 deletions.
24 changes: 12 additions & 12 deletions desktop/tauri/src-tauri/templates/files.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@

<Fragment>
<Component Id="BinaryFiles" Directory="INSTALLDIR" Guid="850cdd31-424d-45f5-b8f0-95df950ebd0d">
<File Id="BinIndexJson" Source="..\..\..\..\binaries\bin-index.json" />
<File Id="PortmasterCoreExe" Source="..\..\..\..\binaries\portmaster-core.exe" />
<File Id="PortmasterKextSys" Source="..\..\..\..\binaries\portmaster-kext.sys" />
<File Id="PortmasterZip" Source="..\..\..\..\binaries\portmaster.zip" />
<File Id="AssetsZip" Source="..\..\..\..\binaries\assets.zip" />
<File Id="BinIndexJson" Source="..\..\..\..\binary\bin-index.json" />
<File Id="PortmasterCoreExe" Source="..\..\..\..\binary\portmaster-core.exe" />
<File Id="PortmasterKextSys" Source="..\..\..\..\binary\portmaster-kext.sys" />
<File Id="PortmasterZip" Source="..\..\..\..\binary\portmaster.zip" />
<File Id="AssetsZip" Source="..\..\..\..\binary\assets.zip" />
</Component>

<Component Id="IntelFiles" Directory="IntelDir" Guid="0bb439f1-2075-45b0-95bf-78ed3dffeb69">
<File Id="IntelIndexJson" Source="..\..\..\..\binaries\intel-index.json" />
<File Id="BaseDsdl" Source="..\..\..\..\binaries\base.dsdl" />
<File Id="Geoipv4Mmdb" Source="..\..\..\..\binaries\geoipv4.mmdb" />
<File Id="Geoipv6Mmdb" Source="..\..\..\..\binaries\geoipv6.mmdb" />
<File Id="IndexDsd" Source="..\..\..\..\binaries\index.dsd" />
<File Id="IntermediateDsdl" Source="..\..\..\..\binaries\intermediate.dsdl" />
<File Id="UrgentDsdl" Source="..\..\..\..\binaries\urgent.dsdl" />
<File Id="IntelIndexJson" Source="..\..\..\..\intel\intel-index.json" />
<File Id="BaseDsdl" Source="..\..\..\..\intel\base.dsdl" />
<File Id="Geoipv4Mmdb" Source="..\..\..\..\intel\geoipv4.mmdb" />
<File Id="Geoipv6Mmdb" Source="..\..\..\..\intel\geoipv6.mmdb" />
<File Id="IndexDsd" Source="..\..\..\..\intel\index.dsd" />
<File Id="IntermediateDsdl" Source="..\..\..\..\intel\intermediate.dsdl" />
<File Id="UrgentDsdl" Source="..\..\..\..\intel\urgent.dsdl" />
</Component>
</Fragment>

Expand Down
36 changes: 16 additions & 20 deletions desktop/tauri/src-tauri/templates/nsis_install_hooks.nsh
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
!macro NSIS_HOOK_PREINSTALL
; Current working directory is <project-dir>\target\release\nsis\x64
; Current working directory is <project-dir>\desktop\tauri\src-tauri\target\release\nsis\x64

SetOutPath "$INSTDIR"

File "..\..\..\..\binaries\bin-index.json"
File "..\..\..\..\binaries\portmaster-core.exe"
File "..\..\..\..\binaries\portmaster-kext.sys"
File "..\..\..\..\binaries\portmaster.zip"
File "..\..\..\..\binaries\assets.zip"
File "..\..\..\..\binary\bin-index.json"
File "..\..\..\..\binary\portmaster-core.exe"
File "..\..\..\..\binary\portmaster-kext.sys"
File "..\..\..\..\binary\portmaster.zip"
File "..\..\..\..\binary\assets.zip"

SetOutPath "$COMMONPROGRAMDATA\Portmaster\intel"

File "..\..\..\..\binaries\intel-index.json"
File "..\..\..\..\binaries\base.dsdl"
File "..\..\..\..\binaries\geoipv4.mmdb"
File "..\..\..\..\binaries\geoipv6.mmdb"
File "..\..\..\..\binaries\index.dsd"
File "..\..\..\..\binaries\intermediate.dsdl"
File "..\..\..\..\binaries\urgent.dsdl"
File "..\..\..\..\intel\intel-index.json"
File "..\..\..\..\intel\base.dsdl"
File "..\..\..\..\intel\geoipv4.mmdb"
File "..\..\..\..\intel\geoipv6.mmdb"
File "..\..\..\..\intel\index.dsd"
File "..\..\..\..\intel\intermediate.dsdl"
File "..\..\..\..\intel\urgent.dsdl"

; restire previous state
SetOutPath "$INSTDIR"

!macroend

!macro NSIS_HOOK_POSTINSTALL
ExecWait 'sc.exe create PortmasterCore binPath= "$INSTDIR\portmaster-core.exe" --data="$COMMONPROGRAMDATA\Portmaster\data"' $0
IntCmp $0 0 +2
MessageBox MB_OK "Failed to create PortmasterCore service."
ExecWait 'sc.exe create PortmasterCore binPath= "$INSTDIR\portmaster-core.exe" --data="$COMMONPROGRAMDATA\Portmaster\data"'
!macroend

!macro NSIS_HOOK_PREUNINSTALL
ExecWait 'sc.exe stop PortmasterCore' $0
; Ignore errors if the service is not running
ExecWait 'sc.exe delete PortmasterCore' $0
; Ignore errors if the service does not exist
ExecWait 'sc.exe stop PortmasterCore'
ExecWait 'sc.exe delete PortmasterCore'
!macroend

22 changes: 0 additions & 22 deletions packaging/windows/generate_windows_installers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,3 @@ Copy-Item -Path ".\target\release\bundle\nsis\*" -Destination $installerDist
# Restore the original directory
Set-Location $originalDirectory


# FIXME: remove
function Show-Tree {
param (
[string]$Path = ".",
[int]$Indent = 0
)

$items = Get-ChildItem -Path $Path

foreach ($item in $items) {
Write-Host (" " * $Indent) -NoNewline
Write-Host "+-- " -NoNewline
Write-Host $item.Name

if ($item.PSIsContainer) {
Show-Tree -Path $item.FullName -Indent ($Indent + 4)
}
}
}

Show-Tree 'C:\Program Files (x86)\Windows Kits\10\Include'

0 comments on commit eb74b6c

Please sign in to comment.