SyncThingSetup.nsi 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ;--------------------------------
  2. ;Include Modern UI
  3. !include "MUI2.nsh"
  4. ;--------------------------------
  5. ;General
  6. ;Name and file
  7. !define SOURCEPATH "C:\SourceCode\SyncThing\Binaries"
  8. Name "SyncThing Windows Service Install"
  9. OutFile "SyncThingSetup.exe"
  10. ;Default installation folder
  11. InstallDir "$PROGRAMFILES\SyncThing"
  12. ;Get installation folder from registry if available
  13. InstallDirRegKey HKCU "Software\SyncThing" ""
  14. ;Request application privileges for Windows Vista
  15. RequestExecutionLevel admin
  16. ;--------------------------------
  17. ;Interface Settings
  18. !define MUI_ABORTWARNING
  19. ;--------------------------------
  20. ;Pages
  21. !insertmacro MUI_PAGE_COMPONENTS
  22. !insertmacro MUI_PAGE_DIRECTORY
  23. !insertmacro MUI_PAGE_INSTFILES
  24. !insertmacro MUI_UNPAGE_CONFIRM
  25. !insertmacro MUI_UNPAGE_INSTFILES
  26. ;--------------------------------
  27. ;Languages
  28. !insertmacro MUI_LANGUAGE "English"
  29. ;--------------------------------
  30. ;Installer Sections
  31. Section "SyncThing" SecSyncThing
  32. SectionIn RO
  33. SetOutPath "$INSTDIR"
  34. IfFileExists syncthingservice.exe 0 +2
  35. SimpleSC::StopService "SyncThing" 1 30
  36. File /r "${SOURCEPATH}\syncthing.exe"
  37. File /r "${SOURCEPATH}\syncthing.exe.md5"
  38. File /r "${SOURCEPATH}\AUTHORS.txt"
  39. File /r "${SOURCEPATH}\LICENSE.txt"
  40. File /r "${SOURCEPATH}\README.txt"
  41. File /r "${SOURCEPATH}\FAQ.pdf"
  42. File /r "${SOURCEPATH}\Getting-Started.pdf"
  43. ;Store installation folder
  44. WriteRegStr HKCU "Software\SyncThing" "" $INSTDIR
  45. ;Create uninstaller
  46. WriteUninstaller "$INSTDIR\Uninstall.exe"
  47. SectionEnd
  48. Section "Command Line Interface" SecSyncThingCLI
  49. SetOutPath "$INSTDIR"
  50. File /r "${SOURCEPATH}\syncthing-cli.exe"
  51. SectionEnd
  52. Section "Windows Service" SecSyncThingService
  53. SetOutPath "$INSTDIR"
  54. File /r "${SOURCEPATH}\syncthingservice.exe"
  55. File /r "${SOURCEPATH}\syncthingservice.xml"
  56. ExecWait 'syncthingservice.exe install'
  57. ExecWait 'syncthingservice.exe start'
  58. SectionEnd
  59. ;--------------------------------
  60. ;Descriptions
  61. ;Language strings
  62. LangString DESC_SecSyncThing ${LANG_ENGLISH} "SyncThing"
  63. LangString DESC_SecSyncThingCLI ${LANG_ENGLISH} "Command Line Interface"
  64. LangString DESC_SecSyncThingService ${LANG_ENGLISH} "Windows Service"
  65. ;Assign language strings to sections
  66. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  67. !insertmacro MUI_DESCRIPTION_TEXT ${SecSyncThing} $(DESC_SecSyncThing)
  68. !insertmacro MUI_DESCRIPTION_TEXT ${SecSyncThingCLI} $(DESC_SecSyncThingCLI)
  69. !insertmacro MUI_DESCRIPTION_TEXT ${SecSyncThingService} $(DESC_SecSyncThingService)
  70. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  71. ;--------------------------------
  72. ;Uninstaller Section
  73. Section "Uninstall"
  74. Delete "$INSTDIR\Uninstall.exe"
  75. RMDir "$INSTDIR"
  76. DeleteRegKey /ifempty HKCU "Software\SyncThing"
  77. SectionEnd