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

Last change on this file since 208 was 208, checked in by Nishi, on Oct 2, 2024 at 11:59:59 AM

do this instead

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