1 | # $Id: install.nsi 78 2024-09-19 10:56:38Z 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 "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 "../example-win.conf"
|
---|
46 | SetOutPath "$INSTDIR\www"
|
---|
47 | File /oname=index.html "../itworks.html"
|
---|
48 | SetOutPath "$INSTDIR\www\icons"
|
---|
49 | File "../Icons/*.png"
|
---|
50 | SetOverWrite on
|
---|
51 |
|
---|
52 | CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
|
---|
53 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\License.lnk" "$INSTDIR\LICENSE.txt" ""
|
---|
54 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd.lnk" "$INSTDIR\bin\tewi.exe" ""
|
---|
55 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v"
|
---|
56 | CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" ""
|
---|
57 |
|
---|
58 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd"
|
---|
59 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
---|
60 |
|
---|
61 | WriteUninstaller "$INSTDIR\uninstall.exe"
|
---|
62 | SectionEnd
|
---|
63 |
|
---|
64 | Section "$(EXEC_ONLY)" SEL_EXEC
|
---|
65 | SetOutPath "$INSTDIR\bin"
|
---|
66 | File "../tewi.exe"
|
---|
67 | WriteINIStr $INSTDIR\install.ini uninstall service false
|
---|
68 | SectionEnd
|
---|
69 |
|
---|
70 | Section /o "$(SERV_TOO)" SEL_SERVICE
|
---|
71 | WriteINIStr $INSTDIR\install.ini uninstall service true
|
---|
72 | FileOpen $9 $INSTDIR\install.bat w
|
---|
73 | FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
|
---|
74 | FileClose $9
|
---|
75 | nsExec::Exec '"$INSTDIR\install.bat"'
|
---|
76 | Pop $0
|
---|
77 | DetailPrint "$(WAIT_STOP)"
|
---|
78 | Sleep 1000
|
---|
79 | CreateDirectory "$INSTDIR\logs"
|
---|
80 | SetOutPath "$INSTDIR\bin"
|
---|
81 | File "../tewi.exe"
|
---|
82 | File /oname=tewisrv.exe "../tewi-service.exe"
|
---|
83 | FileOpen $9 $INSTDIR\install.bat w
|
---|
84 | FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
|
---|
85 | FileWrite $9 '"$SYSDIR\sc.exe" create "TewiHTTPd" DisplayName= "Tewi HTTPd" binpath= "$INSTDIR\bin\tewisrv.exe" start= "auto"$\r$\n'
|
---|
86 | FileWrite $9 '"$SYSDIR\sc.exe" start "TewiHTTPd"$\r$\n'
|
---|
87 | FileClose $9
|
---|
88 | nsExec::Exec '"$INSTDIR\install.bat"'
|
---|
89 | Pop $0
|
---|
90 | Delete $INSTDIR\install.bat
|
---|
91 | SectionEnd
|
---|
92 |
|
---|
93 | Function .onInit
|
---|
94 | StrCpy $1 ${SEL_EXEC}
|
---|
95 | FunctionEnd
|
---|
96 |
|
---|
97 | Function .onSelChange
|
---|
98 | !insertmacro StartRadioButtons $1
|
---|
99 | !insertmacro RadioButton ${SEL_EXEC}
|
---|
100 | !insertmacro RadioButton ${SEL_SERVICE}
|
---|
101 | !insertmacro EndRadioButtons
|
---|
102 | FunctionEnd
|
---|
103 |
|
---|
104 | Section "Uninstall"
|
---|
105 | ReadINIStr $8 $INSTDIR\install.ini uninstall service
|
---|
106 | ${If} $8 == "true"
|
---|
107 | FileOpen $9 $INSTDIR\uninstall.bat w
|
---|
108 | FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
|
---|
109 | FileClose $9
|
---|
110 | nsExec::Exec '"$INSTDIR\uninstall.bat"'
|
---|
111 | Pop $0
|
---|
112 | FileOpen $9 $INSTDIR\uninstall.bat w
|
---|
113 | DetailPrint "$(WAIT_STOP)"
|
---|
114 | Sleep 1000
|
---|
115 | FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
|
---|
116 | FileClose $9
|
---|
117 | nsExec::Exec '"$INSTDIR\uninstall.bat"'
|
---|
118 | Pop $0
|
---|
119 | Delete $INSTDIR\uninstall.bat
|
---|
120 | ${EndIf}
|
---|
121 |
|
---|
122 | RMDir /r "$INSTDIR"
|
---|
123 | RMDir /r "$SMPROGRAMS\Tewi HTTPd"
|
---|
124 |
|
---|
125 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
|
---|
126 | SectionEnd
|
---|