1 | # $Id: install.nsi 128 2024-09-23 10:19:19Z 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 "LogicLib.nsh"
|
---|
26 | !include "Sections.nsh"
|
---|
27 |
|
---|
28 | Page license
|
---|
29 | Page components
|
---|
30 | Page instfiles
|
---|
31 | UninstPage uninstConfirm
|
---|
32 | UninstPage instfiles
|
---|
33 | Section
|
---|
34 | CreateDirectory "$INSTDIR\etc"
|
---|
35 | CreateDirectory "$INSTDIR\www"
|
---|
36 | CreateDirectory "$INSTDIR\www\icons"
|
---|
37 | CreateDirectory "$INSTDIR\modules"
|
---|
38 | CreateDirectory "$INSTDIR\bin"
|
---|
39 | SetOutPath "$INSTDIR"
|
---|
40 | File /oname=LICENSE.txt "../LICENSE"
|
---|
41 | SetOutPath "$INSTDIR\modules"
|
---|
42 | File "../Module/*.dll"
|
---|
43 | SetOutPath "$INSTDIR\etc"
|
---|
44 | SetOverWrite off
|
---|
45 | File /oname=tewi.conf "../generated.conf"
|
---|
46 | SetOutPath "$INSTDIR\www"
|
---|
47 | File /oname=index.html "../itworks.html"
|
---|
48 | File /oname=pbtewi.gif "../Binary/pbtewi.gif"
|
---|
49 | SetOutPath "$INSTDIR\www\icons"
|
---|
50 | File "../Icons/*.png"
|
---|
51 | SetOverWrite on
|
---|
52 |
|
---|
53 | CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
|
---|
54 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\License.lnk" "$INSTDIR\LICENSE.txt" ""
|
---|
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"
|
---|
63 | SectionEnd
|
---|
64 |
|
---|
65 | Section "$(EXEC_ONLY)" SEL_EXEC
|
---|
66 | SetOutPath "$INSTDIR\bin"
|
---|
67 | File "../tewi.exe"
|
---|
68 | WriteINIStr $INSTDIR\install.ini uninstall service false
|
---|
69 | SectionEnd
|
---|
70 |
|
---|
71 | Section /o "$(SERV_TOO)" SEL_SERVICE
|
---|
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
|
---|
78 | DetailPrint "$(WAIT_STOP)"
|
---|
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
|
---|
92 | SectionEnd
|
---|
93 |
|
---|
94 | Function .onInit
|
---|
95 | StrCpy $1 ${SEL_EXEC}
|
---|
96 | FunctionEnd
|
---|
97 |
|
---|
98 | Function .onSelChange
|
---|
99 | !insertmacro StartRadioButtons $1
|
---|
100 | !insertmacro RadioButton ${SEL_EXEC}
|
---|
101 | !insertmacro RadioButton ${SEL_SERVICE}
|
---|
102 | !insertmacro EndRadioButtons
|
---|
103 | FunctionEnd
|
---|
104 |
|
---|
105 | Section "Uninstall"
|
---|
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
|
---|
114 | DetailPrint "$(WAIT_STOP)"
|
---|
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 |
|
---|
123 | RMDir /r "$INSTDIR"
|
---|
124 | RMDir /r "$SMPROGRAMS\Tewi HTTPd"
|
---|
125 |
|
---|
126 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
|
---|
127 | SectionEnd
|
---|