1 | # $Id: install.nsi 208 2024-10-02 02:59:59Z nishi $
|
---|
2 |
|
---|
3 | VIFileVersion "1.0.0.0"
|
---|
4 | VIProductVersion "1.0.0.0"
|
---|
5 | VIAddVersionKey "FileVersion" "${VERSION}"
|
---|
6 | VIAddVersionKey "LegalCopyright" "Public domain. Original by Nishi"
|
---|
7 | VIAddVersionKey "FileDescription" "Tewi HTTPd Installer"
|
---|
8 |
|
---|
9 | LoadLanguageFile "${NSISDIR}\Contrib\Language files\Japanese.nlf"
|
---|
10 | LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
|
---|
11 |
|
---|
12 | Name "Tewi HTTPd"
|
---|
13 | OutFile "install.exe"
|
---|
14 | InstallDir "C:\Tewi"
|
---|
15 | Icon "../Binary/tewi-install.ico"
|
---|
16 | LicenseData ../LICENSE
|
---|
17 |
|
---|
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 |
|
---|
25 | !include "x64.nsh"
|
---|
26 | !include "LogicLib.nsh"
|
---|
27 | !include "Sections.nsh"
|
---|
28 |
|
---|
29 | Page license
|
---|
30 | Page directory
|
---|
31 | Page components
|
---|
32 | Page instfiles
|
---|
33 | UninstPage uninstConfirm
|
---|
34 | UninstPage instfiles
|
---|
35 | Section
|
---|
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"
|
---|
71 | SectionEnd
|
---|
72 |
|
---|
73 | Section "$(EXEC_ONLY)" SEL_EXEC
|
---|
74 | SetOutPath "$INSTDIR\bin"
|
---|
75 | File "../tewi.exe"
|
---|
76 | WriteINIStr $INSTDIR\install.ini uninstall service false
|
---|
77 | SectionEnd
|
---|
78 |
|
---|
79 | Section /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
|
---|
100 | SectionEnd
|
---|
101 |
|
---|
102 | Function .onInit
|
---|
103 | StrCpy $1 ${SEL_EXEC}
|
---|
104 | FunctionEnd
|
---|
105 |
|
---|
106 | Function .onSelChange
|
---|
107 | !insertmacro StartRadioButtons $1
|
---|
108 | !insertmacro RadioButton ${SEL_EXEC}
|
---|
109 | !insertmacro RadioButton ${SEL_SERVICE}
|
---|
110 | !insertmacro EndRadioButtons
|
---|
111 | FunctionEnd
|
---|
112 |
|
---|
113 | Section "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"
|
---|
140 | SectionEnd
|
---|