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

Last change on this file since 206 was 206, checked in by Nishi, on Oct 2, 2024 at 11:33:40 AM

[release 2.03C] read registry

  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1# $Id: install.nsi 206 2024-10-02 02:33:40Z nishi $
2
3VIFileVersion "1.0.0.0"
4VIProductVersion "1.0.0.0"
5VIAddVersionKey "FileVersion" "${VERSION}"
6VIAddVersionKey "LegalCopyright" "Public domain. Original by Nishi"
7VIAddVersionKey "FileDescription" "Tewi HTTPd Installer"
8
9LoadLanguageFile "${NSISDIR}\Contrib\Language files\Japanese.nlf"
10LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
11
12Name "Tewi HTTPd"
13OutFile "install.exe"
14InstallDir "C:\Tewi"
15Icon "../Binary/tewi-install.ico"
16LicenseData ../LICENSE
17
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
25!include "LogicLib.nsh"
26!include "Sections.nsh"
27
28Page license
29Page directory
30Page components
31Page instfiles
32UninstPage uninstConfirm
33UninstPage instfiles
34Section
35 CreateDirectory "$INSTDIR\etc"
36 CreateDirectory "$INSTDIR\www"
37 CreateDirectory "$INSTDIR\www\icons"
38 CreateDirectory "$INSTDIR\modules"
39 CreateDirectory "$INSTDIR\bin"
40 SetOutPath "$INSTDIR"
41 File /oname=LICENSE.txt "../LICENSE"
42 SetOutPath "$INSTDIR\modules"
43 File "../Module/*.dll"
44 SetOutPath "$INSTDIR\etc"
45 SetOverWrite off
46 File /oname=tewi.conf "../generated.conf"
47 SetOutPath "$INSTDIR\www"
48 File /oname=index.html "../itworks.html"
49 File /oname=pbtewi.gif "../Binary/pbtewi.gif"
50 SetOutPath "$INSTDIR\www\icons"
51 File "../Icons/*.png"
52 SetOverWrite on
53
54 CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
55 CreateShortcut "$SMPROGRAMS\Tewi HTTPd\License.lnk" "$INSTDIR\LICENSE.txt" ""
56 CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd.lnk" "$INSTDIR\bin\tewi.exe" ""
57 CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v"
58 CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" ""
59
60 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd"
61 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "InstallDir" '"$INSTDIR"'
62 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
63
64 WriteUninstaller "$INSTDIR\uninstall.exe"
65SectionEnd
66
67Section "$(EXEC_ONLY)" SEL_EXEC
68 SetOutPath "$INSTDIR\bin"
69 File "../tewi.exe"
70 WriteINIStr $INSTDIR\install.ini uninstall service false
71SectionEnd
72
73Section /o "$(SERV_TOO)" SEL_SERVICE
74 WriteINIStr $INSTDIR\install.ini uninstall service true
75 FileOpen $9 $INSTDIR\install.bat w
76 FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
77 FileClose $9
78 nsExec::Exec '"$INSTDIR\install.bat"'
79 Pop $0
80 DetailPrint "$(WAIT_STOP)"
81 Sleep 1000
82 CreateDirectory "$INSTDIR\logs"
83 SetOutPath "$INSTDIR\bin"
84 File "../tewi.exe"
85 File /oname=tewisrv.exe "../tewi-service.exe"
86 FileOpen $9 $INSTDIR\install.bat w
87 FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
88 FileWrite $9 '"$SYSDIR\sc.exe" create "TewiHTTPd" DisplayName= "Tewi HTTPd" binpath= "$INSTDIR\bin\tewisrv.exe" start= "auto"$\r$\n'
89 FileWrite $9 '"$SYSDIR\sc.exe" start "TewiHTTPd"$\r$\n'
90 FileClose $9
91 nsExec::Exec '"$INSTDIR\install.bat"'
92 Pop $0
93 Delete $INSTDIR\install.bat
94SectionEnd
95
96Function .onInit
97 StrCpy $1 ${SEL_EXEC}
98FunctionEnd
99
100Function .onSelChange
101 !insertmacro StartRadioButtons $1
102 !insertmacro RadioButton ${SEL_EXEC}
103 !insertmacro RadioButton ${SEL_SERVICE}
104 !insertmacro EndRadioButtons
105FunctionEnd
106
107Section "Uninstall"
108 ReadINIStr $8 $INSTDIR\install.ini uninstall service
109 ${If} $8 == "true"
110 FileOpen $9 $INSTDIR\uninstall.bat w
111 FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
112 FileClose $9
113 nsExec::Exec '"$INSTDIR\uninstall.bat"'
114 Pop $0
115 FileOpen $9 $INSTDIR\uninstall.bat w
116 DetailPrint "$(WAIT_STOP)"
117 Sleep 1000
118 FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
119 FileClose $9
120 nsExec::Exec '"$INSTDIR\uninstall.bat"'
121 Pop $0
122 Delete $INSTDIR\uninstall.bat
123 ${EndIf}
124
125 RMDir /r "$INSTDIR"
126 RMDir /r "$SMPROGRAMS\Tewi HTTPd"
127
128 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
129SectionEnd
Note: See TracBrowser for help on using the repository browser.