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