installer.nsi 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. !define VERSION "2.9"
  2. !define MENUDIR "Mongoose web server"
  3. !define SVC "Mongoose ${VERSION}"
  4. OutFile mongoose-${VERSION}.install.exe
  5. Name "Mongoose ${VERSION}"
  6. InstallDir C:\mongoose-${VERSION}
  7. Page components
  8. Page directory
  9. Page instfiles
  10. UninstPage uninstConfirm
  11. UninstPage instfiles
  12. Section "Mongoose files (required)"
  13. SectionIn RO
  14. SetOutPath $INSTDIR
  15. File ..\mongoose.exe
  16. File ..\_mongoose.dll
  17. File ..\_mongoose.lib
  18. File mongoose.conf
  19. File README.txt
  20. File srvany.exe
  21. WriteUninstaller uninstall.exe
  22. SectionEnd
  23. Section "SSL files"
  24. SectionIn RO
  25. File ssl_cert.pem
  26. # Following lines add full path to the certificate file in the mongoose.conf
  27. FileOpen $0 mongoose.conf a
  28. FileRead $0 $1
  29. FileRead $0 $1
  30. FileRead $0 $1
  31. FileRead $0 $1
  32. FileRead $0 $1
  33. FileRead $0 $1
  34. FileWrite $0 "ssl_certificate $INSTDIR\ssl_cert.pem"
  35. FileClose $0
  36. SectionEnd
  37. Section "Run Mongoose as service"
  38. ExecWait 'sc create "${SVC}" binpath= $INSTDIR\srvany.exe start= auto depend= Tcpip'
  39. ExecWait 'sc description "${SVC}" "Web server"'
  40. WriteRegStr HKLM "System\CurrentControlSet\Services\${SVC}\Parameters" "Application" "$INSTDIR\mongoose.exe"
  41. WriteRegStr HKLM "System\CurrentControlSet\Services\${SVC}\Parameters" "AppDirectory" "$INSTDIR"
  42. ExecWait 'sc start "${SVC}"'
  43. SectionEnd
  44. Section "Create menu shortcuts"
  45. CreateDirectory "$SMPROGRAMS\${MENUDIR}"
  46. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Start in console.lnk" "$INSTDIR\mongoose.exe"
  47. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Edit config.lnk" "notepad" "$INSTDIR\mongoose.conf"
  48. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Stop service.lnk" "sc" 'stop "Mongoose ${VERSION}"'
  49. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Start service.lnk" "sc" 'start "Mongoose ${VERSION}"'
  50. CreateShortCut "$SMPROGRAMS\${MENUDIR}\uninstall.lnk" "$INSTDIR\uninstall.exe"
  51. SectionEnd
  52. Section "Uninstall"
  53. ExecWait 'sc stop "${SVC}"'
  54. ExecWait 'sc delete "${SVC}"'
  55. Delete "$INSTDIR\*.*"
  56. Delete "$SMPROGRAMS\${MENUDIR}\*.*"
  57. RMDir "$SMPROGRAMS\${MENUDIR}"
  58. RMDir "$INSTDIR"
  59. SectionEnd