[54] | 1 | # $Id: install.nsi 217 2024-10-02 19:50:16Z 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 |
|
---|
[208] | 25 | !include "x64.nsh"
|
---|
[62] | 26 | !include "LogicLib.nsh"
|
---|
| 27 | !include "Sections.nsh"
|
---|
| 28 |
|
---|
[54] | 29 | Page license
|
---|
[206] | 30 | Page directory
|
---|
[62] | 31 | Page components
|
---|
[54] | 32 | Page instfiles
|
---|
| 33 | UninstPage uninstConfirm
|
---|
| 34 | UninstPage instfiles
|
---|
| 35 | Section
|
---|
| 36 | CreateDirectory "$INSTDIR\etc"
|
---|
| 37 | CreateDirectory "$INSTDIR\www"
|
---|
[60] | 38 | CreateDirectory "$INSTDIR\www\icons"
|
---|
[61] | 39 | CreateDirectory "$INSTDIR\modules"
|
---|
[54] | 40 | CreateDirectory "$INSTDIR\bin"
|
---|
[61] | 41 | SetOutPath "$INSTDIR"
|
---|
[217] | 42 | !cd ..
|
---|
| 43 | File /oname=LICENSE.txt "LICENSE"
|
---|
[61] | 44 | SetOutPath "$INSTDIR\modules"
|
---|
[217] | 45 | !cd Module
|
---|
| 46 | File "*.dll"
|
---|
| 47 | !cd ..
|
---|
[54] | 48 | SetOutPath "$INSTDIR\etc"
|
---|
[61] | 49 | SetOverWrite off
|
---|
[217] | 50 | File /oname=tewi.conf "generated.conf"
|
---|
[54] | 51 | SetOutPath "$INSTDIR\www"
|
---|
[217] | 52 | File /oname=index.html "itworks.html"
|
---|
| 53 | !cd Binary
|
---|
| 54 | File /oname=pbtewi.gif "pbtewi.gif"
|
---|
| 55 | !cd ..
|
---|
[60] | 56 | SetOutPath "$INSTDIR\www\icons"
|
---|
[217] | 57 | !cd Icons
|
---|
| 58 | File "*.png"
|
---|
| 59 | !cd ..
|
---|
| 60 | !cd Server
|
---|
[61] | 61 | SetOverWrite on
|
---|
[54] | 62 |
|
---|
| 63 | CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
|
---|
[61] | 64 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\License.lnk" "$INSTDIR\LICENSE.txt" ""
|
---|
[54] | 65 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd.lnk" "$INSTDIR\bin\tewi.exe" ""
|
---|
| 66 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v"
|
---|
| 67 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" ""
|
---|
| 68 |
|
---|
[208] | 69 | ${If} ${RunningX64}
|
---|
| 70 | SetRegView 64
|
---|
| 71 | ${Else}
|
---|
| 72 | SetRegView 32
|
---|
| 73 | ${EndIf}
|
---|
[54] | 74 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd"
|
---|
[208] | 75 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "InstallDir" "$INSTDIR"
|
---|
[54] | 76 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
---|
| 77 |
|
---|
| 78 | WriteUninstaller "$INSTDIR\uninstall.exe"
|
---|
| 79 | SectionEnd
|
---|
| 80 |
|
---|
[63] | 81 | Section "$(EXEC_ONLY)" SEL_EXEC
|
---|
[62] | 82 | SetOutPath "$INSTDIR\bin"
|
---|
[217] | 83 | !cd ..
|
---|
| 84 | File "tewi.exe"
|
---|
| 85 | !cd Server
|
---|
[62] | 86 | WriteINIStr $INSTDIR\install.ini uninstall service false
|
---|
| 87 | SectionEnd
|
---|
| 88 |
|
---|
[217] | 89 | !ifndef ONLY_EXEC
|
---|
[63] | 90 | Section /o "$(SERV_TOO)" SEL_SERVICE
|
---|
[62] | 91 | WriteINIStr $INSTDIR\install.ini uninstall service true
|
---|
| 92 | FileOpen $9 $INSTDIR\install.bat w
|
---|
| 93 | FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
|
---|
| 94 | FileClose $9
|
---|
| 95 | nsExec::Exec '"$INSTDIR\install.bat"'
|
---|
| 96 | Pop $0
|
---|
[63] | 97 | DetailPrint "$(WAIT_STOP)"
|
---|
[62] | 98 | Sleep 1000
|
---|
| 99 | CreateDirectory "$INSTDIR\logs"
|
---|
| 100 | SetOutPath "$INSTDIR\bin"
|
---|
[217] | 101 | !cd ..
|
---|
| 102 | File "tewi.exe"
|
---|
| 103 | File /oname=tewisrv.exe "tewi-service.exe"
|
---|
| 104 | !cd Server
|
---|
[62] | 105 | FileOpen $9 $INSTDIR\install.bat w
|
---|
| 106 | FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
|
---|
| 107 | FileWrite $9 '"$SYSDIR\sc.exe" create "TewiHTTPd" DisplayName= "Tewi HTTPd" binpath= "$INSTDIR\bin\tewisrv.exe" start= "auto"$\r$\n'
|
---|
| 108 | FileWrite $9 '"$SYSDIR\sc.exe" start "TewiHTTPd"$\r$\n'
|
---|
| 109 | FileClose $9
|
---|
| 110 | nsExec::Exec '"$INSTDIR\install.bat"'
|
---|
| 111 | Pop $0
|
---|
| 112 | Delete $INSTDIR\install.bat
|
---|
| 113 | SectionEnd
|
---|
[217] | 114 | !endif
|
---|
[62] | 115 |
|
---|
| 116 | Function .onInit
|
---|
| 117 | StrCpy $1 ${SEL_EXEC}
|
---|
| 118 | FunctionEnd
|
---|
| 119 |
|
---|
| 120 | Function .onSelChange
|
---|
| 121 | !insertmacro StartRadioButtons $1
|
---|
| 122 | !insertmacro RadioButton ${SEL_EXEC}
|
---|
[217] | 123 | !ifndef ONLY_EXEC
|
---|
[62] | 124 | !insertmacro RadioButton ${SEL_SERVICE}
|
---|
[217] | 125 | !endif
|
---|
[62] | 126 | !insertmacro EndRadioButtons
|
---|
| 127 | FunctionEnd
|
---|
| 128 |
|
---|
[54] | 129 | Section "Uninstall"
|
---|
[62] | 130 | ReadINIStr $8 $INSTDIR\install.ini uninstall service
|
---|
| 131 | ${If} $8 == "true"
|
---|
| 132 | FileOpen $9 $INSTDIR\uninstall.bat w
|
---|
| 133 | FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
|
---|
| 134 | FileClose $9
|
---|
| 135 | nsExec::Exec '"$INSTDIR\uninstall.bat"'
|
---|
| 136 | Pop $0
|
---|
| 137 | FileOpen $9 $INSTDIR\uninstall.bat w
|
---|
[63] | 138 | DetailPrint "$(WAIT_STOP)"
|
---|
[62] | 139 | Sleep 1000
|
---|
| 140 | FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
|
---|
| 141 | FileClose $9
|
---|
| 142 | nsExec::Exec '"$INSTDIR\uninstall.bat"'
|
---|
| 143 | Pop $0
|
---|
| 144 | Delete $INSTDIR\uninstall.bat
|
---|
| 145 | ${EndIf}
|
---|
| 146 |
|
---|
[54] | 147 | RMDir /r "$INSTDIR"
|
---|
| 148 | RMDir /r "$SMPROGRAMS\Tewi HTTPd"
|
---|
| 149 |
|
---|
[208] | 150 | ${If} ${RunningX64}
|
---|
| 151 | SetRegView 64
|
---|
| 152 | ${Else}
|
---|
| 153 | SetRegView 32
|
---|
| 154 | ${EndIf}
|
---|
[54] | 155 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
|
---|
| 156 | SectionEnd
|
---|