[54] | 1 | # $Id: install.nsi 63 2024-09-18 20:20:36Z nishi $
|
---|
| 2 |
|
---|
[63] | 3 | LoadLanguageFile "${NSISDIR}\Contrib\Language files\Japanese.nlf"
|
---|
| 4 | LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
|
---|
| 5 |
|
---|
[54] | 6 | Name "Tewi HTTPd"
|
---|
| 7 | OutFile "install.exe"
|
---|
| 8 | InstallDir "C:\Tewi"
|
---|
| 9 | Icon "tewi.ico"
|
---|
| 10 | LicenseData ../LICENSE
|
---|
[62] | 11 |
|
---|
[63] | 12 | LangString EXEC_ONLY ${LANG_ENGLISH} "Install the executable only"
|
---|
| 13 | LangString EXEC_ONLY ${LANG_JAPANESE} "実行機能のみをインストールする"
|
---|
| 14 | LangString SERV_TOO ${LANG_ENGLISH} "Install the service too (NT-only)"
|
---|
| 15 | LangString SERV_TOO ${LANG_JAPANESE} "サービスもインストールする(NTのみ)"
|
---|
| 16 | LangString WAIT_STOP ${LANG_ENGLISH} "Waiting for 1 second so service can stop"
|
---|
| 17 | LangString WAIT_STOP ${LANG_JAPANESE} "サービスが止まるのを待っています"
|
---|
| 18 |
|
---|
[62] | 19 | !include "LogicLib.nsh"
|
---|
| 20 | !include "Sections.nsh"
|
---|
| 21 |
|
---|
[54] | 22 | Page license
|
---|
[62] | 23 | Page components
|
---|
[54] | 24 | Page instfiles
|
---|
| 25 | UninstPage uninstConfirm
|
---|
| 26 | UninstPage instfiles
|
---|
| 27 | Section
|
---|
| 28 | CreateDirectory "$INSTDIR\etc"
|
---|
| 29 | CreateDirectory "$INSTDIR\www"
|
---|
[60] | 30 | CreateDirectory "$INSTDIR\www\icons"
|
---|
[61] | 31 | CreateDirectory "$INSTDIR\modules"
|
---|
[54] | 32 | CreateDirectory "$INSTDIR\bin"
|
---|
[61] | 33 | SetOutPath "$INSTDIR"
|
---|
| 34 | File /oname=LICENSE.txt "../LICENSE"
|
---|
| 35 | SetOutPath "$INSTDIR\modules"
|
---|
| 36 | File "../Module/*.dll"
|
---|
[54] | 37 | SetOutPath "$INSTDIR\etc"
|
---|
[61] | 38 | SetOverWrite off
|
---|
| 39 | File /oname=tewi.conf "../example-win.conf"
|
---|
[54] | 40 | SetOutPath "$INSTDIR\www"
|
---|
| 41 | File /oname=index.html "../itworks.html"
|
---|
[60] | 42 | SetOutPath "$INSTDIR\www\icons"
|
---|
| 43 | File "../Icons/*.png"
|
---|
[61] | 44 | SetOverWrite on
|
---|
[54] | 45 |
|
---|
| 46 | CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
|
---|
[61] | 47 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\License.lnk" "$INSTDIR\LICENSE.txt" ""
|
---|
[54] | 48 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd.lnk" "$INSTDIR\bin\tewi.exe" ""
|
---|
| 49 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v"
|
---|
| 50 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" ""
|
---|
| 51 |
|
---|
| 52 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd"
|
---|
| 53 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
---|
| 54 |
|
---|
| 55 | WriteUninstaller "$INSTDIR\uninstall.exe"
|
---|
| 56 | SectionEnd
|
---|
| 57 |
|
---|
[63] | 58 | Section "$(EXEC_ONLY)" SEL_EXEC
|
---|
[62] | 59 | SetOutPath "$INSTDIR\bin"
|
---|
| 60 | File "../tewi.exe"
|
---|
| 61 | WriteINIStr $INSTDIR\install.ini uninstall service false
|
---|
| 62 | SectionEnd
|
---|
| 63 |
|
---|
[63] | 64 | Section /o "$(SERV_TOO)" SEL_SERVICE
|
---|
[62] | 65 | WriteINIStr $INSTDIR\install.ini uninstall service true
|
---|
| 66 | FileOpen $9 $INSTDIR\install.bat w
|
---|
| 67 | FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
|
---|
| 68 | FileClose $9
|
---|
| 69 | nsExec::Exec '"$INSTDIR\install.bat"'
|
---|
| 70 | Pop $0
|
---|
[63] | 71 | DetailPrint "$(WAIT_STOP)"
|
---|
[62] | 72 | Sleep 1000
|
---|
| 73 | CreateDirectory "$INSTDIR\logs"
|
---|
| 74 | SetOutPath "$INSTDIR\bin"
|
---|
| 75 | File "../tewi.exe"
|
---|
| 76 | File /oname=tewisrv.exe "../tewi-service.exe"
|
---|
| 77 | FileOpen $9 $INSTDIR\install.bat w
|
---|
| 78 | FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
|
---|
| 79 | FileWrite $9 '"$SYSDIR\sc.exe" create "TewiHTTPd" DisplayName= "Tewi HTTPd" binpath= "$INSTDIR\bin\tewisrv.exe" start= "auto"$\r$\n'
|
---|
| 80 | FileWrite $9 '"$SYSDIR\sc.exe" start "TewiHTTPd"$\r$\n'
|
---|
| 81 | FileClose $9
|
---|
| 82 | nsExec::Exec '"$INSTDIR\install.bat"'
|
---|
| 83 | Pop $0
|
---|
| 84 | Delete $INSTDIR\install.bat
|
---|
| 85 | SectionEnd
|
---|
| 86 |
|
---|
| 87 | Function .onInit
|
---|
| 88 | StrCpy $1 ${SEL_EXEC}
|
---|
| 89 | FunctionEnd
|
---|
| 90 |
|
---|
| 91 | Function .onSelChange
|
---|
| 92 | !insertmacro StartRadioButtons $1
|
---|
| 93 | !insertmacro RadioButton ${SEL_EXEC}
|
---|
| 94 | !insertmacro RadioButton ${SEL_SERVICE}
|
---|
| 95 | !insertmacro EndRadioButtons
|
---|
| 96 | FunctionEnd
|
---|
| 97 |
|
---|
[54] | 98 | Section "Uninstall"
|
---|
[62] | 99 | ReadINIStr $8 $INSTDIR\install.ini uninstall service
|
---|
| 100 | ${If} $8 == "true"
|
---|
| 101 | FileOpen $9 $INSTDIR\uninstall.bat w
|
---|
| 102 | FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
|
---|
| 103 | FileClose $9
|
---|
| 104 | nsExec::Exec '"$INSTDIR\uninstall.bat"'
|
---|
| 105 | Pop $0
|
---|
| 106 | FileOpen $9 $INSTDIR\uninstall.bat w
|
---|
[63] | 107 | DetailPrint "$(WAIT_STOP)"
|
---|
[62] | 108 | Sleep 1000
|
---|
| 109 | FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
|
---|
| 110 | FileClose $9
|
---|
| 111 | nsExec::Exec '"$INSTDIR\uninstall.bat"'
|
---|
| 112 | Pop $0
|
---|
| 113 | Delete $INSTDIR\uninstall.bat
|
---|
| 114 | ${EndIf}
|
---|
| 115 |
|
---|
[54] | 116 | RMDir /r "$INSTDIR"
|
---|
| 117 | RMDir /r "$SMPROGRAMS\Tewi HTTPd"
|
---|
| 118 |
|
---|
| 119 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
|
---|
| 120 | SectionEnd
|
---|