installer.nsi 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. !include "MUI2.nsh"
  2. Name "Netdata"
  3. Outfile "netdata-installer.exe"
  4. InstallDir "$PROGRAMFILES\netdata"
  5. RequestExecutionLevel admin
  6. !define MUI_ABORTWARNING
  7. !define MUI_UNABORTWARNING
  8. !insertmacro MUI_PAGE_WELCOME
  9. !insertmacro MUI_PAGE_DIRECTORY
  10. !insertmacro MUI_PAGE_INSTFILES
  11. !insertmacro MUI_PAGE_FINISH
  12. !insertmacro MUI_UNPAGE_CONFIRM
  13. !insertmacro MUI_UNPAGE_INSTFILES
  14. !insertmacro MUI_UNPAGE_FINISH
  15. !insertmacro MUI_LANGUAGE "English"
  16. Section "Install Netdata"
  17. SetOutPath $INSTDIR
  18. SetCompress off
  19. File /r "C:\msys64\opt\netdata\*.*"
  20. ClearErrors
  21. ExecWait '"$SYSDIR\sc.exe" create Netdata binPath= "$INSTDIR\usr\bin\netdata.exe" start= delayed-auto'
  22. IfErrors 0 +2
  23. DetailPrint "Warning: Failed to create Netdata service."
  24. ClearErrors
  25. ExecWait '"$SYSDIR\sc.exe" description Netdata "Real-time system monitoring service"'
  26. IfErrors 0 +2
  27. DetailPrint "Warning: Failed to add Netdata service description."
  28. ClearErrors
  29. ExecWait '"$SYSDIR\sc.exe" start Netdata'
  30. IfErrors 0 +2
  31. DetailPrint "Warning: Failed to start Netdata service."
  32. WriteUninstaller "$INSTDIR\Uninstall.exe"
  33. SectionEnd
  34. Section "Uninstall"
  35. ClearErrors
  36. ExecWait '"$SYSDIR\sc.exe" stop Netdata'
  37. IfErrors 0 +2
  38. DetailPrint "Warning: Failed to stop Netdata service."
  39. ClearErrors
  40. ExecWait '"$SYSDIR\sc.exe" delete Netdata'
  41. IfErrors 0 +2
  42. DetailPrint "Warning: Failed to delete Netdata service."
  43. RMDir /r "$INSTDIR"
  44. SectionEnd