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

Last change on this file since 111 was 78, checked in by Nishi, on Sep 19, 2024 at 7:56:38 PM

add version info

  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1# $Id: install.nsi 78 2024-09-19 10:56:38Z 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 "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 components
30Page instfiles
31UninstPage uninstConfirm
32UninstPage instfiles
33Section
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"
62SectionEnd
63
64Section "$(EXEC_ONLY)" SEL_EXEC
65 SetOutPath "$INSTDIR\bin"
66 File "../tewi.exe"
67 WriteINIStr $INSTDIR\install.ini uninstall service false
68SectionEnd
69
70Section /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
91SectionEnd
92
93Function .onInit
94 StrCpy $1 ${SEL_EXEC}
95FunctionEnd
96
97Function .onSelChange
98 !insertmacro StartRadioButtons $1
99 !insertmacro RadioButton ${SEL_EXEC}
100 !insertmacro RadioButton ${SEL_SERVICE}
101 !insertmacro EndRadioButtons
102FunctionEnd
103
104Section "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"
126SectionEnd
Note: See TracBrowser for help on using the repository browser.