installer.nsi 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. 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. # The -ssl_cert option must go before -ports option.
  29. FileOpen $0 mongoose.conf a
  30. FileRead $0 $1
  31. FileRead $0 $1
  32. FileRead $0 $1
  33. FileRead $0 $1
  34. FileRead $0 $1
  35. FileRead $0 $1
  36. FileWrite $0 "ssl_cert $INSTDIR\ssl_cert.pem"
  37. FileClose $0
  38. SectionEnd
  39. Section "Run Mongoose as service"
  40. ExecWait 'sc create "${SVC}" binpath= $INSTDIR\srvany.exe start= auto depend= Tcpip'
  41. ExecWait 'sc description "${SVC}" "Web server"'
  42. WriteRegStr HKLM "System\CurrentControlSet\Services\${SVC}\Parameters" "Application" "$INSTDIR\mongoose.exe"
  43. WriteRegStr HKLM "System\CurrentControlSet\Services\${SVC}\Parameters" "AppDirectory" "$INSTDIR"
  44. ExecWait 'sc start "${SVC}"'
  45. SectionEnd
  46. Section "Create menu shortcuts"
  47. CreateDirectory "$SMPROGRAMS\${MENUDIR}"
  48. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Start in console.lnk" "$INSTDIR\mongoose.exe"
  49. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Edit config.lnk" "notepad" "$INSTDIR\mongoose.conf"
  50. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Stop service.lnk" "sc" 'stop "Mongoose ${VERSION}"'
  51. CreateShortCut "$SMPROGRAMS\${MENUDIR}\Start service.lnk" "sc" 'start "Mongoose ${VERSION}"'
  52. CreateShortCut "$SMPROGRAMS\${MENUDIR}\uninstall.lnk" "$INSTDIR\uninstall.exe"
  53. SectionEnd
  54. Section "Uninstall"
  55. ExecWait 'sc stop "${SVC}"'
  56. ExecWait 'sc delete "${SVC}"'
  57. Delete "$INSTDIR\*.*"
  58. Delete "$SMPROGRAMS\${MENUDIR}\*.*"
  59. RMDir "$SMPROGRAMS\${MENUDIR}"
  60. RMDir "$INSTDIR"
  61. SectionEnd