Subversion Repositories Tewi

Rev

Rev 206 | Rev 217 | 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 208 2024-10-02 02:59:59Z 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
 
208 nishi 25
!include "x64.nsh"
62 nishi 26
!include "LogicLib.nsh"
27
!include "Sections.nsh"
28
 
54 nishi 29
Page license
206 nishi 30
Page directory
62 nishi 31
Page components
54 nishi 32
Page instfiles
33
UninstPage uninstConfirm
34
UninstPage instfiles
35
Section
36
	CreateDirectory "$INSTDIR\etc"
37
	CreateDirectory "$INSTDIR\www"
60 nishi 38
	CreateDirectory "$INSTDIR\www\icons"
61 nishi 39
	CreateDirectory "$INSTDIR\modules"
54 nishi 40
	CreateDirectory "$INSTDIR\bin"
61 nishi 41
	SetOutPath "$INSTDIR"
42
	File /oname=LICENSE.txt "../LICENSE"
43
	SetOutPath "$INSTDIR\modules"
44
	File "../Module/*.dll"
54 nishi 45
	SetOutPath "$INSTDIR\etc"
61 nishi 46
	SetOverWrite off
128 nishi 47
	File /oname=tewi.conf "../generated.conf"
54 nishi 48
	SetOutPath "$INSTDIR\www"
49
	File /oname=index.html "../itworks.html"
128 nishi 50
	File /oname=pbtewi.gif "../Binary/pbtewi.gif"
60 nishi 51
	SetOutPath "$INSTDIR\www\icons"
52
	File "../Icons/*.png"
61 nishi 53
	SetOverWrite on
54 nishi 54
 
55
	CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
61 nishi 56
	CreateShortcut "$SMPROGRAMS\Tewi HTTPd\License.lnk" "$INSTDIR\LICENSE.txt" ""
54 nishi 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
 
208 nishi 61
	${If} ${RunningX64}
62
		SetRegView 64
63
	${Else}
64
		SetRegView 32
65
	${EndIf}
54 nishi 66
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd"
208 nishi 67
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "InstallDir" "$INSTDIR"
54 nishi 68
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
69
 
70
	WriteUninstaller "$INSTDIR\uninstall.exe"
71
SectionEnd
72
 
63 nishi 73
Section "$(EXEC_ONLY)" SEL_EXEC
62 nishi 74
	SetOutPath "$INSTDIR\bin"
75
	File "../tewi.exe"
76
	WriteINIStr $INSTDIR\install.ini uninstall service false
77
SectionEnd
78
 
63 nishi 79
Section /o "$(SERV_TOO)" SEL_SERVICE
62 nishi 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
63 nishi 86
	DetailPrint "$(WAIT_STOP)"
62 nishi 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
 
54 nishi 113
Section "Uninstall"
62 nishi 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
63 nishi 122
		DetailPrint "$(WAIT_STOP)"
62 nishi 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
 
54 nishi 131
	RMDir /r "$INSTDIR"
132
	RMDir /r "$SMPROGRAMS\Tewi HTTPd"
133
 
208 nishi 134
	${If} ${RunningX64}
135
		SetRegView 64
136
	${Else}
137
		SetRegView 32
138
	${EndIf}
54 nishi 139
	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
140
SectionEnd