All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Modified the Windows installer script to change the command for the farmcontrol URI handler from `deeplink.exe` to `bun.exe` executing `deeplink.js`, improving the handling of deep links. - Updated the build script to output `deeplink.js` instead of `deeplink.exe`, aligning with the new execution method. - Adjusted the PowerShell script to check for the presence of `deeplink.js` instead of `deeplink.exe`, ensuring the correct file is validated during the staging process. - Refined the patching script to remove references to `deeplink.exe`, streamlining the target executables for patching.
100 lines
3.2 KiB
NSIS
100 lines
3.2 KiB
NSIS
!macro quitFarmControl
|
|
DetailPrint "Stopping running Farm Control processes..."
|
|
ExecWait 'taskkill /F /IM launcher.exe /T' $R0
|
|
!macroend
|
|
|
|
!macro uninstallPreviousFarmControl
|
|
ClearErrors
|
|
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Farm Control" "UninstallString"
|
|
StrCmp $R0 "" check_install_dir run_uninstall
|
|
|
|
check_install_dir:
|
|
ReadRegStr $R0 HKLM "Software\Tom Butcher\Farm Control" "InstallDir"
|
|
StrCmp $R0 "" check_default_dir
|
|
StrCpy $R0 "$R0\Uninstall.exe"
|
|
Goto run_uninstall
|
|
|
|
check_default_dir:
|
|
StrCpy $R0 "$PROGRAMFILES64\Farm Control\Uninstall.exe"
|
|
IfFileExists $R0 run_uninstall done_uninstall
|
|
|
|
run_uninstall:
|
|
IfFileExists $R0 0 done_uninstall
|
|
DetailPrint "Removing previous Farm Control installation..."
|
|
!insertmacro quitFarmControl
|
|
ExecWait '$R0 /S' $R1
|
|
DetailPrint "Previous installation removed (exit code: $R1)"
|
|
|
|
done_uninstall:
|
|
!macroend
|
|
|
|
!macro fixShortcutWorkingDir SHORTCUT_PATH WORKING_DIR
|
|
Push $0
|
|
Push $1
|
|
Push $2
|
|
StrCpy $1 "${SHORTCUT_PATH}"
|
|
StrCpy $2 "${WORKING_DIR}"
|
|
InitPluginsDir
|
|
FileOpen $0 "$PLUGINSDIR\fix-shortcut.ps1" w
|
|
FileWrite $0 '$$s = (New-Object -COM WScript.Shell).CreateShortcut("'
|
|
FileWrite $0 $1
|
|
FileWrite $0 '")$\r$\n'
|
|
FileWrite $0 '$$s.WorkingDirectory = "'
|
|
FileWrite $0 $2
|
|
FileWrite $0 '"$\r$\n'
|
|
FileWrite $0 '$$s.Save()$\r$\n'
|
|
FileClose $0
|
|
ExecWait '"$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -File "$PLUGINSDIR\fix-shortcut.ps1"'
|
|
Delete "$PLUGINSDIR\fix-shortcut.ps1"
|
|
Pop $2
|
|
Pop $1
|
|
Pop $0
|
|
!macroend
|
|
|
|
!macro createDesktopShortcut
|
|
SetShellVarContext all
|
|
CreateShortCut "$DESKTOP\Farm Control.lnk" "$INSTDIR\bin\launcher.exe" "" "$INSTDIR\bin\launcher.exe" 0 SW_SHOWNORMAL "" "Farm Control"
|
|
!insertmacro fixShortcutWorkingDir "$DESKTOP\Farm Control.lnk" "$INSTDIR\bin"
|
|
!macroend
|
|
|
|
!macro createStartMenuShortcut
|
|
SetShellVarContext all
|
|
CreateDirectory "$SMPROGRAMS\Farm Control"
|
|
CreateShortCut "$SMPROGRAMS\Farm Control\Farm Control.lnk" "$INSTDIR\bin\launcher.exe" "" "$INSTDIR\bin\launcher.exe" 0 SW_SHOWNORMAL "" "Farm Control"
|
|
!insertmacro fixShortcutWorkingDir "$SMPROGRAMS\Farm Control\Farm Control.lnk" "$INSTDIR\bin"
|
|
!macroend
|
|
|
|
!macro removeDesktopShortcut
|
|
SetShellVarContext all
|
|
Delete "$DESKTOP\Farm Control.lnk"
|
|
!macroend
|
|
|
|
!macro removeStartMenuShortcut
|
|
SetShellVarContext all
|
|
Delete "$SMPROGRAMS\Farm Control\Farm Control.lnk"
|
|
RMDir "$SMPROGRAMS\Farm Control"
|
|
!macroend
|
|
|
|
!include "grant-users-access.nsh"
|
|
|
|
!macro customInstall
|
|
DetailPrint "Register farmcontrol URI Handler"
|
|
DeleteRegKey HKCR "farmcontrol"
|
|
WriteRegStr HKCR "farmcontrol" "" "URL:farmcontrol"
|
|
WriteRegStr HKCR "farmcontrol" "URL Protocol" ""
|
|
WriteRegStr HKCR "farmcontrol\DefaultIcon" "" "$INSTDIR\bin\launcher.exe"
|
|
WriteRegStr HKCR "farmcontrol\shell" "" ""
|
|
WriteRegStr HKCR "farmcontrol\shell\Open" "" ""
|
|
WriteRegStr HKCR "farmcontrol\shell\Open\command" "" '"$INSTDIR\bin\bun.exe" "$INSTDIR\bin\deeplink.js" "%1"'
|
|
|
|
DetailPrint "Creating shortcuts"
|
|
!insertmacro createDesktopShortcut
|
|
!insertmacro createStartMenuShortcut
|
|
!macroend
|
|
|
|
!macro customUnInstall
|
|
!insertmacro removeDesktopShortcut
|
|
!insertmacro removeStartMenuShortcut
|
|
DeleteRegKey HKCR "farmcontrol"
|
|
!macroend
|