Subversion Repositories Tewi

Rev

Rev 128 | Rev 208 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
54 nishi 1
# $Id: install.nsi 206 2024-10-02 02:33:40Z nishi $
2
 
78 nishi 3
VIFileVersion "1.0.0.0"
4
VIProductVersion "1.0.0.0"
77 nishi 5
VIAddVersionKey "FileVersion" "${VERSION}"
6
VIAddVersionKey "LegalCopyright" "Public domain. Original by Nishi"
7
VIAddVersionKey "FileDescription" "Tewi HTTPd Installer"
8
 
63 nishi 9
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Japanese.nlf"
10
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
11
 
54 nishi 12
Name "Tewi HTTPd"
13
OutFile "install.exe"
14
InstallDir "C:\Tewi"
128 nishi 15
Icon "../Binary/tewi-install.ico"
54 nishi 16
LicenseData ../LICENSE
62 nishi 17
 
63 nishi 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
 
62 nishi 25
!include "LogicLib.nsh"
26
!include "Sections.nsh"
27
 
54 nishi 28
Page license
206 nishi 29
Page directory
62 nishi 30
Page components
54 nishi 31
Page instfiles
32
UninstPage uninstConfirm
33
UninstPage instfiles
34
Section
35
	CreateDirectory "$INSTDIR\etc"
36
	CreateDirectory "$INSTDIR\www"
60 nishi 37
	CreateDirectory "$INSTDIR\www\icons"
61 nishi 38
	CreateDirectory "$INSTDIR\modules"
54 nishi 39
	CreateDirectory "$INSTDIR\bin"
61 nishi 40
	SetOutPath "$INSTDIR"
41
	File /oname=LICENSE.txt "../LICENSE"
42
	SetOutPath "$INSTDIR\modules"
43
	File "../Module/*.dll"
54 nishi 44
	SetOutPath "$INSTDIR\etc"
61 nishi 45
	SetOverWrite off
128 nishi 46
	File /oname=tewi.conf "../generated.conf"
54 nishi 47
	SetOutPath "$INSTDIR\www"
48
	File /oname=index.html "../itworks.html"
128 nishi 49
	File /oname=pbtewi.gif "../Binary/pbtewi.gif"
60 nishi 50
	SetOutPath "$INSTDIR\www\icons"
51
	File "../Icons/*.png"
61 nishi 52
	SetOverWrite on
54 nishi 53
 
54
	CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
61 nishi 55
	CreateShortcut "$SMPROGRAMS\Tewi HTTPd\License.lnk" "$INSTDIR\LICENSE.txt" ""
54 nishi 56
	CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd.lnk" "$INSTDIR\bin\tewi.exe" ""
57
	CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v"
58
	CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" ""
59
 
60
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd"
206 nishi 61
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "InstallDir" '"$INSTDIR"'
54 nishi 62
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
63
 
64
	WriteUninstaller "$INSTDIR\uninstall.exe"
65
SectionEnd
66
 
63 nishi 67
Section "$(EXEC_ONLY)" SEL_EXEC
62 nishi 68
	SetOutPath "$INSTDIR\bin"
69
	File "../tewi.exe"
70
	WriteINIStr $INSTDIR\install.ini uninstall service false
71
SectionEnd
72
 
63 nishi 73
Section /o "$(SERV_TOO)" SEL_SERVICE
62 nishi 74
	WriteINIStr $INSTDIR\install.ini uninstall service true
75
	FileOpen $9 $INSTDIR\install.bat w
76
	FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
77
	FileClose $9
78
	nsExec::Exec '"$INSTDIR\install.bat"'
79
	Pop $0
63 nishi 80
	DetailPrint "$(WAIT_STOP)"
62 nishi 81
	Sleep 1000
82
	CreateDirectory "$INSTDIR\logs"
83
	SetOutPath "$INSTDIR\bin"
84
	File "../tewi.exe"
85
	File /oname=tewisrv.exe "../tewi-service.exe"
86
	FileOpen $9 $INSTDIR\install.bat w
87
	FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
88
	FileWrite $9 '"$SYSDIR\sc.exe" create "TewiHTTPd" DisplayName= "Tewi HTTPd" binpath= "$INSTDIR\bin\tewisrv.exe" start= "auto"$\r$\n'
89
	FileWrite $9 '"$SYSDIR\sc.exe" start "TewiHTTPd"$\r$\n'
90
	FileClose $9
91
	nsExec::Exec '"$INSTDIR\install.bat"'
92
	Pop $0
93
	Delete $INSTDIR\install.bat
94
SectionEnd
95
 
96
Function .onInit
97
	StrCpy $1 ${SEL_EXEC}
98
FunctionEnd
99
 
100
Function .onSelChange
101
	!insertmacro StartRadioButtons $1
102
	!insertmacro RadioButton ${SEL_EXEC}
103
	!insertmacro RadioButton ${SEL_SERVICE}
104
	!insertmacro EndRadioButtons
105
FunctionEnd
106
 
54 nishi 107
Section "Uninstall"
62 nishi 108
	ReadINIStr $8 $INSTDIR\install.ini uninstall service
109
	${If} $8 == "true"
110
		FileOpen $9 $INSTDIR\uninstall.bat w
111
		FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
112
		FileClose $9
113
		nsExec::Exec '"$INSTDIR\uninstall.bat"'
114
		Pop $0
115
		FileOpen $9 $INSTDIR\uninstall.bat w
63 nishi 116
		DetailPrint "$(WAIT_STOP)"
62 nishi 117
		Sleep 1000
118
		FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
119
		FileClose $9
120
		nsExec::Exec '"$INSTDIR\uninstall.bat"'
121
		Pop $0
122
		Delete $INSTDIR\uninstall.bat
123
	${EndIf}
124
 
54 nishi 125
	RMDir /r "$INSTDIR"
126
	RMDir /r "$SMPROGRAMS\Tewi HTTPd"
127
 
128
	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
129
SectionEnd