mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Enable support for windows installer in tauri
This commit is contained in:
parent
fbb1fce38c
commit
742da7e9b5
8 changed files with 5237 additions and 287 deletions
547
desktop/tauri/src-tauri/Cargo.lock
generated
547
desktop/tauri/src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
2651
desktop/tauri/src-tauri/gen/schemas/windows-schema.json
Normal file
2651
desktop/tauri/src-tauri/gen/schemas/windows-schema.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -73,13 +73,27 @@
|
||||||
"postRemoveScript": "../../../packaging/linux/postrm"
|
"postRemoveScript": "../../../packaging/linux/postrm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"windows": {
|
||||||
|
"nsis": {
|
||||||
|
"installMode": "perMachine",
|
||||||
|
"template": "templates/installer.nsi"
|
||||||
|
},
|
||||||
|
"wix": {
|
||||||
|
"fragmentPaths": [
|
||||||
|
"templates/service.wxs"
|
||||||
|
],
|
||||||
|
"template": "templates/main.wxs"
|
||||||
|
}
|
||||||
|
},
|
||||||
"externalBin": [
|
"externalBin": [
|
||||||
"binaries/portmaster-start",
|
"binaries/portmaster-start",
|
||||||
"binaries/portmaster-core"
|
"binaries/portmaster-core"
|
||||||
],
|
],
|
||||||
"targets": [
|
"targets": [
|
||||||
"deb",
|
"deb",
|
||||||
"rpm"
|
"rpm",
|
||||||
|
"nsis",
|
||||||
|
"msi"
|
||||||
],
|
],
|
||||||
"icon": [
|
"icon": [
|
||||||
"../assets/icons/pm_dark_512.png",
|
"../assets/icons/pm_dark_512.png",
|
||||||
|
|
804
desktop/tauri/src-tauri/templates/installer.nsi
Normal file
804
desktop/tauri/src-tauri/templates/installer.nsi
Normal file
|
@ -0,0 +1,804 @@
|
||||||
|
Unicode true
|
||||||
|
ManifestDPIAware true
|
||||||
|
; Set the compression algorithm. Default is LZMA.
|
||||||
|
!if "{{compression}}" == ""
|
||||||
|
SetCompressor /SOLID lzma
|
||||||
|
!else
|
||||||
|
SetCompressor /SOLID "{{compression}}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!include MUI2.nsh
|
||||||
|
!include FileFunc.nsh
|
||||||
|
!include x64.nsh
|
||||||
|
!include WordFunc.nsh
|
||||||
|
!include "FileAssociation.nsh"
|
||||||
|
!include "StrFunc.nsh"
|
||||||
|
!include "Win\COM.nsh"
|
||||||
|
!include "Win\Propkey.nsh"
|
||||||
|
${StrCase}
|
||||||
|
${StrLoc}
|
||||||
|
|
||||||
|
!define MANUFACTURER "{{manufacturer}}"
|
||||||
|
!define PRODUCTNAME "{{product_name}}"
|
||||||
|
!define VERSION "{{version}}"
|
||||||
|
!define VERSIONWITHBUILD "{{version_with_build}}"
|
||||||
|
!define SHORTDESCRIPTION "{{short_description}}"
|
||||||
|
!define INSTALLMODE "{{install_mode}}"
|
||||||
|
!define LICENSE "{{license}}"
|
||||||
|
!define INSTALLERICON "{{installer_icon}}"
|
||||||
|
!define SIDEBARIMAGE "{{sidebar_image}}"
|
||||||
|
!define HEADERIMAGE "{{header_image}}"
|
||||||
|
!define MAINBINARYNAME "{{main_binary_name}}"
|
||||||
|
!define MAINBINARYSRCPATH "{{main_binary_path}}"
|
||||||
|
!define BUNDLEID "{{bundle_id}}"
|
||||||
|
!define COPYRIGHT "{{copyright}}"
|
||||||
|
!define OUTFILE "{{out_file}}"
|
||||||
|
!define ARCH "{{arch}}"
|
||||||
|
!define PLUGINSPATH "{{additional_plugins_path}}"
|
||||||
|
!define ALLOWDOWNGRADES "{{allow_downgrades}}"
|
||||||
|
!define DISPLAYLANGUAGESELECTOR "{{display_language_selector}}"
|
||||||
|
!define INSTALLWEBVIEW2MODE "{{install_webview2_mode}}"
|
||||||
|
!define WEBVIEW2INSTALLERARGS "{{webview2_installer_args}}"
|
||||||
|
!define WEBVIEW2BOOTSTRAPPERPATH "{{webview2_bootstrapper_path}}"
|
||||||
|
!define WEBVIEW2INSTALLERPATH "{{webview2_installer_path}}"
|
||||||
|
!define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}"
|
||||||
|
!define MANUPRODUCTKEY "Software\${MANUFACTURER}\${PRODUCTNAME}"
|
||||||
|
!define UNINSTALLERSIGNCOMMAND "{{uninstaller_sign_cmd}}"
|
||||||
|
!define ESTIMATEDSIZE "{{estimated_size}}"
|
||||||
|
|
||||||
|
Name "${PRODUCTNAME}"
|
||||||
|
BrandingText "${COPYRIGHT}"
|
||||||
|
OutFile "${OUTFILE}"
|
||||||
|
|
||||||
|
; We don't actually use this value as default install path,
|
||||||
|
; it's just for nsis to append the product name folder in the directory selector
|
||||||
|
; https://nsis.sourceforge.io/Reference/InstallDir
|
||||||
|
!define PLACEHOLDER_INSTALL_DIR "placeholder\${PRODUCTNAME}"
|
||||||
|
InstallDir "${PLACEHOLDER_INSTALL_DIR}"
|
||||||
|
|
||||||
|
VIProductVersion "${VERSIONWITHBUILD}"
|
||||||
|
VIAddVersionKey "ProductName" "${PRODUCTNAME}"
|
||||||
|
VIAddVersionKey "FileDescription" "${SHORTDESCRIPTION}"
|
||||||
|
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
|
||||||
|
VIAddVersionKey "FileVersion" "${VERSION}"
|
||||||
|
VIAddVersionKey "ProductVersion" "${VERSION}"
|
||||||
|
|
||||||
|
; Plugins path, currently exists for linux only
|
||||||
|
!if "${PLUGINSPATH}" != ""
|
||||||
|
!addplugindir "${PLUGINSPATH}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "${UNINSTALLERSIGNCOMMAND}" != ""
|
||||||
|
!uninstfinalize '${UNINSTALLERSIGNCOMMAND}'
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; Handle install mode, `perUser`, `perMachine` or `both`
|
||||||
|
!if "${INSTALLMODE}" == "perMachine"
|
||||||
|
RequestExecutionLevel highest
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
|
RequestExecutionLevel user
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
!define MULTIUSER_MUI
|
||||||
|
!define MULTIUSER_INSTALLMODE_INSTDIR "${PRODUCTNAME}"
|
||||||
|
!define MULTIUSER_INSTALLMODE_COMMANDLINE
|
||||||
|
!if "${ARCH}" == "x64"
|
||||||
|
!define MULTIUSER_USE_PROGRAMFILES64
|
||||||
|
!else if "${ARCH}" == "arm64"
|
||||||
|
!define MULTIUSER_USE_PROGRAMFILES64
|
||||||
|
!endif
|
||||||
|
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${UNINSTKEY}"
|
||||||
|
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "CurrentUser"
|
||||||
|
!define MULTIUSER_INSTALLMODEPAGE_SHOWUSERNAME
|
||||||
|
!define MULTIUSER_INSTALLMODE_FUNCTION RestorePreviousInstallLocation
|
||||||
|
!define MULTIUSER_EXECUTIONLEVEL Highest
|
||||||
|
!include MultiUser.nsh
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; installer icon
|
||||||
|
!if "${INSTALLERICON}" != ""
|
||||||
|
!define MUI_ICON "${INSTALLERICON}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; installer sidebar image
|
||||||
|
!if "${SIDEBARIMAGE}" != ""
|
||||||
|
!define MUI_WELCOMEFINISHPAGE_BITMAP "${SIDEBARIMAGE}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; installer header image
|
||||||
|
!if "${HEADERIMAGE}" != ""
|
||||||
|
!define MUI_HEADERIMAGE
|
||||||
|
!define MUI_HEADERIMAGE_BITMAP "${HEADERIMAGE}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; Define registry key to store installer language
|
||||||
|
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
|
||||||
|
!define MUI_LANGDLL_REGISTRY_KEY "${MANUPRODUCTKEY}"
|
||||||
|
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
||||||
|
|
||||||
|
; Installer pages, must be ordered as they appear
|
||||||
|
; 1. Welcome Page
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
|
|
||||||
|
; 2. License Page (if defined)
|
||||||
|
!if "${LICENSE}" != ""
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
!insertmacro MUI_PAGE_LICENSE "${LICENSE}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; 3. Install mode (if it is set to `both`)
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
!insertmacro MULTIUSER_PAGE_INSTALLMODE
|
||||||
|
!endif
|
||||||
|
|
||||||
|
|
||||||
|
; 4. Custom page to ask user if he wants to reinstall/uninstall
|
||||||
|
; only if a previous installation was detected
|
||||||
|
Var ReinstallPageCheck
|
||||||
|
Page custom PageReinstall PageLeaveReinstall
|
||||||
|
Function PageReinstall
|
||||||
|
; Uninstall previous WiX installation if exists.
|
||||||
|
;
|
||||||
|
; A WiX installer stores the installation info in registry
|
||||||
|
; using a UUID and so we have to loop through all keys under
|
||||||
|
; `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall`
|
||||||
|
; and check if `DisplayName` and `Publisher` keys match ${PRODUCTNAME} and ${MANUFACTURER}
|
||||||
|
;
|
||||||
|
; This has a potential issue that there maybe another installation that matches
|
||||||
|
; our ${PRODUCTNAME} and ${MANUFACTURER} but wasn't installed by our WiX installer,
|
||||||
|
; however, this should be fine since the user will have to confirm the uninstallation
|
||||||
|
; and they can chose to abort it if doesn't make sense.
|
||||||
|
StrCpy $0 0
|
||||||
|
wix_loop:
|
||||||
|
EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $0
|
||||||
|
StrCmp $1 "" wix_done ; Exit loop if there is no more keys to loop on
|
||||||
|
IntOp $0 $0 + 1
|
||||||
|
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "DisplayName"
|
||||||
|
ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "Publisher"
|
||||||
|
StrCmp "$R0$R1" "${PRODUCTNAME}${MANUFACTURER}" 0 wix_loop
|
||||||
|
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "UninstallString"
|
||||||
|
${StrCase} $R1 $R0 "L"
|
||||||
|
${StrLoc} $R0 $R1 "msiexec" ">"
|
||||||
|
StrCmp $R0 0 0 wix_done
|
||||||
|
StrCpy $R7 "wix"
|
||||||
|
StrCpy $R6 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1"
|
||||||
|
Goto compare_version
|
||||||
|
wix_done:
|
||||||
|
|
||||||
|
; Check if there is an existing installation, if not, abort the reinstall page
|
||||||
|
ReadRegStr $R0 SHCTX "${UNINSTKEY}" ""
|
||||||
|
ReadRegStr $R1 SHCTX "${UNINSTKEY}" "UninstallString"
|
||||||
|
${IfThen} "$R0$R1" == "" ${|} Abort ${|}
|
||||||
|
|
||||||
|
; Compare this installar version with the existing installation
|
||||||
|
; and modify the messages presented to the user accordingly
|
||||||
|
compare_version:
|
||||||
|
StrCpy $R4 "$(older)"
|
||||||
|
${If} $R7 == "wix"
|
||||||
|
ReadRegStr $R0 HKLM "$R6" "DisplayVersion"
|
||||||
|
${Else}
|
||||||
|
ReadRegStr $R0 SHCTX "${UNINSTKEY}" "DisplayVersion"
|
||||||
|
${EndIf}
|
||||||
|
${IfThen} $R0 == "" ${|} StrCpy $R4 "$(unknown)" ${|}
|
||||||
|
|
||||||
|
nsis_tauri_utils::SemverCompare "${VERSION}" $R0
|
||||||
|
Pop $R0
|
||||||
|
; Reinstalling the same version
|
||||||
|
${If} $R0 == 0
|
||||||
|
StrCpy $R1 "$(alreadyInstalledLong)"
|
||||||
|
StrCpy $R2 "$(addOrReinstall)"
|
||||||
|
StrCpy $R3 "$(uninstallApp)"
|
||||||
|
!insertmacro MUI_HEADER_TEXT "$(alreadyInstalled)" "$(chooseMaintenanceOption)"
|
||||||
|
StrCpy $R5 "2"
|
||||||
|
; Upgrading
|
||||||
|
${ElseIf} $R0 == 1
|
||||||
|
StrCpy $R1 "$(olderOrUnknownVersionInstalled)"
|
||||||
|
StrCpy $R2 "$(uninstallBeforeInstalling)"
|
||||||
|
StrCpy $R3 "$(dontUninstall)"
|
||||||
|
!insertmacro MUI_HEADER_TEXT "$(alreadyInstalled)" "$(choowHowToInstall)"
|
||||||
|
StrCpy $R5 "1"
|
||||||
|
; Downgrading
|
||||||
|
${ElseIf} $R0 == -1
|
||||||
|
StrCpy $R1 "$(newerVersionInstalled)"
|
||||||
|
StrCpy $R2 "$(uninstallBeforeInstalling)"
|
||||||
|
!if "${ALLOWDOWNGRADES}" == "true"
|
||||||
|
StrCpy $R3 "$(dontUninstall)"
|
||||||
|
!else
|
||||||
|
StrCpy $R3 "$(dontUninstallDowngrade)"
|
||||||
|
!endif
|
||||||
|
!insertmacro MUI_HEADER_TEXT "$(alreadyInstalled)" "$(choowHowToInstall)"
|
||||||
|
StrCpy $R5 "1"
|
||||||
|
${Else}
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
Call SkipIfPassive
|
||||||
|
|
||||||
|
nsDialogs::Create 1018
|
||||||
|
Pop $R4
|
||||||
|
${IfThen} $(^RTL) == 1 ${|} nsDialogs::SetRTL $(^RTL) ${|}
|
||||||
|
|
||||||
|
${NSD_CreateLabel} 0 0 100% 24u $R1
|
||||||
|
Pop $R1
|
||||||
|
|
||||||
|
${NSD_CreateRadioButton} 30u 50u -30u 8u $R2
|
||||||
|
Pop $R2
|
||||||
|
${NSD_OnClick} $R2 PageReinstallUpdateSelection
|
||||||
|
|
||||||
|
${NSD_CreateRadioButton} 30u 70u -30u 8u $R3
|
||||||
|
Pop $R3
|
||||||
|
; disable this radio button if downgrading and downgrades are disabled
|
||||||
|
!if "${ALLOWDOWNGRADES}" == "false"
|
||||||
|
${IfThen} $R0 == -1 ${|} EnableWindow $R3 0 ${|}
|
||||||
|
!endif
|
||||||
|
${NSD_OnClick} $R3 PageReinstallUpdateSelection
|
||||||
|
|
||||||
|
; Check the first radio button if this the first time
|
||||||
|
; we enter this page or if the second button wasn't
|
||||||
|
; selected the last time we were on this page
|
||||||
|
${If} $ReinstallPageCheck != 2
|
||||||
|
SendMessage $R2 ${BM_SETCHECK} ${BST_CHECKED} 0
|
||||||
|
${Else}
|
||||||
|
SendMessage $R3 ${BM_SETCHECK} ${BST_CHECKED} 0
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
${NSD_SetFocus} $R2
|
||||||
|
nsDialogs::Show
|
||||||
|
FunctionEnd
|
||||||
|
Function PageReinstallUpdateSelection
|
||||||
|
${NSD_GetState} $R2 $R1
|
||||||
|
${If} $R1 == ${BST_CHECKED}
|
||||||
|
StrCpy $ReinstallPageCheck 1
|
||||||
|
${Else}
|
||||||
|
StrCpy $ReinstallPageCheck 2
|
||||||
|
${EndIf}
|
||||||
|
FunctionEnd
|
||||||
|
Function PageLeaveReinstall
|
||||||
|
${NSD_GetState} $R2 $R1
|
||||||
|
|
||||||
|
; $R5 holds whether we are reinstalling the same version or not
|
||||||
|
; $R5 == "1" -> different versions
|
||||||
|
; $R5 == "2" -> same version
|
||||||
|
;
|
||||||
|
; $R1 holds the radio buttons state. its meaning is dependent on the context
|
||||||
|
StrCmp $R5 "1" 0 +2 ; Existing install is not the same version?
|
||||||
|
StrCmp $R1 "1" reinst_uninstall reinst_done ; $R1 == "1", then user chose to uninstall existing version, otherwise skip uninstalling
|
||||||
|
StrCmp $R1 "1" reinst_done ; Same version? skip uninstalling
|
||||||
|
|
||||||
|
reinst_uninstall:
|
||||||
|
HideWindow
|
||||||
|
ClearErrors
|
||||||
|
|
||||||
|
${If} $R7 == "wix"
|
||||||
|
ReadRegStr $R1 HKLM "$R6" "UninstallString"
|
||||||
|
ExecWait '$R1' $0
|
||||||
|
${Else}
|
||||||
|
ReadRegStr $4 SHCTX "${MANUPRODUCTKEY}" ""
|
||||||
|
ReadRegStr $R1 SHCTX "${UNINSTKEY}" "UninstallString"
|
||||||
|
ExecWait '$R1 /P _?=$4' $0
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
BringToFront
|
||||||
|
|
||||||
|
${IfThen} ${Errors} ${|} StrCpy $0 2 ${|} ; ExecWait failed, set fake exit code
|
||||||
|
|
||||||
|
${If} $0 <> 0
|
||||||
|
${OrIf} ${FileExists} "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
${If} $0 = 1 ; User aborted uninstaller?
|
||||||
|
StrCmp $R5 "2" 0 +2 ; Is the existing install the same version?
|
||||||
|
Quit ; ...yes, already installed, we are done
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
MessageBox MB_ICONEXCLAMATION "$(unableToUninstall)"
|
||||||
|
Abort
|
||||||
|
${Else}
|
||||||
|
StrCpy $0 $R1 1
|
||||||
|
${IfThen} $0 == '"' ${|} StrCpy $R1 $R1 -1 1 ${|} ; Strip quotes from UninstallString
|
||||||
|
Delete $R1
|
||||||
|
RMDir $INSTDIR
|
||||||
|
${EndIf}
|
||||||
|
reinst_done:
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
; 5. Choose install directory page
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
|
|
||||||
|
; 6. Start menu shortcut page
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
Var AppStartMenuFolder
|
||||||
|
!insertmacro MUI_PAGE_STARTMENU Application $AppStartMenuFolder
|
||||||
|
|
||||||
|
; 7. Installation page
|
||||||
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
|
|
||||||
|
; 8. Finish page
|
||||||
|
;
|
||||||
|
; Don't auto jump to finish page after installation page,
|
||||||
|
; because the installation page has useful info that can be used debug any issues with the installer.
|
||||||
|
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||||
|
; Use show readme button in the finish page as a button create a desktop shortcut
|
||||||
|
!define MUI_FINISHPAGE_SHOWREADME
|
||||||
|
!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(createDesktop)"
|
||||||
|
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDesktopShortcut
|
||||||
|
; Show run app after installation.
|
||||||
|
!define MUI_FINISHPAGE_RUN "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
!insertmacro MUI_PAGE_FINISH
|
||||||
|
|
||||||
|
; Uninstaller Pages
|
||||||
|
; 1. Confirm uninstall page
|
||||||
|
Var DeleteAppDataCheckbox
|
||||||
|
Var DeleteAppDataCheckboxState
|
||||||
|
!define /ifndef WS_EX_LAYOUTRTL 0x00400000
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.ConfirmShow
|
||||||
|
Function un.ConfirmShow
|
||||||
|
FindWindow $1 "#32770" "" $HWNDPARENT ; Find inner dialog
|
||||||
|
${If} $(^RTL) == 1
|
||||||
|
System::Call 'USER32::CreateWindowEx(i${__NSD_CheckBox_EXSTYLE}|${WS_EX_LAYOUTRTL},t"${__NSD_CheckBox_CLASS}",t "$(deleteAppData)",i${__NSD_CheckBox_STYLE},i 50,i 100,i 400, i 25,i$1,i0,i0,i0)i.s'
|
||||||
|
${Else}
|
||||||
|
System::Call 'USER32::CreateWindowEx(i${__NSD_CheckBox_EXSTYLE},t"${__NSD_CheckBox_CLASS}",t "$(deleteAppData)",i${__NSD_CheckBox_STYLE},i 0,i 100,i 400, i 25,i$1,i0,i0,i0)i.s'
|
||||||
|
${EndIf}
|
||||||
|
Pop $DeleteAppDataCheckbox
|
||||||
|
SendMessage $HWNDPARENT ${WM_GETFONT} 0 0 $1
|
||||||
|
SendMessage $DeleteAppDataCheckbox ${WM_SETFONT} $1 1
|
||||||
|
FunctionEnd
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.ConfirmLeave
|
||||||
|
Function un.ConfirmLeave
|
||||||
|
SendMessage $DeleteAppDataCheckbox ${BM_GETCHECK} 0 0 $DeleteAppDataCheckboxState
|
||||||
|
FunctionEnd
|
||||||
|
!insertmacro MUI_UNPAGE_CONFIRM
|
||||||
|
|
||||||
|
; 2. Uninstalling Page
|
||||||
|
!insertmacro MUI_UNPAGE_INSTFILES
|
||||||
|
|
||||||
|
;Languages
|
||||||
|
{{#each languages}}
|
||||||
|
!insertmacro MUI_LANGUAGE "{{this}}"
|
||||||
|
{{/each}}
|
||||||
|
!insertmacro MUI_RESERVEFILE_LANGDLL
|
||||||
|
{{#each language_files}}
|
||||||
|
!include "{{this}}"
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
!macro SetContext
|
||||||
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
|
SetShellVarContext current
|
||||||
|
!else if "${INSTALLMODE}" == "perMachine"
|
||||||
|
SetShellVarContext all
|
||||||
|
!endif
|
||||||
|
|
||||||
|
${If} ${RunningX64}
|
||||||
|
!if "${ARCH}" == "x64"
|
||||||
|
SetRegView 64
|
||||||
|
!else if "${ARCH}" == "arm64"
|
||||||
|
SetRegView 64
|
||||||
|
!else
|
||||||
|
SetRegView 32
|
||||||
|
!endif
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Var PassiveMode
|
||||||
|
Function .onInit
|
||||||
|
${GetOptions} $CMDLINE "/P" $PassiveMode
|
||||||
|
IfErrors +2 0
|
||||||
|
StrCpy $PassiveMode 1
|
||||||
|
|
||||||
|
!if "${DISPLAYLANGUAGESELECTOR}" == "true"
|
||||||
|
!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!insertmacro SetContext
|
||||||
|
|
||||||
|
${If} $INSTDIR == "${PLACEHOLDER_INSTALL_DIR}"
|
||||||
|
; Set default install location
|
||||||
|
!if "${INSTALLMODE}" == "perMachine"
|
||||||
|
${If} ${RunningX64}
|
||||||
|
!if "${ARCH}" == "x64"
|
||||||
|
StrCpy $INSTDIR "$PROGRAMFILES64\${PRODUCTNAME}"
|
||||||
|
!else if "${ARCH}" == "arm64"
|
||||||
|
StrCpy $INSTDIR "$PROGRAMFILES64\${PRODUCTNAME}"
|
||||||
|
!else
|
||||||
|
StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCTNAME}"
|
||||||
|
!endif
|
||||||
|
${Else}
|
||||||
|
StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCTNAME}"
|
||||||
|
${EndIf}
|
||||||
|
!else if "${INSTALLMODE}" == "currentUser"
|
||||||
|
StrCpy $INSTDIR "$LOCALAPPDATA\${PRODUCTNAME}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
Call RestorePreviousInstallLocation
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
!insertmacro MULTIUSER_INIT
|
||||||
|
!endif
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
|
Section EarlyChecks
|
||||||
|
; Abort silent installer if downgrades is disabled
|
||||||
|
!if "${ALLOWDOWNGRADES}" == "false"
|
||||||
|
IfSilent 0 silent_downgrades_done
|
||||||
|
; If downgrading
|
||||||
|
${If} $R0 == -1
|
||||||
|
System::Call 'kernel32::AttachConsole(i -1)i.r0'
|
||||||
|
${If} $0 != 0
|
||||||
|
System::Call 'kernel32::GetStdHandle(i -11)i.r0'
|
||||||
|
System::call 'kernel32::SetConsoleTextAttribute(i r0, i 0x0004)' ; set red color
|
||||||
|
FileWrite $0 "$(silentDowngrades)"
|
||||||
|
${EndIf}
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
silent_downgrades_done:
|
||||||
|
!endif
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section WebView2
|
||||||
|
; Check if Webview2 is already installed and skip this section
|
||||||
|
${If} ${RunningX64}
|
||||||
|
ReadRegStr $4 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
||||||
|
${Else}
|
||||||
|
ReadRegStr $4 HKLM "SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
||||||
|
${EndIf}
|
||||||
|
ReadRegStr $5 HKCU "SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
||||||
|
|
||||||
|
StrCmp $4 "" 0 webview2_done
|
||||||
|
StrCmp $5 "" 0 webview2_done
|
||||||
|
|
||||||
|
; Webview2 install modes
|
||||||
|
!if "${INSTALLWEBVIEW2MODE}" == "downloadBootstrapper"
|
||||||
|
Delete "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||||
|
DetailPrint "$(webview2Downloading)"
|
||||||
|
nsis_tauri_utils::download "https://go.microsoft.com/fwlink/p/?LinkId=2124703" "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||||
|
Pop $0
|
||||||
|
${If} $0 == 0
|
||||||
|
DetailPrint "$(webview2DownloadSuccess)"
|
||||||
|
${Else}
|
||||||
|
DetailPrint "$(webview2DownloadError)"
|
||||||
|
Abort "$(webview2AbortError)"
|
||||||
|
${EndIf}
|
||||||
|
StrCpy $6 "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||||
|
Goto install_webview2
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "${INSTALLWEBVIEW2MODE}" == "embedBootstrapper"
|
||||||
|
Delete "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||||
|
File "/oname=$TEMP\MicrosoftEdgeWebview2Setup.exe" "${WEBVIEW2BOOTSTRAPPERPATH}"
|
||||||
|
DetailPrint "$(installingWebview2)"
|
||||||
|
StrCpy $6 "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||||
|
Goto install_webview2
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "${INSTALLWEBVIEW2MODE}" == "offlineInstaller"
|
||||||
|
Delete "$TEMP\MicrosoftEdgeWebView2RuntimeInstaller.exe"
|
||||||
|
File "/oname=$TEMP\MicrosoftEdgeWebView2RuntimeInstaller.exe" "${WEBVIEW2INSTALLERPATH}"
|
||||||
|
DetailPrint "$(installingWebview2)"
|
||||||
|
StrCpy $6 "$TEMP\MicrosoftEdgeWebView2RuntimeInstaller.exe"
|
||||||
|
Goto install_webview2
|
||||||
|
!endif
|
||||||
|
|
||||||
|
Goto webview2_done
|
||||||
|
|
||||||
|
install_webview2:
|
||||||
|
DetailPrint "$(installingWebview2)"
|
||||||
|
; $6 holds the path to the webview2 installer
|
||||||
|
ExecWait "$6 ${WEBVIEW2INSTALLERARGS} /install" $1
|
||||||
|
${If} $1 == 0
|
||||||
|
DetailPrint "$(webview2InstallSuccess)"
|
||||||
|
${Else}
|
||||||
|
DetailPrint "$(webview2InstallError)"
|
||||||
|
Abort "$(webview2AbortError)"
|
||||||
|
${EndIf}
|
||||||
|
webview2_done:
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
!macro CheckIfAppIsRunning
|
||||||
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
|
nsis_tauri_utils::FindProcessCurrentUser "${MAINBINARYNAME}.exe"
|
||||||
|
!else
|
||||||
|
nsis_tauri_utils::FindProcess "${MAINBINARYNAME}.exe"
|
||||||
|
!endif
|
||||||
|
Pop $R0
|
||||||
|
${If} $R0 = 0
|
||||||
|
IfSilent kill 0
|
||||||
|
${IfThen} $PassiveMode != 1 ${|} MessageBox MB_OKCANCEL "$(appRunningOkKill)" IDOK kill IDCANCEL cancel ${|}
|
||||||
|
kill:
|
||||||
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
|
nsis_tauri_utils::KillProcessCurrentUser "${MAINBINARYNAME}.exe"
|
||||||
|
!else
|
||||||
|
nsis_tauri_utils::KillProcess "${MAINBINARYNAME}.exe"
|
||||||
|
!endif
|
||||||
|
Pop $R0
|
||||||
|
Sleep 500
|
||||||
|
${If} $R0 = 0
|
||||||
|
Goto app_check_done
|
||||||
|
${Else}
|
||||||
|
IfSilent silent ui
|
||||||
|
silent:
|
||||||
|
System::Call 'kernel32::AttachConsole(i -1)i.r0'
|
||||||
|
${If} $0 != 0
|
||||||
|
System::Call 'kernel32::GetStdHandle(i -11)i.r0'
|
||||||
|
System::call 'kernel32::SetConsoleTextAttribute(i r0, i 0x0004)' ; set red color
|
||||||
|
FileWrite $0 "$(appRunning)$\n"
|
||||||
|
${EndIf}
|
||||||
|
Abort
|
||||||
|
ui:
|
||||||
|
Abort "$(failedToKillApp)"
|
||||||
|
${EndIf}
|
||||||
|
cancel:
|
||||||
|
Abort "$(appRunning)"
|
||||||
|
${EndIf}
|
||||||
|
app_check_done:
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Section Install
|
||||||
|
SetOutPath $INSTDIR
|
||||||
|
|
||||||
|
!insertmacro CheckIfAppIsRunning
|
||||||
|
|
||||||
|
; Copy main executable
|
||||||
|
File "${MAINBINARYSRCPATH}"
|
||||||
|
|
||||||
|
; Copy resources
|
||||||
|
{{#each resources_dirs}}
|
||||||
|
CreateDirectory "$INSTDIR\\{{this}}"
|
||||||
|
{{/each}}
|
||||||
|
{{#each resources}}
|
||||||
|
File /a "/oname={{this.[1]}}" "{{@key}}"
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Copy external binaries
|
||||||
|
{{#each binaries}}
|
||||||
|
File /a "/oname={{this}}" "{{@key}}"
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Create file associations
|
||||||
|
{{#each file_associations as |association| ~}}
|
||||||
|
{{#each association.ext as |ext| ~}}
|
||||||
|
!insertmacro APP_ASSOCIATE "{{ext}}" "{{or association.name ext}}" "{{association-description association.description ext}}" "$INSTDIR\${MAINBINARYNAME}.exe,0" "Open with ${PRODUCTNAME}" "$INSTDIR\${MAINBINARYNAME}.exe $\"%1$\""
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Register deep links
|
||||||
|
{{#each deep_link_protocol as |protocol| ~}}
|
||||||
|
WriteRegStr SHCTX "Software\Classes\{{protocol}}" "URL Protocol" ""
|
||||||
|
WriteRegStr SHCTX "Software\Classes\{{protocol}}" "" "URL:${BUNDLEID} protocol"
|
||||||
|
WriteRegStr SHCTX "Software\Classes\{{protocol}}\DefaultIcon" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\",0"
|
||||||
|
WriteRegStr SHCTX "Software\Classes\{{protocol}}\shell\open\command" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" $\"%1$\""
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Create uninstaller
|
||||||
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
; Save $INSTDIR in registry for future installations
|
||||||
|
WriteRegStr SHCTX "${MANUPRODUCTKEY}" "" $INSTDIR
|
||||||
|
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
; Save install mode to be selected by default for the next installation such as updating
|
||||||
|
; or when uninstalling
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" $MultiUser.InstallMode 1
|
||||||
|
!endif
|
||||||
|
|
||||||
|
ExecWait '"$INSTDIR\portmaster-start.exe" install core-service --data="$INSTDIR\data"'
|
||||||
|
|
||||||
|
; Registry information for add/remove programs
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "DisplayName" "${PRODUCTNAME}"
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "DisplayIcon" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\""
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "DisplayVersion" "${VERSION}"
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "Publisher" "${MANUFACTURER}"
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "InstallLocation" "$\"$INSTDIR$\""
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||||
|
WriteRegDWORD SHCTX "${UNINSTKEY}" "NoModify" "1"
|
||||||
|
WriteRegDWORD SHCTX "${UNINSTKEY}" "NoRepair" "1"
|
||||||
|
WriteRegDWORD SHCTX "${UNINSTKEY}" "EstimatedSize" "${ESTIMATEDSIZE}"
|
||||||
|
|
||||||
|
; Create start menu shortcut (GUI)
|
||||||
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||||
|
Call CreateStartMenuShortcut
|
||||||
|
!insertmacro MUI_STARTMENU_WRITE_END
|
||||||
|
|
||||||
|
; Create shortcuts for silent and passive installers, which
|
||||||
|
; can be disabled by passing `/NS` flag
|
||||||
|
; GUI installer has buttons for users to control creating them
|
||||||
|
IfSilent check_ns_flag 0
|
||||||
|
${IfThen} $PassiveMode == 1 ${|} Goto check_ns_flag ${|}
|
||||||
|
Goto shortcuts_done
|
||||||
|
check_ns_flag:
|
||||||
|
${GetOptions} $CMDLINE "/NS" $R0
|
||||||
|
IfErrors 0 shortcuts_done
|
||||||
|
Call CreateDesktopShortcut
|
||||||
|
Call CreateStartMenuShortcut
|
||||||
|
shortcuts_done:
|
||||||
|
|
||||||
|
; Auto close this page for passive mode
|
||||||
|
${IfThen} $PassiveMode == 1 ${|} SetAutoClose true ${|}
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Function .onInstSuccess
|
||||||
|
; Check for `/R` flag only in silent and passive installers because
|
||||||
|
; GUI installer has a toggle for the user to (re)start the app
|
||||||
|
IfSilent check_r_flag 0
|
||||||
|
${IfThen} $PassiveMode == 1 ${|} Goto check_r_flag ${|}
|
||||||
|
Goto run_done
|
||||||
|
check_r_flag:
|
||||||
|
${GetOptions} $CMDLINE "/R" $R0
|
||||||
|
IfErrors run_done 0
|
||||||
|
${GetOptions} $CMDLINE "/ARGS" $R0
|
||||||
|
Exec '"$INSTDIR\${MAINBINARYNAME}.exe" $R0'
|
||||||
|
run_done:
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function un.onInit
|
||||||
|
!insertmacro SetContext
|
||||||
|
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
!insertmacro MULTIUSER_UNINIT
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!insertmacro MUI_UNGETLANGUAGE
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
!macro DeleteAppUserModelId
|
||||||
|
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_DestinationList} ${IID_ICustomDestinationList} r1 ""
|
||||||
|
${If} $1 P<> 0
|
||||||
|
${ICustomDestinationList::DeleteList} $1 '("${BUNDLEID}")'
|
||||||
|
${IUnknown::Release} $1 ""
|
||||||
|
${EndIf}
|
||||||
|
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_ApplicationDestinations} ${IID_IApplicationDestinations} r1 ""
|
||||||
|
${If} $1 P<> 0
|
||||||
|
${IApplicationDestinations::SetAppID} $1 '("${BUNDLEID}")i.r0'
|
||||||
|
${If} $0 >= 0
|
||||||
|
${IApplicationDestinations::RemoveAllDestinations} $1 ''
|
||||||
|
${EndIf}
|
||||||
|
${IUnknown::Release} $1 ""
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
; From https://stackoverflow.com/a/42816728/16993372
|
||||||
|
!macro UnpinShortcut shortcut
|
||||||
|
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_StartMenuPin} ${IID_IStartMenuPinnedList} r0 ""
|
||||||
|
${If} $0 P<> 0
|
||||||
|
System::Call 'SHELL32::SHCreateItemFromParsingName(ws, p0, g "${IID_IShellItem}", *p0r1)' "${shortcut}"
|
||||||
|
${If} $1 P<> 0
|
||||||
|
${IStartMenuPinnedList::RemoveFromList} $0 '(r1)'
|
||||||
|
${IUnknown::Release} $1 ""
|
||||||
|
${EndIf}
|
||||||
|
${IUnknown::Release} $0 ""
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Section Uninstall
|
||||||
|
!insertmacro CheckIfAppIsRunning
|
||||||
|
|
||||||
|
ExecWait 'sc.exe stop PortmasterCore'
|
||||||
|
ExecWait 'sc.exe delete PortmasterCore'
|
||||||
|
|
||||||
|
; Delete the app directory and its content from disk
|
||||||
|
; Copy main executable
|
||||||
|
Delete "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
|
||||||
|
; Delete resources
|
||||||
|
{{#each resources}}
|
||||||
|
Delete "$INSTDIR\\{{this.[1]}}"
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Delete external binaries
|
||||||
|
{{#each binaries}}
|
||||||
|
Delete "$INSTDIR\\{{this}}"
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Delete app associations
|
||||||
|
{{#each file_associations as |association| ~}}
|
||||||
|
{{#each association.ext as |ext| ~}}
|
||||||
|
!insertmacro APP_UNASSOCIATE "{{ext}}" "{{or association.name ext}}"
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Delete deep links
|
||||||
|
{{#each deep_link_protocol as |protocol| ~}}
|
||||||
|
ReadRegStr $R7 SHCTX "Software\Classes\{{protocol}}\shell\open\command" ""
|
||||||
|
!if $R7 == "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" $\"%1$\""
|
||||||
|
DeleteRegKey SHCTX "Software\Classes\{{protocol}}"
|
||||||
|
!endif
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
|
||||||
|
; Delete uninstaller
|
||||||
|
Delete "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
{{#each resources_ancestors}}
|
||||||
|
RMDir /REBOOTOK "$INSTDIR\\{{this}}"
|
||||||
|
{{/each}}
|
||||||
|
RMDir "$INSTDIR"
|
||||||
|
|
||||||
|
!insertmacro DeleteAppUserModelId
|
||||||
|
!insertmacro UnpinShortcut "$SMPROGRAMS\$AppStartMenuFolder\${MAINBINARYNAME}.lnk"
|
||||||
|
!insertmacro UnpinShortcut "$DESKTOP\${MAINBINARYNAME}.lnk"
|
||||||
|
|
||||||
|
; Remove start menu shortcut
|
||||||
|
!insertmacro MUI_STARTMENU_GETFOLDER Application $AppStartMenuFolder
|
||||||
|
Delete "$SMPROGRAMS\$AppStartMenuFolder\${MAINBINARYNAME}.lnk"
|
||||||
|
RMDir "$SMPROGRAMS\$AppStartMenuFolder"
|
||||||
|
|
||||||
|
; Remove desktop shortcuts
|
||||||
|
Delete "$DESKTOP\${MAINBINARYNAME}.lnk"
|
||||||
|
|
||||||
|
; Remove registry information for add/remove programs
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
DeleteRegKey SHCTX "${UNINSTKEY}"
|
||||||
|
!else if "${INSTALLMODE}" == "perMachine"
|
||||||
|
DeleteRegKey HKLM "${UNINSTKEY}"
|
||||||
|
!else
|
||||||
|
DeleteRegKey HKCU "${UNINSTKEY}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
DeleteRegValue HKCU "${MANUPRODUCTKEY}" "Installer Language"
|
||||||
|
|
||||||
|
; Delete app data
|
||||||
|
${If} $DeleteAppDataCheckboxState == 1
|
||||||
|
SetShellVarContext current
|
||||||
|
RmDir /r "$APPDATA\${BUNDLEID}"
|
||||||
|
RmDir /r "$LOCALAPPDATA\${BUNDLEID}"
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
${GetOptions} $CMDLINE "/P" $R0
|
||||||
|
IfErrors +2 0
|
||||||
|
SetAutoClose true
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Function RestorePreviousInstallLocation
|
||||||
|
ReadRegStr $4 SHCTX "${MANUPRODUCTKEY}" ""
|
||||||
|
StrCmp $4 "" +2 0
|
||||||
|
StrCpy $INSTDIR $4
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function SkipIfPassive
|
||||||
|
${IfThen} $PassiveMode == 1 ${|} Abort ${|}
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
!macro SetLnkAppUserModelId shortcut
|
||||||
|
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_ShellLink} ${IID_IShellLink} r0 ""
|
||||||
|
${If} $0 P<> 0
|
||||||
|
${IUnknown::QueryInterface} $0 '("${IID_IPersistFile}",.r1)'
|
||||||
|
${If} $1 P<> 0
|
||||||
|
${IPersistFile::Load} $1 '("${shortcut}", ${STGM_READWRITE})'
|
||||||
|
${IUnknown::QueryInterface} $0 '("${IID_IPropertyStore}",.r2)'
|
||||||
|
${If} $2 P<> 0
|
||||||
|
System::Call 'Oleaut32::SysAllocString(w "${BUNDLEID}") i.r3'
|
||||||
|
System::Call '*${SYSSTRUCT_PROPERTYKEY}(${PKEY_AppUserModel_ID})p.r4'
|
||||||
|
System::Call '*${SYSSTRUCT_PROPVARIANT}(${VT_BSTR},,&i4 $3)p.r5'
|
||||||
|
${IPropertyStore::SetValue} $2 '($4,$5)'
|
||||||
|
|
||||||
|
System::Call 'Oleaut32::SysFreeString($3)'
|
||||||
|
System::Free $4
|
||||||
|
System::Free $5
|
||||||
|
${IPropertyStore::Commit} $2 ""
|
||||||
|
${IUnknown::Release} $2 ""
|
||||||
|
${IPersistFile::Save} $1 '("${shortcut}",1)'
|
||||||
|
${EndIf}
|
||||||
|
${IUnknown::Release} $1 ""
|
||||||
|
${EndIf}
|
||||||
|
${IUnknown::Release} $0 ""
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Function CreateDesktopShortcut
|
||||||
|
CreateShortcut "$DESKTOP\${MAINBINARYNAME}.lnk" "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
!insertmacro SetLnkAppUserModelId "$DESKTOP\${MAINBINARYNAME}.lnk"
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function CreateStartMenuShortcut
|
||||||
|
CreateDirectory "$SMPROGRAMS\$AppStartMenuFolder"
|
||||||
|
CreateShortcut "$SMPROGRAMS\$AppStartMenuFolder\${MAINBINARYNAME}.lnk" "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
!insertmacro SetLnkAppUserModelId "$SMPROGRAMS\$AppStartMenuFolder\${MAINBINARYNAME}.lnk"
|
||||||
|
FunctionEnd
|
799
desktop/tauri/src-tauri/templates/installer_original.nsi
Normal file
799
desktop/tauri/src-tauri/templates/installer_original.nsi
Normal file
|
@ -0,0 +1,799 @@
|
||||||
|
Unicode true
|
||||||
|
ManifestDPIAware true
|
||||||
|
; Set the compression algorithm. Default is LZMA.
|
||||||
|
!if "{{compression}}" == ""
|
||||||
|
SetCompressor /SOLID lzma
|
||||||
|
!else
|
||||||
|
SetCompressor /SOLID "{{compression}}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!include MUI2.nsh
|
||||||
|
!include FileFunc.nsh
|
||||||
|
!include x64.nsh
|
||||||
|
!include WordFunc.nsh
|
||||||
|
!include "FileAssociation.nsh"
|
||||||
|
!include "StrFunc.nsh"
|
||||||
|
!include "Win\COM.nsh"
|
||||||
|
!include "Win\Propkey.nsh"
|
||||||
|
${StrCase}
|
||||||
|
${StrLoc}
|
||||||
|
|
||||||
|
!define MANUFACTURER "{{manufacturer}}"
|
||||||
|
!define PRODUCTNAME "{{product_name}}"
|
||||||
|
!define VERSION "{{version}}"
|
||||||
|
!define VERSIONWITHBUILD "{{version_with_build}}"
|
||||||
|
!define SHORTDESCRIPTION "{{short_description}}"
|
||||||
|
!define INSTALLMODE "{{install_mode}}"
|
||||||
|
!define LICENSE "{{license}}"
|
||||||
|
!define INSTALLERICON "{{installer_icon}}"
|
||||||
|
!define SIDEBARIMAGE "{{sidebar_image}}"
|
||||||
|
!define HEADERIMAGE "{{header_image}}"
|
||||||
|
!define MAINBINARYNAME "{{main_binary_name}}"
|
||||||
|
!define MAINBINARYSRCPATH "{{main_binary_path}}"
|
||||||
|
!define BUNDLEID "{{bundle_id}}"
|
||||||
|
!define COPYRIGHT "{{copyright}}"
|
||||||
|
!define OUTFILE "{{out_file}}"
|
||||||
|
!define ARCH "{{arch}}"
|
||||||
|
!define PLUGINSPATH "{{additional_plugins_path}}"
|
||||||
|
!define ALLOWDOWNGRADES "{{allow_downgrades}}"
|
||||||
|
!define DISPLAYLANGUAGESELECTOR "{{display_language_selector}}"
|
||||||
|
!define INSTALLWEBVIEW2MODE "{{install_webview2_mode}}"
|
||||||
|
!define WEBVIEW2INSTALLERARGS "{{webview2_installer_args}}"
|
||||||
|
!define WEBVIEW2BOOTSTRAPPERPATH "{{webview2_bootstrapper_path}}"
|
||||||
|
!define WEBVIEW2INSTALLERPATH "{{webview2_installer_path}}"
|
||||||
|
!define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}"
|
||||||
|
!define MANUPRODUCTKEY "Software\${MANUFACTURER}\${PRODUCTNAME}"
|
||||||
|
!define UNINSTALLERSIGNCOMMAND "{{uninstaller_sign_cmd}}"
|
||||||
|
!define ESTIMATEDSIZE "{{estimated_size}}"
|
||||||
|
|
||||||
|
Name "${PRODUCTNAME}"
|
||||||
|
BrandingText "${COPYRIGHT}"
|
||||||
|
OutFile "${OUTFILE}"
|
||||||
|
|
||||||
|
; We don't actually use this value as default install path,
|
||||||
|
; it's just for nsis to append the product name folder in the directory selector
|
||||||
|
; https://nsis.sourceforge.io/Reference/InstallDir
|
||||||
|
!define PLACEHOLDER_INSTALL_DIR "placeholder\${PRODUCTNAME}"
|
||||||
|
InstallDir "${PLACEHOLDER_INSTALL_DIR}"
|
||||||
|
|
||||||
|
VIProductVersion "${VERSIONWITHBUILD}"
|
||||||
|
VIAddVersionKey "ProductName" "${PRODUCTNAME}"
|
||||||
|
VIAddVersionKey "FileDescription" "${SHORTDESCRIPTION}"
|
||||||
|
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
|
||||||
|
VIAddVersionKey "FileVersion" "${VERSION}"
|
||||||
|
VIAddVersionKey "ProductVersion" "${VERSION}"
|
||||||
|
|
||||||
|
; Plugins path, currently exists for linux only
|
||||||
|
!if "${PLUGINSPATH}" != ""
|
||||||
|
!addplugindir "${PLUGINSPATH}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "${UNINSTALLERSIGNCOMMAND}" != ""
|
||||||
|
!uninstfinalize '${UNINSTALLERSIGNCOMMAND}'
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; Handle install mode, `perUser`, `perMachine` or `both`
|
||||||
|
!if "${INSTALLMODE}" == "perMachine"
|
||||||
|
RequestExecutionLevel highest
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
|
RequestExecutionLevel user
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
!define MULTIUSER_MUI
|
||||||
|
!define MULTIUSER_INSTALLMODE_INSTDIR "${PRODUCTNAME}"
|
||||||
|
!define MULTIUSER_INSTALLMODE_COMMANDLINE
|
||||||
|
!if "${ARCH}" == "x64"
|
||||||
|
!define MULTIUSER_USE_PROGRAMFILES64
|
||||||
|
!else if "${ARCH}" == "arm64"
|
||||||
|
!define MULTIUSER_USE_PROGRAMFILES64
|
||||||
|
!endif
|
||||||
|
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${UNINSTKEY}"
|
||||||
|
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "CurrentUser"
|
||||||
|
!define MULTIUSER_INSTALLMODEPAGE_SHOWUSERNAME
|
||||||
|
!define MULTIUSER_INSTALLMODE_FUNCTION RestorePreviousInstallLocation
|
||||||
|
!define MULTIUSER_EXECUTIONLEVEL Highest
|
||||||
|
!include MultiUser.nsh
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; installer icon
|
||||||
|
!if "${INSTALLERICON}" != ""
|
||||||
|
!define MUI_ICON "${INSTALLERICON}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; installer sidebar image
|
||||||
|
!if "${SIDEBARIMAGE}" != ""
|
||||||
|
!define MUI_WELCOMEFINISHPAGE_BITMAP "${SIDEBARIMAGE}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; installer header image
|
||||||
|
!if "${HEADERIMAGE}" != ""
|
||||||
|
!define MUI_HEADERIMAGE
|
||||||
|
!define MUI_HEADERIMAGE_BITMAP "${HEADERIMAGE}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; Define registry key to store installer language
|
||||||
|
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
|
||||||
|
!define MUI_LANGDLL_REGISTRY_KEY "${MANUPRODUCTKEY}"
|
||||||
|
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
||||||
|
|
||||||
|
; Installer pages, must be ordered as they appear
|
||||||
|
; 1. Welcome Page
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
|
|
||||||
|
; 2. License Page (if defined)
|
||||||
|
!if "${LICENSE}" != ""
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
!insertmacro MUI_PAGE_LICENSE "${LICENSE}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; 3. Install mode (if it is set to `both`)
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
!insertmacro MULTIUSER_PAGE_INSTALLMODE
|
||||||
|
!endif
|
||||||
|
|
||||||
|
|
||||||
|
; 4. Custom page to ask user if he wants to reinstall/uninstall
|
||||||
|
; only if a previous installation was detected
|
||||||
|
Var ReinstallPageCheck
|
||||||
|
Page custom PageReinstall PageLeaveReinstall
|
||||||
|
Function PageReinstall
|
||||||
|
; Uninstall previous WiX installation if exists.
|
||||||
|
;
|
||||||
|
; A WiX installer stores the installation info in registry
|
||||||
|
; using a UUID and so we have to loop through all keys under
|
||||||
|
; `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall`
|
||||||
|
; and check if `DisplayName` and `Publisher` keys match ${PRODUCTNAME} and ${MANUFACTURER}
|
||||||
|
;
|
||||||
|
; This has a potential issue that there maybe another installation that matches
|
||||||
|
; our ${PRODUCTNAME} and ${MANUFACTURER} but wasn't installed by our WiX installer,
|
||||||
|
; however, this should be fine since the user will have to confirm the uninstallation
|
||||||
|
; and they can chose to abort it if doesn't make sense.
|
||||||
|
StrCpy $0 0
|
||||||
|
wix_loop:
|
||||||
|
EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $0
|
||||||
|
StrCmp $1 "" wix_done ; Exit loop if there is no more keys to loop on
|
||||||
|
IntOp $0 $0 + 1
|
||||||
|
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "DisplayName"
|
||||||
|
ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "Publisher"
|
||||||
|
StrCmp "$R0$R1" "${PRODUCTNAME}${MANUFACTURER}" 0 wix_loop
|
||||||
|
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "UninstallString"
|
||||||
|
${StrCase} $R1 $R0 "L"
|
||||||
|
${StrLoc} $R0 $R1 "msiexec" ">"
|
||||||
|
StrCmp $R0 0 0 wix_done
|
||||||
|
StrCpy $R7 "wix"
|
||||||
|
StrCpy $R6 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1"
|
||||||
|
Goto compare_version
|
||||||
|
wix_done:
|
||||||
|
|
||||||
|
; Check if there is an existing installation, if not, abort the reinstall page
|
||||||
|
ReadRegStr $R0 SHCTX "${UNINSTKEY}" ""
|
||||||
|
ReadRegStr $R1 SHCTX "${UNINSTKEY}" "UninstallString"
|
||||||
|
${IfThen} "$R0$R1" == "" ${|} Abort ${|}
|
||||||
|
|
||||||
|
; Compare this installar version with the existing installation
|
||||||
|
; and modify the messages presented to the user accordingly
|
||||||
|
compare_version:
|
||||||
|
StrCpy $R4 "$(older)"
|
||||||
|
${If} $R7 == "wix"
|
||||||
|
ReadRegStr $R0 HKLM "$R6" "DisplayVersion"
|
||||||
|
${Else}
|
||||||
|
ReadRegStr $R0 SHCTX "${UNINSTKEY}" "DisplayVersion"
|
||||||
|
${EndIf}
|
||||||
|
${IfThen} $R0 == "" ${|} StrCpy $R4 "$(unknown)" ${|}
|
||||||
|
|
||||||
|
nsis_tauri_utils::SemverCompare "${VERSION}" $R0
|
||||||
|
Pop $R0
|
||||||
|
; Reinstalling the same version
|
||||||
|
${If} $R0 == 0
|
||||||
|
StrCpy $R1 "$(alreadyInstalledLong)"
|
||||||
|
StrCpy $R2 "$(addOrReinstall)"
|
||||||
|
StrCpy $R3 "$(uninstallApp)"
|
||||||
|
!insertmacro MUI_HEADER_TEXT "$(alreadyInstalled)" "$(chooseMaintenanceOption)"
|
||||||
|
StrCpy $R5 "2"
|
||||||
|
; Upgrading
|
||||||
|
${ElseIf} $R0 == 1
|
||||||
|
StrCpy $R1 "$(olderOrUnknownVersionInstalled)"
|
||||||
|
StrCpy $R2 "$(uninstallBeforeInstalling)"
|
||||||
|
StrCpy $R3 "$(dontUninstall)"
|
||||||
|
!insertmacro MUI_HEADER_TEXT "$(alreadyInstalled)" "$(choowHowToInstall)"
|
||||||
|
StrCpy $R5 "1"
|
||||||
|
; Downgrading
|
||||||
|
${ElseIf} $R0 == -1
|
||||||
|
StrCpy $R1 "$(newerVersionInstalled)"
|
||||||
|
StrCpy $R2 "$(uninstallBeforeInstalling)"
|
||||||
|
!if "${ALLOWDOWNGRADES}" == "true"
|
||||||
|
StrCpy $R3 "$(dontUninstall)"
|
||||||
|
!else
|
||||||
|
StrCpy $R3 "$(dontUninstallDowngrade)"
|
||||||
|
!endif
|
||||||
|
!insertmacro MUI_HEADER_TEXT "$(alreadyInstalled)" "$(choowHowToInstall)"
|
||||||
|
StrCpy $R5 "1"
|
||||||
|
${Else}
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
Call SkipIfPassive
|
||||||
|
|
||||||
|
nsDialogs::Create 1018
|
||||||
|
Pop $R4
|
||||||
|
${IfThen} $(^RTL) == 1 ${|} nsDialogs::SetRTL $(^RTL) ${|}
|
||||||
|
|
||||||
|
${NSD_CreateLabel} 0 0 100% 24u $R1
|
||||||
|
Pop $R1
|
||||||
|
|
||||||
|
${NSD_CreateRadioButton} 30u 50u -30u 8u $R2
|
||||||
|
Pop $R2
|
||||||
|
${NSD_OnClick} $R2 PageReinstallUpdateSelection
|
||||||
|
|
||||||
|
${NSD_CreateRadioButton} 30u 70u -30u 8u $R3
|
||||||
|
Pop $R3
|
||||||
|
; disable this radio button if downgrading and downgrades are disabled
|
||||||
|
!if "${ALLOWDOWNGRADES}" == "false"
|
||||||
|
${IfThen} $R0 == -1 ${|} EnableWindow $R3 0 ${|}
|
||||||
|
!endif
|
||||||
|
${NSD_OnClick} $R3 PageReinstallUpdateSelection
|
||||||
|
|
||||||
|
; Check the first radio button if this the first time
|
||||||
|
; we enter this page or if the second button wasn't
|
||||||
|
; selected the last time we were on this page
|
||||||
|
${If} $ReinstallPageCheck != 2
|
||||||
|
SendMessage $R2 ${BM_SETCHECK} ${BST_CHECKED} 0
|
||||||
|
${Else}
|
||||||
|
SendMessage $R3 ${BM_SETCHECK} ${BST_CHECKED} 0
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
${NSD_SetFocus} $R2
|
||||||
|
nsDialogs::Show
|
||||||
|
FunctionEnd
|
||||||
|
Function PageReinstallUpdateSelection
|
||||||
|
${NSD_GetState} $R2 $R1
|
||||||
|
${If} $R1 == ${BST_CHECKED}
|
||||||
|
StrCpy $ReinstallPageCheck 1
|
||||||
|
${Else}
|
||||||
|
StrCpy $ReinstallPageCheck 2
|
||||||
|
${EndIf}
|
||||||
|
FunctionEnd
|
||||||
|
Function PageLeaveReinstall
|
||||||
|
${NSD_GetState} $R2 $R1
|
||||||
|
|
||||||
|
; $R5 holds whether we are reinstalling the same version or not
|
||||||
|
; $R5 == "1" -> different versions
|
||||||
|
; $R5 == "2" -> same version
|
||||||
|
;
|
||||||
|
; $R1 holds the radio buttons state. its meaning is dependent on the context
|
||||||
|
StrCmp $R5 "1" 0 +2 ; Existing install is not the same version?
|
||||||
|
StrCmp $R1 "1" reinst_uninstall reinst_done ; $R1 == "1", then user chose to uninstall existing version, otherwise skip uninstalling
|
||||||
|
StrCmp $R1 "1" reinst_done ; Same version? skip uninstalling
|
||||||
|
|
||||||
|
reinst_uninstall:
|
||||||
|
HideWindow
|
||||||
|
ClearErrors
|
||||||
|
|
||||||
|
${If} $R7 == "wix"
|
||||||
|
ReadRegStr $R1 HKLM "$R6" "UninstallString"
|
||||||
|
ExecWait '$R1' $0
|
||||||
|
${Else}
|
||||||
|
ReadRegStr $4 SHCTX "${MANUPRODUCTKEY}" ""
|
||||||
|
ReadRegStr $R1 SHCTX "${UNINSTKEY}" "UninstallString"
|
||||||
|
ExecWait '$R1 /P _?=$4' $0
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
BringToFront
|
||||||
|
|
||||||
|
${IfThen} ${Errors} ${|} StrCpy $0 2 ${|} ; ExecWait failed, set fake exit code
|
||||||
|
|
||||||
|
${If} $0 <> 0
|
||||||
|
${OrIf} ${FileExists} "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
${If} $0 = 1 ; User aborted uninstaller?
|
||||||
|
StrCmp $R5 "2" 0 +2 ; Is the existing install the same version?
|
||||||
|
Quit ; ...yes, already installed, we are done
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
MessageBox MB_ICONEXCLAMATION "$(unableToUninstall)"
|
||||||
|
Abort
|
||||||
|
${Else}
|
||||||
|
StrCpy $0 $R1 1
|
||||||
|
${IfThen} $0 == '"' ${|} StrCpy $R1 $R1 -1 1 ${|} ; Strip quotes from UninstallString
|
||||||
|
Delete $R1
|
||||||
|
RMDir $INSTDIR
|
||||||
|
${EndIf}
|
||||||
|
reinst_done:
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
; 5. Choose install directory page
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
|
|
||||||
|
; 6. Start menu shortcut page
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
Var AppStartMenuFolder
|
||||||
|
!insertmacro MUI_PAGE_STARTMENU Application $AppStartMenuFolder
|
||||||
|
|
||||||
|
; 7. Installation page
|
||||||
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
|
|
||||||
|
; 8. Finish page
|
||||||
|
;
|
||||||
|
; Don't auto jump to finish page after installation page,
|
||||||
|
; because the installation page has useful info that can be used debug any issues with the installer.
|
||||||
|
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||||
|
; Use show readme button in the finish page as a button create a desktop shortcut
|
||||||
|
!define MUI_FINISHPAGE_SHOWREADME
|
||||||
|
!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(createDesktop)"
|
||||||
|
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDesktopShortcut
|
||||||
|
; Show run app after installation.
|
||||||
|
!define MUI_FINISHPAGE_RUN "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive
|
||||||
|
!insertmacro MUI_PAGE_FINISH
|
||||||
|
|
||||||
|
; Uninstaller Pages
|
||||||
|
; 1. Confirm uninstall page
|
||||||
|
Var DeleteAppDataCheckbox
|
||||||
|
Var DeleteAppDataCheckboxState
|
||||||
|
!define /ifndef WS_EX_LAYOUTRTL 0x00400000
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.ConfirmShow
|
||||||
|
Function un.ConfirmShow
|
||||||
|
FindWindow $1 "#32770" "" $HWNDPARENT ; Find inner dialog
|
||||||
|
${If} $(^RTL) == 1
|
||||||
|
System::Call 'USER32::CreateWindowEx(i${__NSD_CheckBox_EXSTYLE}|${WS_EX_LAYOUTRTL},t"${__NSD_CheckBox_CLASS}",t "$(deleteAppData)",i${__NSD_CheckBox_STYLE},i 50,i 100,i 400, i 25,i$1,i0,i0,i0)i.s'
|
||||||
|
${Else}
|
||||||
|
System::Call 'USER32::CreateWindowEx(i${__NSD_CheckBox_EXSTYLE},t"${__NSD_CheckBox_CLASS}",t "$(deleteAppData)",i${__NSD_CheckBox_STYLE},i 0,i 100,i 400, i 25,i$1,i0,i0,i0)i.s'
|
||||||
|
${EndIf}
|
||||||
|
Pop $DeleteAppDataCheckbox
|
||||||
|
SendMessage $HWNDPARENT ${WM_GETFONT} 0 0 $1
|
||||||
|
SendMessage $DeleteAppDataCheckbox ${WM_SETFONT} $1 1
|
||||||
|
FunctionEnd
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.ConfirmLeave
|
||||||
|
Function un.ConfirmLeave
|
||||||
|
SendMessage $DeleteAppDataCheckbox ${BM_GETCHECK} 0 0 $DeleteAppDataCheckboxState
|
||||||
|
FunctionEnd
|
||||||
|
!insertmacro MUI_UNPAGE_CONFIRM
|
||||||
|
|
||||||
|
; 2. Uninstalling Page
|
||||||
|
!insertmacro MUI_UNPAGE_INSTFILES
|
||||||
|
|
||||||
|
;Languages
|
||||||
|
{{#each languages}}
|
||||||
|
!insertmacro MUI_LANGUAGE "{{this}}"
|
||||||
|
{{/each}}
|
||||||
|
!insertmacro MUI_RESERVEFILE_LANGDLL
|
||||||
|
{{#each language_files}}
|
||||||
|
!include "{{this}}"
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
!macro SetContext
|
||||||
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
|
SetShellVarContext current
|
||||||
|
!else if "${INSTALLMODE}" == "perMachine"
|
||||||
|
SetShellVarContext all
|
||||||
|
!endif
|
||||||
|
|
||||||
|
${If} ${RunningX64}
|
||||||
|
!if "${ARCH}" == "x64"
|
||||||
|
SetRegView 64
|
||||||
|
!else if "${ARCH}" == "arm64"
|
||||||
|
SetRegView 64
|
||||||
|
!else
|
||||||
|
SetRegView 32
|
||||||
|
!endif
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Var PassiveMode
|
||||||
|
Function .onInit
|
||||||
|
${GetOptions} $CMDLINE "/P" $PassiveMode
|
||||||
|
IfErrors +2 0
|
||||||
|
StrCpy $PassiveMode 1
|
||||||
|
|
||||||
|
!if "${DISPLAYLANGUAGESELECTOR}" == "true"
|
||||||
|
!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!insertmacro SetContext
|
||||||
|
|
||||||
|
${If} $INSTDIR == "${PLACEHOLDER_INSTALL_DIR}"
|
||||||
|
; Set default install location
|
||||||
|
!if "${INSTALLMODE}" == "perMachine"
|
||||||
|
${If} ${RunningX64}
|
||||||
|
!if "${ARCH}" == "x64"
|
||||||
|
StrCpy $INSTDIR "$PROGRAMFILES64\${PRODUCTNAME}"
|
||||||
|
!else if "${ARCH}" == "arm64"
|
||||||
|
StrCpy $INSTDIR "$PROGRAMFILES64\${PRODUCTNAME}"
|
||||||
|
!else
|
||||||
|
StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCTNAME}"
|
||||||
|
!endif
|
||||||
|
${Else}
|
||||||
|
StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCTNAME}"
|
||||||
|
${EndIf}
|
||||||
|
!else if "${INSTALLMODE}" == "currentUser"
|
||||||
|
StrCpy $INSTDIR "$LOCALAPPDATA\${PRODUCTNAME}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
Call RestorePreviousInstallLocation
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
!insertmacro MULTIUSER_INIT
|
||||||
|
!endif
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
|
Section EarlyChecks
|
||||||
|
; Abort silent installer if downgrades is disabled
|
||||||
|
!if "${ALLOWDOWNGRADES}" == "false"
|
||||||
|
IfSilent 0 silent_downgrades_done
|
||||||
|
; If downgrading
|
||||||
|
${If} $R0 == -1
|
||||||
|
System::Call 'kernel32::AttachConsole(i -1)i.r0'
|
||||||
|
${If} $0 != 0
|
||||||
|
System::Call 'kernel32::GetStdHandle(i -11)i.r0'
|
||||||
|
System::call 'kernel32::SetConsoleTextAttribute(i r0, i 0x0004)' ; set red color
|
||||||
|
FileWrite $0 "$(silentDowngrades)"
|
||||||
|
${EndIf}
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
silent_downgrades_done:
|
||||||
|
!endif
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section WebView2
|
||||||
|
; Check if Webview2 is already installed and skip this section
|
||||||
|
${If} ${RunningX64}
|
||||||
|
ReadRegStr $4 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
||||||
|
${Else}
|
||||||
|
ReadRegStr $4 HKLM "SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
||||||
|
${EndIf}
|
||||||
|
ReadRegStr $5 HKCU "SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
||||||
|
|
||||||
|
StrCmp $4 "" 0 webview2_done
|
||||||
|
StrCmp $5 "" 0 webview2_done
|
||||||
|
|
||||||
|
; Webview2 install modes
|
||||||
|
!if "${INSTALLWEBVIEW2MODE}" == "downloadBootstrapper"
|
||||||
|
Delete "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||||
|
DetailPrint "$(webview2Downloading)"
|
||||||
|
NSISdl::download "https://go.microsoft.com/fwlink/p/?LinkId=2124703" "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||||
|
Pop $0
|
||||||
|
${If} $0 == 0
|
||||||
|
DetailPrint "$(webview2DownloadSuccess)"
|
||||||
|
${Else}
|
||||||
|
DetailPrint "$(webview2DownloadError)"
|
||||||
|
Abort "$(webview2AbortError)"
|
||||||
|
${EndIf}
|
||||||
|
StrCpy $6 "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||||
|
Goto install_webview2
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "${INSTALLWEBVIEW2MODE}" == "embedBootstrapper"
|
||||||
|
Delete "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||||
|
File "/oname=$TEMP\MicrosoftEdgeWebview2Setup.exe" "${WEBVIEW2BOOTSTRAPPERPATH}"
|
||||||
|
DetailPrint "$(installingWebview2)"
|
||||||
|
StrCpy $6 "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||||
|
Goto install_webview2
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "${INSTALLWEBVIEW2MODE}" == "offlineInstaller"
|
||||||
|
Delete "$TEMP\MicrosoftEdgeWebView2RuntimeInstaller.exe"
|
||||||
|
File "/oname=$TEMP\MicrosoftEdgeWebView2RuntimeInstaller.exe" "${WEBVIEW2INSTALLERPATH}"
|
||||||
|
DetailPrint "$(installingWebview2)"
|
||||||
|
StrCpy $6 "$TEMP\MicrosoftEdgeWebView2RuntimeInstaller.exe"
|
||||||
|
Goto install_webview2
|
||||||
|
!endif
|
||||||
|
|
||||||
|
Goto webview2_done
|
||||||
|
|
||||||
|
install_webview2:
|
||||||
|
DetailPrint "$(installingWebview2)"
|
||||||
|
; $6 holds the path to the webview2 installer
|
||||||
|
ExecWait "$6 ${WEBVIEW2INSTALLERARGS} /install" $1
|
||||||
|
${If} $1 == 0
|
||||||
|
DetailPrint "$(webview2InstallSuccess)"
|
||||||
|
${Else}
|
||||||
|
DetailPrint "$(webview2InstallError)"
|
||||||
|
Abort "$(webview2AbortError)"
|
||||||
|
${EndIf}
|
||||||
|
webview2_done:
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
!macro CheckIfAppIsRunning
|
||||||
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
|
nsis_tauri_utils::FindProcessCurrentUser "${MAINBINARYNAME}.exe"
|
||||||
|
!else
|
||||||
|
nsis_tauri_utils::FindProcess "${MAINBINARYNAME}.exe"
|
||||||
|
!endif
|
||||||
|
Pop $R0
|
||||||
|
${If} $R0 = 0
|
||||||
|
IfSilent kill 0
|
||||||
|
${IfThen} $PassiveMode != 1 ${|} MessageBox MB_OKCANCEL "$(appRunningOkKill)" IDOK kill IDCANCEL cancel ${|}
|
||||||
|
kill:
|
||||||
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
|
nsis_tauri_utils::KillProcessCurrentUser "${MAINBINARYNAME}.exe"
|
||||||
|
!else
|
||||||
|
nsis_tauri_utils::KillProcess "${MAINBINARYNAME}.exe"
|
||||||
|
!endif
|
||||||
|
Pop $R0
|
||||||
|
Sleep 500
|
||||||
|
${If} $R0 = 0
|
||||||
|
Goto app_check_done
|
||||||
|
${Else}
|
||||||
|
IfSilent silent ui
|
||||||
|
silent:
|
||||||
|
System::Call 'kernel32::AttachConsole(i -1)i.r0'
|
||||||
|
${If} $0 != 0
|
||||||
|
System::Call 'kernel32::GetStdHandle(i -11)i.r0'
|
||||||
|
System::call 'kernel32::SetConsoleTextAttribute(i r0, i 0x0004)' ; set red color
|
||||||
|
FileWrite $0 "$(appRunning)$\n"
|
||||||
|
${EndIf}
|
||||||
|
Abort
|
||||||
|
ui:
|
||||||
|
Abort "$(failedToKillApp)"
|
||||||
|
${EndIf}
|
||||||
|
cancel:
|
||||||
|
Abort "$(appRunning)"
|
||||||
|
${EndIf}
|
||||||
|
app_check_done:
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Section Install
|
||||||
|
SetOutPath $INSTDIR
|
||||||
|
|
||||||
|
!insertmacro CheckIfAppIsRunning
|
||||||
|
|
||||||
|
; Copy main executable
|
||||||
|
File "${MAINBINARYSRCPATH}"
|
||||||
|
|
||||||
|
; Copy resources
|
||||||
|
{{#each resources_dirs}}
|
||||||
|
CreateDirectory "$INSTDIR\\{{this}}"
|
||||||
|
{{/each}}
|
||||||
|
{{#each resources}}
|
||||||
|
File /a "/oname={{this.[1]}}" "{{@key}}"
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Copy external binaries
|
||||||
|
{{#each binaries}}
|
||||||
|
File /a "/oname={{this}}" "{{@key}}"
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Create file associations
|
||||||
|
{{#each file_associations as |association| ~}}
|
||||||
|
{{#each association.ext as |ext| ~}}
|
||||||
|
!insertmacro APP_ASSOCIATE "{{ext}}" "{{or association.name ext}}" "{{association-description association.description ext}}" "$INSTDIR\${MAINBINARYNAME}.exe,0" "Open with ${PRODUCTNAME}" "$INSTDIR\${MAINBINARYNAME}.exe $\"%1$\""
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Register deep links
|
||||||
|
{{#each deep_link_protocol as |protocol| ~}}
|
||||||
|
WriteRegStr SHCTX "Software\Classes\{{protocol}}" "URL Protocol" ""
|
||||||
|
WriteRegStr SHCTX "Software\Classes\{{protocol}}" "" "URL:${BUNDLEID} protocol"
|
||||||
|
WriteRegStr SHCTX "Software\Classes\{{protocol}}\DefaultIcon" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\",0"
|
||||||
|
WriteRegStr SHCTX "Software\Classes\{{protocol}}\shell\open\command" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" $\"%1$\""
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Create uninstaller
|
||||||
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
; Save $INSTDIR in registry for future installations
|
||||||
|
WriteRegStr SHCTX "${MANUPRODUCTKEY}" "" $INSTDIR
|
||||||
|
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
; Save install mode to be selected by default for the next installation such as updating
|
||||||
|
; or when uninstalling
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" $MultiUser.InstallMode 1
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; Registry information for add/remove programs
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "DisplayName" "${PRODUCTNAME}"
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "DisplayIcon" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\""
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "DisplayVersion" "${VERSION}"
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "Publisher" "${MANUFACTURER}"
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "InstallLocation" "$\"$INSTDIR$\""
|
||||||
|
WriteRegStr SHCTX "${UNINSTKEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||||
|
WriteRegDWORD SHCTX "${UNINSTKEY}" "NoModify" "1"
|
||||||
|
WriteRegDWORD SHCTX "${UNINSTKEY}" "NoRepair" "1"
|
||||||
|
WriteRegDWORD SHCTX "${UNINSTKEY}" "EstimatedSize" "${ESTIMATEDSIZE}"
|
||||||
|
|
||||||
|
; Create start menu shortcut (GUI)
|
||||||
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||||
|
Call CreateStartMenuShortcut
|
||||||
|
!insertmacro MUI_STARTMENU_WRITE_END
|
||||||
|
|
||||||
|
; Create shortcuts for silent and passive installers, which
|
||||||
|
; can be disabled by passing `/NS` flag
|
||||||
|
; GUI installer has buttons for users to control creating them
|
||||||
|
IfSilent check_ns_flag 0
|
||||||
|
${IfThen} $PassiveMode == 1 ${|} Goto check_ns_flag ${|}
|
||||||
|
Goto shortcuts_done
|
||||||
|
check_ns_flag:
|
||||||
|
${GetOptions} $CMDLINE "/NS" $R0
|
||||||
|
IfErrors 0 shortcuts_done
|
||||||
|
Call CreateDesktopShortcut
|
||||||
|
Call CreateStartMenuShortcut
|
||||||
|
shortcuts_done:
|
||||||
|
|
||||||
|
; Auto close this page for passive mode
|
||||||
|
${IfThen} $PassiveMode == 1 ${|} SetAutoClose true ${|}
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Function .onInstSuccess
|
||||||
|
; Check for `/R` flag only in silent and passive installers because
|
||||||
|
; GUI installer has a toggle for the user to (re)start the app
|
||||||
|
IfSilent check_r_flag 0
|
||||||
|
${IfThen} $PassiveMode == 1 ${|} Goto check_r_flag ${|}
|
||||||
|
Goto run_done
|
||||||
|
check_r_flag:
|
||||||
|
${GetOptions} $CMDLINE "/R" $R0
|
||||||
|
IfErrors run_done 0
|
||||||
|
${GetOptions} $CMDLINE "/ARGS" $R0
|
||||||
|
Exec '"$INSTDIR\${MAINBINARYNAME}.exe" $R0'
|
||||||
|
run_done:
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function un.onInit
|
||||||
|
!insertmacro SetContext
|
||||||
|
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
!insertmacro MULTIUSER_UNINIT
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!insertmacro MUI_UNGETLANGUAGE
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
!macro DeleteAppUserModelId
|
||||||
|
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_DestinationList} ${IID_ICustomDestinationList} r1 ""
|
||||||
|
${If} $1 P<> 0
|
||||||
|
${ICustomDestinationList::DeleteList} $1 '("${BUNDLEID}")'
|
||||||
|
${IUnknown::Release} $1 ""
|
||||||
|
${EndIf}
|
||||||
|
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_ApplicationDestinations} ${IID_IApplicationDestinations} r1 ""
|
||||||
|
${If} $1 P<> 0
|
||||||
|
${IApplicationDestinations::SetAppID} $1 '("${BUNDLEID}")i.r0'
|
||||||
|
${If} $0 >= 0
|
||||||
|
${IApplicationDestinations::RemoveAllDestinations} $1 ''
|
||||||
|
${EndIf}
|
||||||
|
${IUnknown::Release} $1 ""
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
; From https://stackoverflow.com/a/42816728/16993372
|
||||||
|
!macro UnpinShortcut shortcut
|
||||||
|
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_StartMenuPin} ${IID_IStartMenuPinnedList} r0 ""
|
||||||
|
${If} $0 P<> 0
|
||||||
|
System::Call 'SHELL32::SHCreateItemFromParsingName(ws, p0, g "${IID_IShellItem}", *p0r1)' "${shortcut}"
|
||||||
|
${If} $1 P<> 0
|
||||||
|
${IStartMenuPinnedList::RemoveFromList} $0 '(r1)'
|
||||||
|
${IUnknown::Release} $1 ""
|
||||||
|
${EndIf}
|
||||||
|
${IUnknown::Release} $0 ""
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Section Uninstall
|
||||||
|
!insertmacro CheckIfAppIsRunning
|
||||||
|
|
||||||
|
; Delete the app directory and its content from disk
|
||||||
|
; Copy main executable
|
||||||
|
Delete "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
|
||||||
|
; Delete resources
|
||||||
|
{{#each resources}}
|
||||||
|
Delete "$INSTDIR\\{{this.[1]}}"
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Delete external binaries
|
||||||
|
{{#each binaries}}
|
||||||
|
Delete "$INSTDIR\\{{this}}"
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Delete app associations
|
||||||
|
{{#each file_associations as |association| ~}}
|
||||||
|
{{#each association.ext as |ext| ~}}
|
||||||
|
!insertmacro APP_UNASSOCIATE "{{ext}}" "{{or association.name ext}}"
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
; Delete deep links
|
||||||
|
{{#each deep_link_protocol as |protocol| ~}}
|
||||||
|
ReadRegStr $R7 SHCTX "Software\Classes\{{protocol}}\shell\open\command" ""
|
||||||
|
!if $R7 == "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" $\"%1$\""
|
||||||
|
DeleteRegKey SHCTX "Software\Classes\{{protocol}}"
|
||||||
|
!endif
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
|
||||||
|
; Delete uninstaller
|
||||||
|
Delete "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
{{#each resources_ancestors}}
|
||||||
|
RMDir /REBOOTOK "$INSTDIR\\{{this}}"
|
||||||
|
{{/each}}
|
||||||
|
RMDir "$INSTDIR"
|
||||||
|
|
||||||
|
!insertmacro DeleteAppUserModelId
|
||||||
|
!insertmacro UnpinShortcut "$SMPROGRAMS\$AppStartMenuFolder\${MAINBINARYNAME}.lnk"
|
||||||
|
!insertmacro UnpinShortcut "$DESKTOP\${MAINBINARYNAME}.lnk"
|
||||||
|
|
||||||
|
; Remove start menu shortcut
|
||||||
|
!insertmacro MUI_STARTMENU_GETFOLDER Application $AppStartMenuFolder
|
||||||
|
Delete "$SMPROGRAMS\$AppStartMenuFolder\${MAINBINARYNAME}.lnk"
|
||||||
|
RMDir "$SMPROGRAMS\$AppStartMenuFolder"
|
||||||
|
|
||||||
|
; Remove desktop shortcuts
|
||||||
|
Delete "$DESKTOP\${MAINBINARYNAME}.lnk"
|
||||||
|
|
||||||
|
; Remove registry information for add/remove programs
|
||||||
|
!if "${INSTALLMODE}" == "both"
|
||||||
|
DeleteRegKey SHCTX "${UNINSTKEY}"
|
||||||
|
!else if "${INSTALLMODE}" == "perMachine"
|
||||||
|
DeleteRegKey HKLM "${UNINSTKEY}"
|
||||||
|
!else
|
||||||
|
DeleteRegKey HKCU "${UNINSTKEY}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
DeleteRegValue HKCU "${MANUPRODUCTKEY}" "Installer Language"
|
||||||
|
|
||||||
|
; Delete app data
|
||||||
|
${If} $DeleteAppDataCheckboxState == 1
|
||||||
|
SetShellVarContext current
|
||||||
|
RmDir /r "$APPDATA\${BUNDLEID}"
|
||||||
|
RmDir /r "$LOCALAPPDATA\${BUNDLEID}"
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
${GetOptions} $CMDLINE "/P" $R0
|
||||||
|
IfErrors +2 0
|
||||||
|
SetAutoClose true
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Function RestorePreviousInstallLocation
|
||||||
|
ReadRegStr $4 SHCTX "${MANUPRODUCTKEY}" ""
|
||||||
|
StrCmp $4 "" +2 0
|
||||||
|
StrCpy $INSTDIR $4
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function SkipIfPassive
|
||||||
|
${IfThen} $PassiveMode == 1 ${|} Abort ${|}
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
!macro SetLnkAppUserModelId shortcut
|
||||||
|
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_ShellLink} ${IID_IShellLink} r0 ""
|
||||||
|
${If} $0 P<> 0
|
||||||
|
${IUnknown::QueryInterface} $0 '("${IID_IPersistFile}",.r1)'
|
||||||
|
${If} $1 P<> 0
|
||||||
|
${IPersistFile::Load} $1 '("${shortcut}", ${STGM_READWRITE})'
|
||||||
|
${IUnknown::QueryInterface} $0 '("${IID_IPropertyStore}",.r2)'
|
||||||
|
${If} $2 P<> 0
|
||||||
|
System::Call 'Oleaut32::SysAllocString(w "${BUNDLEID}") i.r3'
|
||||||
|
System::Call '*${SYSSTRUCT_PROPERTYKEY}(${PKEY_AppUserModel_ID})p.r4'
|
||||||
|
System::Call '*${SYSSTRUCT_PROPVARIANT}(${VT_BSTR},,&i4 $3)p.r5'
|
||||||
|
${IPropertyStore::SetValue} $2 '($4,$5)'
|
||||||
|
|
||||||
|
System::Call 'Oleaut32::SysFreeString($3)'
|
||||||
|
System::Free $4
|
||||||
|
System::Free $5
|
||||||
|
${IPropertyStore::Commit} $2 ""
|
||||||
|
${IUnknown::Release} $2 ""
|
||||||
|
${IPersistFile::Save} $1 '("${shortcut}",1)'
|
||||||
|
${EndIf}
|
||||||
|
${IUnknown::Release} $1 ""
|
||||||
|
${EndIf}
|
||||||
|
${IUnknown::Release} $0 ""
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Function CreateDesktopShortcut
|
||||||
|
CreateShortcut "$DESKTOP\${MAINBINARYNAME}.lnk" "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
!insertmacro SetLnkAppUserModelId "$DESKTOP\${MAINBINARYNAME}.lnk"
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function CreateStartMenuShortcut
|
||||||
|
CreateDirectory "$SMPROGRAMS\$AppStartMenuFolder"
|
||||||
|
CreateShortcut "$SMPROGRAMS\$AppStartMenuFolder\${MAINBINARYNAME}.lnk" "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
!insertmacro SetLnkAppUserModelId "$SMPROGRAMS\$AppStartMenuFolder\${MAINBINARYNAME}.lnk"
|
||||||
|
FunctionEnd
|
337
desktop/tauri/src-tauri/templates/main.wxs
Normal file
337
desktop/tauri/src-tauri/templates/main.wxs
Normal file
|
@ -0,0 +1,337 @@
|
||||||
|
<?if $(sys.BUILDARCH)="x86"?>
|
||||||
|
<?define Win64 = "no" ?>
|
||||||
|
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
|
||||||
|
<?elseif $(sys.BUILDARCH)="x64"?>
|
||||||
|
<?define Win64 = "yes" ?>
|
||||||
|
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
|
||||||
|
<?else?>
|
||||||
|
<?error Unsupported value of sys.BUILDARCH=$(sys.BUILDARCH)?>
|
||||||
|
<?endif?>
|
||||||
|
|
||||||
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||||
|
<Product
|
||||||
|
Id="*"
|
||||||
|
Name="{{product_name}}"
|
||||||
|
UpgradeCode="{{upgrade_code}}"
|
||||||
|
Language="!(loc.TauriLanguage)"
|
||||||
|
Manufacturer="{{manufacturer}}"
|
||||||
|
Version="{{version}}">
|
||||||
|
|
||||||
|
<Package Id="*"
|
||||||
|
Keywords="Installer"
|
||||||
|
InstallerVersion="450"
|
||||||
|
Languages="0"
|
||||||
|
Compressed="yes"
|
||||||
|
InstallScope="perMachine"
|
||||||
|
SummaryCodepage="!(loc.TauriCodepage)"/>
|
||||||
|
|
||||||
|
<!-- https://docs.microsoft.com/en-us/windows/win32/msi/reinstallmode -->
|
||||||
|
<!-- reinstall all files; rewrite all registry entries; reinstall all shortcuts -->
|
||||||
|
<Property Id="REINSTALLMODE" Value="amus" />
|
||||||
|
<Property Id="MsiLogging" Value="v" />
|
||||||
|
|
||||||
|
{{#if allow_downgrades}}
|
||||||
|
<MajorUpgrade Schedule="afterInstallInitialize" AllowDowngrades="yes" />
|
||||||
|
{{else}}
|
||||||
|
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" AllowSameVersionUpgrades="yes" />
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
|
||||||
|
<Media Id="1" Cabinet="app.cab" EmbedCab="yes" />
|
||||||
|
|
||||||
|
{{#if banner_path}}
|
||||||
|
<WixVariable Id="WixUIBannerBmp" Value="{{banner_path}}" />
|
||||||
|
{{/if}}
|
||||||
|
{{#if dialog_image_path}}
|
||||||
|
<WixVariable Id="WixUIDialogBmp" Value="{{dialog_image_path}}" />
|
||||||
|
{{/if}}
|
||||||
|
{{#if license}}
|
||||||
|
<WixVariable Id="WixUILicenseRtf" Value="{{license}}" />
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<Icon Id="ProductIcon" SourceFile="{{icon_path}}"/>
|
||||||
|
<Property Id="ARPPRODUCTICON" Value="ProductIcon" />
|
||||||
|
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" /> <!-- Remove repair -->
|
||||||
|
<SetProperty Id="ARPNOMODIFY" Value="1" After="InstallValidate" Sequence="execute"/>
|
||||||
|
|
||||||
|
<!-- initialize with previous InstallDir -->
|
||||||
|
<Property Id="INSTALLDIR">
|
||||||
|
<RegistrySearch Id="PrevInstallDirReg" Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Name="InstallDir" Type="raw"/>
|
||||||
|
</Property>
|
||||||
|
|
||||||
|
<!-- launch app checkbox -->
|
||||||
|
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="!(loc.LaunchApp)" />
|
||||||
|
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>
|
||||||
|
<Property Id="WixShellExecTarget" Value="[!Path]" />
|
||||||
|
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
|
||||||
|
|
||||||
|
<UI>
|
||||||
|
<!-- launch app checkbox -->
|
||||||
|
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
|
||||||
|
|
||||||
|
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
|
||||||
|
|
||||||
|
{{#unless license}}
|
||||||
|
<!-- Skip license dialog -->
|
||||||
|
<Publish Dialog="WelcomeDlg"
|
||||||
|
Control="Next"
|
||||||
|
Event="NewDialog"
|
||||||
|
Value="InstallDirDlg"
|
||||||
|
Order="2">1</Publish>
|
||||||
|
<Publish Dialog="InstallDirDlg"
|
||||||
|
Control="Back"
|
||||||
|
Event="NewDialog"
|
||||||
|
Value="WelcomeDlg"
|
||||||
|
Order="2">1</Publish>
|
||||||
|
{{/unless}}
|
||||||
|
</UI>
|
||||||
|
|
||||||
|
<UIRef Id="WixUI_InstallDir" />
|
||||||
|
|
||||||
|
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||||
|
<Directory Id="DesktopFolder" Name="Desktop">
|
||||||
|
<Component Id="ApplicationShortcutDesktop" Guid="*">
|
||||||
|
<Shortcut Id="ApplicationDesktopShortcut" Name="{{product_name}}" Description="Runs {{product_name}}" Target="[!Path]" WorkingDirectory="INSTALLDIR" />
|
||||||
|
<RemoveFolder Id="DesktopFolder" On="uninstall" />
|
||||||
|
<RegistryValue Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Name="Desktop Shortcut" Type="integer" Value="1" KeyPath="yes" />
|
||||||
|
</Component>
|
||||||
|
</Directory>
|
||||||
|
<Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles">
|
||||||
|
<Directory Id="INSTALLDIR" Name="{{product_name}}"/>
|
||||||
|
</Directory>
|
||||||
|
<Directory Id="ProgramMenuFolder">
|
||||||
|
<Directory Id="ApplicationProgramsFolder" Name="{{product_name}}"/>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<DirectoryRef Id="INSTALLDIR">
|
||||||
|
<Component Id="RegistryEntries" Guid="*">
|
||||||
|
<RegistryKey Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}">
|
||||||
|
<RegistryValue Name="InstallDir" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
|
||||||
|
</RegistryKey>
|
||||||
|
<!-- Change the Root to HKCU for perUser installations -->
|
||||||
|
{{#each deep_link_protocols as |protocol| ~}}
|
||||||
|
<RegistryKey Root="HKLM" Key="Software\Classes\\{{protocol}}">
|
||||||
|
<RegistryValue Type="string" Name="URL Protocol" Value=""/>
|
||||||
|
<RegistryValue Type="string" Value="URL:{{bundle_id}} protocol"/>
|
||||||
|
<RegistryKey Key="DefaultIcon">
|
||||||
|
<RegistryValue Type="string" Value=""[!Path]",0" />
|
||||||
|
</RegistryKey>
|
||||||
|
<RegistryKey Key="shell\open\command">
|
||||||
|
<RegistryValue Type="string" Value=""[!Path]" "%1"" />
|
||||||
|
</RegistryKey>
|
||||||
|
</RegistryKey>
|
||||||
|
{{/each~}}
|
||||||
|
</Component>
|
||||||
|
<Component Id="Path" Guid="{{path_component_guid}}" Win64="$(var.Win64)">
|
||||||
|
<File Id="Path" Source="{{app_exe_source}}" KeyPath="yes" Checksum="yes"/>
|
||||||
|
{{#each file_associations as |association| ~}}
|
||||||
|
{{#each association.ext as |ext| ~}}
|
||||||
|
<ProgId Id="{{../../product_name}}.{{ext}}" Advertise="yes" Description="{{association.description}}">
|
||||||
|
<Extension Id="{{ext}}" Advertise="yes">
|
||||||
|
<Verb Id="open" Command="Open with {{../../product_name}}" Argument=""%1"" />
|
||||||
|
</Extension>
|
||||||
|
</ProgId>
|
||||||
|
{{/each~}}
|
||||||
|
{{/each~}}
|
||||||
|
</Component>
|
||||||
|
{{#each binaries as |bin| ~}}
|
||||||
|
<Component Id="{{ bin.id }}" Guid="{{bin.guid}}" Win64="$(var.Win64)">
|
||||||
|
<File Id="Bin_{{ bin.id }}" Source="{{bin.path}}" KeyPath="yes"/>
|
||||||
|
</Component>
|
||||||
|
{{/each~}}
|
||||||
|
{{#if enable_elevated_update_task}}
|
||||||
|
<Component Id="UpdateTask" Guid="C492327D-9720-4CD5-8DB8-F09082AF44BE" Win64="$(var.Win64)">
|
||||||
|
<File Id="UpdateTask" Source="update.xml" KeyPath="yes" Checksum="yes"/>
|
||||||
|
</Component>
|
||||||
|
<Component Id="UpdateTaskInstaller" Guid="011F25ED-9BE3-50A7-9E9B-3519ED2B9932" Win64="$(var.Win64)">
|
||||||
|
<File Id="UpdateTaskInstaller" Source="install-task.ps1" KeyPath="yes" Checksum="yes"/>
|
||||||
|
</Component>
|
||||||
|
<Component Id="UpdateTaskUninstaller" Guid="D4F6CC3F-32DC-5FD0-95E8-782FFD7BBCE1" Win64="$(var.Win64)">
|
||||||
|
<File Id="UpdateTaskUninstaller" Source="uninstall-task.ps1" KeyPath="yes" Checksum="yes"/>
|
||||||
|
</Component>
|
||||||
|
{{/if}}
|
||||||
|
{{resources}}
|
||||||
|
<Component Id="CMP_UninstallShortcut" Guid="*">
|
||||||
|
|
||||||
|
<Shortcut Id="UninstallShortcut"
|
||||||
|
Name="Uninstall {{product_name}}"
|
||||||
|
Description="Uninstalls {{product_name}}"
|
||||||
|
Target="[System64Folder]msiexec.exe"
|
||||||
|
Arguments="/x [ProductCode]" />
|
||||||
|
|
||||||
|
<RemoveFolder Id="INSTALLDIR"
|
||||||
|
On="uninstall" />
|
||||||
|
|
||||||
|
<RegistryValue Root="HKCU"
|
||||||
|
Key="Software\\{{manufacturer}}\\{{product_name}}"
|
||||||
|
Name="Uninstaller Shortcut"
|
||||||
|
Type="integer"
|
||||||
|
Value="1"
|
||||||
|
KeyPath="yes" />
|
||||||
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
|
<DirectoryRef Id="ApplicationProgramsFolder">
|
||||||
|
<Component Id="ApplicationShortcut" Guid="*">
|
||||||
|
<Shortcut Id="ApplicationStartMenuShortcut"
|
||||||
|
Name="{{product_name}}"
|
||||||
|
Description="Runs {{product_name}}"
|
||||||
|
Target="[!Path]"
|
||||||
|
Icon="ProductIcon"
|
||||||
|
WorkingDirectory="INSTALLDIR">
|
||||||
|
<ShortcutProperty Key="System.AppUserModel.ID" Value="{{bundle_id}}"/>
|
||||||
|
</Shortcut>
|
||||||
|
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
|
||||||
|
<RegistryValue Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Name="Start Menu Shortcut" Type="integer" Value="1" KeyPath="yes"/>
|
||||||
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
|
{{#each merge_modules as |msm| ~}}
|
||||||
|
<DirectoryRef Id="TARGETDIR">
|
||||||
|
<Merge Id="{{ msm.name }}" SourceFile="{{ msm.path }}" DiskId="1" Language="!(loc.TauriLanguage)" />
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
|
<Feature Id="{{ msm.name }}" Title="{{ msm.name }}" AllowAdvertise="no" Display="hidden" Level="1">
|
||||||
|
<MergeRef Id="{{ msm.name }}"/>
|
||||||
|
</Feature>
|
||||||
|
{{/each~}}
|
||||||
|
|
||||||
|
<Feature
|
||||||
|
Id="MainProgram"
|
||||||
|
Title="Application"
|
||||||
|
Description="!(loc.InstallAppFeature)"
|
||||||
|
Level="1"
|
||||||
|
ConfigurableDirectory="INSTALLDIR"
|
||||||
|
AllowAdvertise="no"
|
||||||
|
Display="expand"
|
||||||
|
Absent="disallow">
|
||||||
|
|
||||||
|
<ComponentRef Id="RegistryEntries"/>
|
||||||
|
|
||||||
|
{{#each resource_file_ids as |resource_file_id| ~}}
|
||||||
|
<ComponentRef Id="{{ resource_file_id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
|
||||||
|
{{#if enable_elevated_update_task}}
|
||||||
|
<ComponentRef Id="UpdateTask" />
|
||||||
|
<ComponentRef Id="UpdateTaskInstaller" />
|
||||||
|
<ComponentRef Id="UpdateTaskUninstaller" />
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<Feature Id="ShortcutsFeature"
|
||||||
|
Title="Shortcuts"
|
||||||
|
Level="1">
|
||||||
|
<ComponentRef Id="Path"/>
|
||||||
|
<ComponentRef Id="CMP_UninstallShortcut" />
|
||||||
|
<ComponentRef Id="ApplicationShortcut" />
|
||||||
|
<ComponentRef Id="ApplicationShortcutDesktop" />
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
<Feature
|
||||||
|
Id="Environment"
|
||||||
|
Title="PATH Environment Variable"
|
||||||
|
Description="!(loc.PathEnvVarFeature)"
|
||||||
|
Level="1"
|
||||||
|
Absent="allow">
|
||||||
|
<ComponentRef Id="Path"/>
|
||||||
|
{{#each binaries as |bin| ~}}
|
||||||
|
<ComponentRef Id="{{ bin.id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
</Feature>
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
<Feature Id="External" AllowAdvertise="no" Absent="disallow">
|
||||||
|
{{#each component_group_refs as |id| ~}}
|
||||||
|
<ComponentGroupRef Id="{{ id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
{{#each component_refs as |id| ~}}
|
||||||
|
<ComponentRef Id="{{ id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
{{#each feature_group_refs as |id| ~}}
|
||||||
|
<FeatureGroupRef Id="{{ id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
{{#each feature_refs as |id| ~}}
|
||||||
|
<FeatureRef Id="{{ id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
{{#each merge_refs as |id| ~}}
|
||||||
|
<MergeRef Id="{{ id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
{{#if install_webview}}
|
||||||
|
<!-- WebView2 -->
|
||||||
|
<Property Id="WVRTINSTALLED">
|
||||||
|
<RegistrySearch Id="WVRTInstalledSystem" Root="HKLM" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw" Win64="no" />
|
||||||
|
<RegistrySearch Id="WVRTInstalledUser" Root="HKCU" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw"/>
|
||||||
|
</Property>
|
||||||
|
|
||||||
|
{{#if download_bootstrapper}}
|
||||||
|
<CustomAction Id='DownloadAndInvokeBootstrapper' Directory="INSTALLDIR" Execute="deferred" ExeCommand='powershell.exe -NoProfile -windowstyle hidden try [\{] [\[]Net.ServicePointManager[\]]::SecurityProtocol = [\[]Net.SecurityProtocolType[\]]::Tls12 [\}] catch [\{][\}]; Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" ; Start-Process -FilePath "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" -ArgumentList ({{webview_installer_args}} '/install') -Wait' Return='check'/>
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action='DownloadAndInvokeBootstrapper' Before='InstallFinalize'>
|
||||||
|
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<!-- Embedded webview bootstrapper mode -->
|
||||||
|
{{#if webview2_bootstrapper_path}}
|
||||||
|
<Binary Id="MicrosoftEdgeWebview2Setup.exe" SourceFile="{{webview2_bootstrapper_path}}"/>
|
||||||
|
<CustomAction Id='InvokeBootstrapper' BinaryKey='MicrosoftEdgeWebview2Setup.exe' Execute="deferred" ExeCommand='{{webview_installer_args}} /install' Return='check' />
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action='InvokeBootstrapper' Before='InstallFinalize'>
|
||||||
|
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<!-- Embedded offline installer -->
|
||||||
|
{{#if webview2_installer_path}}
|
||||||
|
<Binary Id="MicrosoftEdgeWebView2RuntimeInstaller.exe" SourceFile="{{webview2_installer_path}}"/>
|
||||||
|
<CustomAction Id='InvokeStandalone' BinaryKey='MicrosoftEdgeWebView2RuntimeInstaller.exe' Execute="deferred" ExeCommand='{{webview_installer_args}} /install' Return='check' />
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action='InvokeStandalone' Before='InstallFinalize'>
|
||||||
|
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if enable_elevated_update_task}}
|
||||||
|
<!-- Install an elevated update task within Windows Task Scheduler -->
|
||||||
|
<CustomAction
|
||||||
|
Id="CreateUpdateTask"
|
||||||
|
Return="check"
|
||||||
|
Directory="INSTALLDIR"
|
||||||
|
Execute="commit"
|
||||||
|
Impersonate="yes"
|
||||||
|
ExeCommand="powershell.exe -WindowStyle hidden .\install-task.ps1" />
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action='CreateUpdateTask' Before='InstallFinalize'>
|
||||||
|
NOT(REMOVE)
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
<!-- Remove elevated update task during uninstall -->
|
||||||
|
<CustomAction
|
||||||
|
Id="DeleteUpdateTask"
|
||||||
|
Return="check"
|
||||||
|
Directory="INSTALLDIR"
|
||||||
|
ExeCommand="powershell.exe -WindowStyle hidden .\uninstall-task.ps1" />
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action="DeleteUpdateTask" Before='InstallFinalize'>
|
||||||
|
(REMOVE = "ALL") AND NOT UPGRADINGPRODUCTCODE
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
{{/if}}
|
||||||
|
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize"/>
|
||||||
|
|
||||||
|
<CustomActionRef Id='InstallPortmasterService' />
|
||||||
|
<CustomActionRef Id='StopPortmasterService' />
|
||||||
|
<CustomActionRef Id='DeletePortmasterService' />
|
||||||
|
</Product>
|
||||||
|
</Wix>
|
333
desktop/tauri/src-tauri/templates/main_original.wxs
Normal file
333
desktop/tauri/src-tauri/templates/main_original.wxs
Normal file
|
@ -0,0 +1,333 @@
|
||||||
|
<?if $(sys.BUILDARCH)="x86"?>
|
||||||
|
<?define Win64 = "no" ?>
|
||||||
|
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
|
||||||
|
<?elseif $(sys.BUILDARCH)="x64"?>
|
||||||
|
<?define Win64 = "yes" ?>
|
||||||
|
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
|
||||||
|
<?else?>
|
||||||
|
<?error Unsupported value of sys.BUILDARCH=$(sys.BUILDARCH)?>
|
||||||
|
<?endif?>
|
||||||
|
|
||||||
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||||
|
<Product
|
||||||
|
Id="*"
|
||||||
|
Name="{{product_name}}"
|
||||||
|
UpgradeCode="{{upgrade_code}}"
|
||||||
|
Language="!(loc.TauriLanguage)"
|
||||||
|
Manufacturer="{{manufacturer}}"
|
||||||
|
Version="{{version}}">
|
||||||
|
|
||||||
|
<Package Id="*"
|
||||||
|
Keywords="Installer"
|
||||||
|
InstallerVersion="450"
|
||||||
|
Languages="0"
|
||||||
|
Compressed="yes"
|
||||||
|
InstallScope="perMachine"
|
||||||
|
SummaryCodepage="!(loc.TauriCodepage)"/>
|
||||||
|
|
||||||
|
<!-- https://docs.microsoft.com/en-us/windows/win32/msi/reinstallmode -->
|
||||||
|
<!-- reinstall all files; rewrite all registry entries; reinstall all shortcuts -->
|
||||||
|
<Property Id="REINSTALLMODE" Value="amus" />
|
||||||
|
|
||||||
|
{{#if allow_downgrades}}
|
||||||
|
<MajorUpgrade Schedule="afterInstallInitialize" AllowDowngrades="yes" />
|
||||||
|
{{else}}
|
||||||
|
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" AllowSameVersionUpgrades="yes" />
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
|
||||||
|
<Media Id="1" Cabinet="app.cab" EmbedCab="yes" />
|
||||||
|
|
||||||
|
{{#if banner_path}}
|
||||||
|
<WixVariable Id="WixUIBannerBmp" Value="{{banner_path}}" />
|
||||||
|
{{/if}}
|
||||||
|
{{#if dialog_image_path}}
|
||||||
|
<WixVariable Id="WixUIDialogBmp" Value="{{dialog_image_path}}" />
|
||||||
|
{{/if}}
|
||||||
|
{{#if license}}
|
||||||
|
<WixVariable Id="WixUILicenseRtf" Value="{{license}}" />
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<Icon Id="ProductIcon" SourceFile="{{icon_path}}"/>
|
||||||
|
<Property Id="ARPPRODUCTICON" Value="ProductIcon" />
|
||||||
|
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" /> <!-- Remove repair -->
|
||||||
|
<SetProperty Id="ARPNOMODIFY" Value="1" After="InstallValidate" Sequence="execute"/>
|
||||||
|
|
||||||
|
<!-- initialize with previous InstallDir -->
|
||||||
|
<Property Id="INSTALLDIR">
|
||||||
|
<RegistrySearch Id="PrevInstallDirReg" Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Name="InstallDir" Type="raw"/>
|
||||||
|
</Property>
|
||||||
|
|
||||||
|
<!-- launch app checkbox -->
|
||||||
|
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="!(loc.LaunchApp)" />
|
||||||
|
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>
|
||||||
|
<Property Id="WixShellExecTarget" Value="[!Path]" />
|
||||||
|
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
|
||||||
|
|
||||||
|
<UI>
|
||||||
|
<!-- launch app checkbox -->
|
||||||
|
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
|
||||||
|
|
||||||
|
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
|
||||||
|
|
||||||
|
{{#unless license}}
|
||||||
|
<!-- Skip license dialog -->
|
||||||
|
<Publish Dialog="WelcomeDlg"
|
||||||
|
Control="Next"
|
||||||
|
Event="NewDialog"
|
||||||
|
Value="InstallDirDlg"
|
||||||
|
Order="2">1</Publish>
|
||||||
|
<Publish Dialog="InstallDirDlg"
|
||||||
|
Control="Back"
|
||||||
|
Event="NewDialog"
|
||||||
|
Value="WelcomeDlg"
|
||||||
|
Order="2">1</Publish>
|
||||||
|
{{/unless}}
|
||||||
|
</UI>
|
||||||
|
|
||||||
|
<UIRef Id="WixUI_InstallDir" />
|
||||||
|
|
||||||
|
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||||
|
<Directory Id="DesktopFolder" Name="Desktop">
|
||||||
|
<Component Id="ApplicationShortcutDesktop" Guid="*">
|
||||||
|
<Shortcut Id="ApplicationDesktopShortcut" Name="{{product_name}}" Description="Runs {{product_name}}" Target="[!Path]" WorkingDirectory="INSTALLDIR" />
|
||||||
|
<RemoveFolder Id="DesktopFolder" On="uninstall" />
|
||||||
|
<RegistryValue Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Name="Desktop Shortcut" Type="integer" Value="1" KeyPath="yes" />
|
||||||
|
</Component>
|
||||||
|
</Directory>
|
||||||
|
<Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles">
|
||||||
|
<Directory Id="INSTALLDIR" Name="{{product_name}}"/>
|
||||||
|
</Directory>
|
||||||
|
<Directory Id="ProgramMenuFolder">
|
||||||
|
<Directory Id="ApplicationProgramsFolder" Name="{{product_name}}"/>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<DirectoryRef Id="INSTALLDIR">
|
||||||
|
<Component Id="RegistryEntries" Guid="*">
|
||||||
|
<RegistryKey Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}">
|
||||||
|
<RegistryValue Name="InstallDir" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
|
||||||
|
</RegistryKey>
|
||||||
|
<!-- Change the Root to HKCU for perUser installations -->
|
||||||
|
{{#each deep_link_protocols as |protocol| ~}}
|
||||||
|
<RegistryKey Root="HKLM" Key="Software\Classes\\{{protocol}}">
|
||||||
|
<RegistryValue Type="string" Name="URL Protocol" Value=""/>
|
||||||
|
<RegistryValue Type="string" Value="URL:{{bundle_id}} protocol"/>
|
||||||
|
<RegistryKey Key="DefaultIcon">
|
||||||
|
<RegistryValue Type="string" Value=""[!Path]",0" />
|
||||||
|
</RegistryKey>
|
||||||
|
<RegistryKey Key="shell\open\command">
|
||||||
|
<RegistryValue Type="string" Value=""[!Path]" "%1"" />
|
||||||
|
</RegistryKey>
|
||||||
|
</RegistryKey>
|
||||||
|
{{/each~}}
|
||||||
|
</Component>
|
||||||
|
<Component Id="Path" Guid="{{path_component_guid}}" Win64="$(var.Win64)">
|
||||||
|
<File Id="Path" Source="{{app_exe_source}}" KeyPath="yes" Checksum="yes"/>
|
||||||
|
{{#each file_associations as |association| ~}}
|
||||||
|
{{#each association.ext as |ext| ~}}
|
||||||
|
<ProgId Id="{{../../product_name}}.{{ext}}" Advertise="yes" Description="{{association.description}}">
|
||||||
|
<Extension Id="{{ext}}" Advertise="yes">
|
||||||
|
<Verb Id="open" Command="Open with {{../../product_name}}" Argument=""%1"" />
|
||||||
|
</Extension>
|
||||||
|
</ProgId>
|
||||||
|
{{/each~}}
|
||||||
|
{{/each~}}
|
||||||
|
</Component>
|
||||||
|
{{#each binaries as |bin| ~}}
|
||||||
|
<Component Id="{{ bin.id }}" Guid="{{bin.guid}}" Win64="$(var.Win64)">
|
||||||
|
<File Id="Bin_{{ bin.id }}" Source="{{bin.path}}" KeyPath="yes"/>
|
||||||
|
</Component>
|
||||||
|
{{/each~}}
|
||||||
|
{{#if enable_elevated_update_task}}
|
||||||
|
<Component Id="UpdateTask" Guid="C492327D-9720-4CD5-8DB8-F09082AF44BE" Win64="$(var.Win64)">
|
||||||
|
<File Id="UpdateTask" Source="update.xml" KeyPath="yes" Checksum="yes"/>
|
||||||
|
</Component>
|
||||||
|
<Component Id="UpdateTaskInstaller" Guid="011F25ED-9BE3-50A7-9E9B-3519ED2B9932" Win64="$(var.Win64)">
|
||||||
|
<File Id="UpdateTaskInstaller" Source="install-task.ps1" KeyPath="yes" Checksum="yes"/>
|
||||||
|
</Component>
|
||||||
|
<Component Id="UpdateTaskUninstaller" Guid="D4F6CC3F-32DC-5FD0-95E8-782FFD7BBCE1" Win64="$(var.Win64)">
|
||||||
|
<File Id="UpdateTaskUninstaller" Source="uninstall-task.ps1" KeyPath="yes" Checksum="yes"/>
|
||||||
|
</Component>
|
||||||
|
{{/if}}
|
||||||
|
{{resources}}
|
||||||
|
<Component Id="CMP_UninstallShortcut" Guid="*">
|
||||||
|
|
||||||
|
<Shortcut Id="UninstallShortcut"
|
||||||
|
Name="Uninstall {{product_name}}"
|
||||||
|
Description="Uninstalls {{product_name}}"
|
||||||
|
Target="[System64Folder]msiexec.exe"
|
||||||
|
Arguments="/x [ProductCode]" />
|
||||||
|
|
||||||
|
<RemoveFolder Id="INSTALLDIR"
|
||||||
|
On="uninstall" />
|
||||||
|
|
||||||
|
<RegistryValue Root="HKCU"
|
||||||
|
Key="Software\\{{manufacturer}}\\{{product_name}}"
|
||||||
|
Name="Uninstaller Shortcut"
|
||||||
|
Type="integer"
|
||||||
|
Value="1"
|
||||||
|
KeyPath="yes" />
|
||||||
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
|
<DirectoryRef Id="ApplicationProgramsFolder">
|
||||||
|
<Component Id="ApplicationShortcut" Guid="*">
|
||||||
|
<Shortcut Id="ApplicationStartMenuShortcut"
|
||||||
|
Name="{{product_name}}"
|
||||||
|
Description="Runs {{product_name}}"
|
||||||
|
Target="[!Path]"
|
||||||
|
Icon="ProductIcon"
|
||||||
|
WorkingDirectory="INSTALLDIR">
|
||||||
|
<ShortcutProperty Key="System.AppUserModel.ID" Value="{{bundle_id}}"/>
|
||||||
|
</Shortcut>
|
||||||
|
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
|
||||||
|
<RegistryValue Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Name="Start Menu Shortcut" Type="integer" Value="1" KeyPath="yes"/>
|
||||||
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
|
{{#each merge_modules as |msm| ~}}
|
||||||
|
<DirectoryRef Id="TARGETDIR">
|
||||||
|
<Merge Id="{{ msm.name }}" SourceFile="{{ msm.path }}" DiskId="1" Language="!(loc.TauriLanguage)" />
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
|
<Feature Id="{{ msm.name }}" Title="{{ msm.name }}" AllowAdvertise="no" Display="hidden" Level="1">
|
||||||
|
<MergeRef Id="{{ msm.name }}"/>
|
||||||
|
</Feature>
|
||||||
|
{{/each~}}
|
||||||
|
|
||||||
|
<Feature
|
||||||
|
Id="MainProgram"
|
||||||
|
Title="Application"
|
||||||
|
Description="!(loc.InstallAppFeature)"
|
||||||
|
Level="1"
|
||||||
|
ConfigurableDirectory="INSTALLDIR"
|
||||||
|
AllowAdvertise="no"
|
||||||
|
Display="expand"
|
||||||
|
Absent="disallow">
|
||||||
|
|
||||||
|
<ComponentRef Id="RegistryEntries"/>
|
||||||
|
|
||||||
|
{{#each resource_file_ids as |resource_file_id| ~}}
|
||||||
|
<ComponentRef Id="{{ resource_file_id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
|
||||||
|
{{#if enable_elevated_update_task}}
|
||||||
|
<ComponentRef Id="UpdateTask" />
|
||||||
|
<ComponentRef Id="UpdateTaskInstaller" />
|
||||||
|
<ComponentRef Id="UpdateTaskUninstaller" />
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<Feature Id="ShortcutsFeature"
|
||||||
|
Title="Shortcuts"
|
||||||
|
Level="1">
|
||||||
|
<ComponentRef Id="Path"/>
|
||||||
|
<ComponentRef Id="CMP_UninstallShortcut" />
|
||||||
|
<ComponentRef Id="ApplicationShortcut" />
|
||||||
|
<ComponentRef Id="ApplicationShortcutDesktop" />
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
<Feature
|
||||||
|
Id="Environment"
|
||||||
|
Title="PATH Environment Variable"
|
||||||
|
Description="!(loc.PathEnvVarFeature)"
|
||||||
|
Level="1"
|
||||||
|
Absent="allow">
|
||||||
|
<ComponentRef Id="Path"/>
|
||||||
|
{{#each binaries as |bin| ~}}
|
||||||
|
<ComponentRef Id="{{ bin.id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
</Feature>
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
<Feature Id="External" AllowAdvertise="no" Absent="disallow">
|
||||||
|
{{#each component_group_refs as |id| ~}}
|
||||||
|
<ComponentGroupRef Id="{{ id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
{{#each component_refs as |id| ~}}
|
||||||
|
<ComponentRef Id="{{ id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
{{#each feature_group_refs as |id| ~}}
|
||||||
|
<FeatureGroupRef Id="{{ id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
{{#each feature_refs as |id| ~}}
|
||||||
|
<FeatureRef Id="{{ id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
{{#each merge_refs as |id| ~}}
|
||||||
|
<MergeRef Id="{{ id }}"/>
|
||||||
|
{{/each~}}
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
{{#if install_webview}}
|
||||||
|
<!-- WebView2 -->
|
||||||
|
<Property Id="WVRTINSTALLED">
|
||||||
|
<RegistrySearch Id="WVRTInstalledSystem" Root="HKLM" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw" Win64="no" />
|
||||||
|
<RegistrySearch Id="WVRTInstalledUser" Root="HKCU" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw"/>
|
||||||
|
</Property>
|
||||||
|
|
||||||
|
{{#if download_bootstrapper}}
|
||||||
|
<CustomAction Id='DownloadAndInvokeBootstrapper' Directory="INSTALLDIR" Execute="deferred" ExeCommand='powershell.exe -NoProfile -windowstyle hidden try [\{] [\[]Net.ServicePointManager[\]]::SecurityProtocol = [\[]Net.SecurityProtocolType[\]]::Tls12 [\}] catch [\{][\}]; Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" ; Start-Process -FilePath "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" -ArgumentList ({{webview_installer_args}} '/install') -Wait' Return='check'/>
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action='DownloadAndInvokeBootstrapper' Before='InstallFinalize'>
|
||||||
|
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<!-- Embedded webview bootstrapper mode -->
|
||||||
|
{{#if webview2_bootstrapper_path}}
|
||||||
|
<Binary Id="MicrosoftEdgeWebview2Setup.exe" SourceFile="{{webview2_bootstrapper_path}}"/>
|
||||||
|
<CustomAction Id='InvokeBootstrapper' BinaryKey='MicrosoftEdgeWebview2Setup.exe' Execute="deferred" ExeCommand='{{webview_installer_args}} /install' Return='check' />
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action='InvokeBootstrapper' Before='InstallFinalize'>
|
||||||
|
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<!-- Embedded offline installer -->
|
||||||
|
{{#if webview2_installer_path}}
|
||||||
|
<Binary Id="MicrosoftEdgeWebView2RuntimeInstaller.exe" SourceFile="{{webview2_installer_path}}"/>
|
||||||
|
<CustomAction Id='InvokeStandalone' BinaryKey='MicrosoftEdgeWebView2RuntimeInstaller.exe' Execute="deferred" ExeCommand='{{webview_installer_args}} /install' Return='check' />
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action='InvokeStandalone' Before='InstallFinalize'>
|
||||||
|
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if enable_elevated_update_task}}
|
||||||
|
<!-- Install an elevated update task within Windows Task Scheduler -->
|
||||||
|
<CustomAction
|
||||||
|
Id="CreateUpdateTask"
|
||||||
|
Return="check"
|
||||||
|
Directory="INSTALLDIR"
|
||||||
|
Execute="commit"
|
||||||
|
Impersonate="yes"
|
||||||
|
ExeCommand="powershell.exe -WindowStyle hidden .\install-task.ps1" />
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action='CreateUpdateTask' Before='InstallFinalize'>
|
||||||
|
NOT(REMOVE)
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
<!-- Remove elevated update task during uninstall -->
|
||||||
|
<CustomAction
|
||||||
|
Id="DeleteUpdateTask"
|
||||||
|
Return="check"
|
||||||
|
Directory="INSTALLDIR"
|
||||||
|
ExeCommand="powershell.exe -WindowStyle hidden .\uninstall-task.ps1" />
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action="DeleteUpdateTask" Before='InstallFinalize'>
|
||||||
|
(REMOVE = "ALL") AND NOT UPGRADINGPRODUCTCODE
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize"/>
|
||||||
|
</Product>
|
||||||
|
</Wix>
|
37
desktop/tauri/src-tauri/templates/service.wxs
Normal file
37
desktop/tauri/src-tauri/templates/service.wxs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||||
|
<Fragment>
|
||||||
|
<CustomAction Id="InstallPortmasterService"
|
||||||
|
Directory="INSTALLDIR"
|
||||||
|
ExeCommand=""[INSTALLDIR]portmaster-start.exe" install core-service --data="[INSTALLDIR]data""
|
||||||
|
Execute="commit"
|
||||||
|
Return="check"
|
||||||
|
Impersonate="no"
|
||||||
|
/>
|
||||||
|
<CustomAction Id="StopPortmasterService"
|
||||||
|
Directory="INSTALLDIR"
|
||||||
|
ExeCommand="sc.exe stop PortmasterCore"
|
||||||
|
Execute="commit"
|
||||||
|
Return="ignore"
|
||||||
|
Impersonate="no"
|
||||||
|
/>
|
||||||
|
<CustomAction Id="DeletePortmasterService"
|
||||||
|
Directory="INSTALLDIR"
|
||||||
|
ExeCommand="sc.exe delete PortmasterCore"
|
||||||
|
Execute="commit"
|
||||||
|
Return="ignore"
|
||||||
|
Impersonate="no"
|
||||||
|
/>
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action="InstallPortmasterService" Before='InstallFinalize'>
|
||||||
|
<![CDATA[NOT Installed]]>
|
||||||
|
</Custom>
|
||||||
|
<Custom Action="StopPortmasterService" Before='InstallFinalize'>
|
||||||
|
REMOVE
|
||||||
|
</Custom>
|
||||||
|
<Custom Action="DeletePortmasterService" Before='InstallFinalize'>
|
||||||
|
REMOVE
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
</Fragment>
|
||||||
|
</Wix>
|
Loading…
Add table
Reference in a new issue