source: Main/trunk/Server/install.nsi@ 159

Last change on this file since 159 was 128, checked in by Nishi, on Sep 23, 2024 at 7:19:19 PM

release 1.04

  • Property svn:keywords set to Id
File size: 4.1 KB
RevLine 
[54]1# $Id: install.nsi 128 2024-09-23 10:19:19Z nishi $
2
[78]3VIFileVersion "1.0.0.0"
4VIProductVersion "1.0.0.0"
[77]5VIAddVersionKey "FileVersion" "${VERSION}"
6VIAddVersionKey "LegalCopyright" "Public domain. Original by Nishi"
7VIAddVersionKey "FileDescription" "Tewi HTTPd Installer"
8
[63]9LoadLanguageFile "${NSISDIR}\Contrib\Language files\Japanese.nlf"
10LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
11
[54]12Name "Tewi HTTPd"
13OutFile "install.exe"
14InstallDir "C:\Tewi"
[128]15Icon "../Binary/tewi-install.ico"
[54]16LicenseData ../LICENSE
[62]17
[63]18LangString EXEC_ONLY ${LANG_ENGLISH} "Install the executable only"
19LangString EXEC_ONLY ${LANG_JAPANESE} "実行機能のみをインストールする"
20LangString SERV_TOO ${LANG_ENGLISH} "Install the service too (NT-only)"
21LangString SERV_TOO ${LANG_JAPANESE} "サービスもインストールする(NTのみ)"
22LangString WAIT_STOP ${LANG_ENGLISH} "Waiting for 1 second so service can stop"
23LangString WAIT_STOP ${LANG_JAPANESE} "サービスが止まるのを待っています"
24
[62]25!include "LogicLib.nsh"
26!include "Sections.nsh"
27
[54]28Page license
[62]29Page components
[54]30Page instfiles
31UninstPage uninstConfirm
32UninstPage instfiles
33Section
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"
63SectionEnd
64
[63]65Section "$(EXEC_ONLY)" SEL_EXEC
[62]66 SetOutPath "$INSTDIR\bin"
67 File "../tewi.exe"
68 WriteINIStr $INSTDIR\install.ini uninstall service false
69SectionEnd
70
[63]71Section /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
92SectionEnd
93
94Function .onInit
95 StrCpy $1 ${SEL_EXEC}
96FunctionEnd
97
98Function .onSelChange
99 !insertmacro StartRadioButtons $1
100 !insertmacro RadioButton ${SEL_EXEC}
101 !insertmacro RadioButton ${SEL_SERVICE}
102 !insertmacro EndRadioButtons
103FunctionEnd
104
[54]105Section "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"
127SectionEnd
Note: See TracBrowser for help on using the repository browser.