installer.nsi 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. !define VERSION "2.9"
  2. !define MENUDIR "Mongoose web server"
  3. !define SVC "Mongoose ${VERSION}"
  4. OutFile c:\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. File ssleay32.dll
  25. File libeay32.dll
  26. File ssl_cert.pem
  27. # Following lines add full path to the certificate file in the mongoose.conf
  28. FileOpen $0 mongoose.conf a
  29. FileRead $0 $1
  30. FileRead $0 $1
  31. FileRead $0 $1
  32. FileRead $0 $1
  33. FileRead $0 $1
  34. FileRead $0 $1
  35. FileWrite $0 "ssl_certificate $INSTDIR\ssl_cert.pem"
  36. FileClose $0
  37. SectionEnd
  38. Section "Run Mongoose as service"
  39. ExecWait 'sc create "${SVC}" binpath= $INSTDIR\srvany.exe start= auto depend= Tcpip'
  40. ExecWait 'sc description "${SVC}" "Web server"'
  41. WriteRegStr HKLM "System\CurrentControlSet\Services\${SVC}\Parameters" "Application" "$INSTDIR\mongoose.exe"
  42. WriteRegStr HKLM "System\CurrentControlSet\Services\${SVC}\Parameters" "AppDirectory" "$INSTDIR"
  43. ExecWait 'sc start "${SVC}"'
  44. SectionEnd
  45. Section "Create menu shortcuts"
  46. CreateDirectory "$SMPROGRAMS\${MENUDIR}"
  47. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Start in console.lnk" "$INSTDIR\mongoose.exe"
  48. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Edit config.lnk" "notepad" "$INSTDIR\mongoose.conf"
  49. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Stop service.lnk" "sc" 'stop "Mongoose ${VERSION}"'
  50. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Start service.lnk" "sc" 'start "Mongoose ${VERSION}"'
  51. CreateShortCut "$SMPROGRAMS\${MENUDIR}\uninstall.lnk" "$INSTDIR\uninstall.exe"
  52. SectionEnd
  53. Section "Uninstall"
  54. ExecWait 'sc stop "${SVC}"'
  55. ExecWait 'sc delete "${SVC}"'
  56. Delete "$INSTDIR\*.*"
  57. Delete "$SMPROGRAMS\${MENUDIR}\*.*"
  58. RMDir "$SMPROGRAMS\${MENUDIR}"
  59. RMDir "$INSTDIR"
  60. SectionEnd