Subversion Repositories Tewi

Rev

Rev 61 | Rev 63 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61 Rev 62
Line 1... Line 1...
1
# $Id: install.nsi 61 2024-09-18 12:45:02Z nishi $
1
# $Id: install.nsi 62 2024-09-18 20:02:26Z nishi $
2
 
2
 
3
Name "Tewi HTTPd"
3
Name "Tewi HTTPd"
4
OutFile "install.exe"
4
OutFile "install.exe"
5
InstallDir "C:\Tewi"
5
InstallDir "C:\Tewi"
6
Icon "tewi.ico"
6
Icon "tewi.ico"
7
LicenseData ../LICENSE
7
LicenseData ../LICENSE
-
 
8
 
-
 
9
!include "LogicLib.nsh"
-
 
10
!include "Sections.nsh"
-
 
11
 
8
Page license
12
Page license
-
 
13
Page components
9
Page instfiles
14
Page instfiles
10
UninstPage uninstConfirm
15
UninstPage uninstConfirm
11
UninstPage instfiles
16
UninstPage instfiles
12
Section
17
Section
13
	CreateDirectory "$INSTDIR\etc"
18
	CreateDirectory "$INSTDIR\etc"
Line 15... Line 20...
15
	CreateDirectory "$INSTDIR\www\icons"
20
	CreateDirectory "$INSTDIR\www\icons"
16
	CreateDirectory "$INSTDIR\modules"
21
	CreateDirectory "$INSTDIR\modules"
17
	CreateDirectory "$INSTDIR\bin"
22
	CreateDirectory "$INSTDIR\bin"
18
	SetOutPath "$INSTDIR"
23
	SetOutPath "$INSTDIR"
19
	File /oname=LICENSE.txt "../LICENSE"
24
	File /oname=LICENSE.txt "../LICENSE"
20
	SetOutPath "$INSTDIR\bin"
-
 
21
	File "tewi.exe"
-
 
22
	SetOutPath "$INSTDIR\modules"
25
	SetOutPath "$INSTDIR\modules"
23
	File "../Module/*.dll"
26
	File "../Module/*.dll"
24
	SetOutPath "$INSTDIR\etc"
27
	SetOutPath "$INSTDIR\etc"
25
	SetOverWrite off
28
	SetOverWrite off
26
	File /oname=tewi.conf "../example-win.conf"
29
	File /oname=tewi.conf "../example-win.conf"
Line 40... Line 43...
40
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
43
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
41
 
44
 
42
	WriteUninstaller "$INSTDIR\uninstall.exe"
45
	WriteUninstaller "$INSTDIR\uninstall.exe"
43
SectionEnd
46
SectionEnd
44
 
47
 
-
 
48
Section "Install the executable only" SEL_EXEC
-
 
49
	SetOutPath "$INSTDIR\bin"
-
 
50
	File "../tewi.exe"
-
 
51
	WriteINIStr $INSTDIR\install.ini uninstall service false
-
 
52
SectionEnd
-
 
53
 
-
 
54
Section /o "Install the service too (NT-only)" SEL_SERVICE
-
 
55
	WriteINIStr $INSTDIR\install.ini uninstall service true
-
 
56
	FileOpen $9 $INSTDIR\install.bat w
-
 
57
	FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
-
 
58
	FileClose $9
-
 
59
	nsExec::Exec '"$INSTDIR\install.bat"'
-
 
60
	Pop $0
-
 
61
	DetailPrint "Waiting for 1s so service can stop..."
-
 
62
	Sleep 1000
-
 
63
	CreateDirectory "$INSTDIR\logs"
-
 
64
	SetOutPath "$INSTDIR\bin"
-
 
65
	File "../tewi.exe"
-
 
66
	File /oname=tewisrv.exe "../tewi-service.exe"
-
 
67
	FileOpen $9 $INSTDIR\install.bat w
-
 
68
	FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
-
 
69
	FileWrite $9 '"$SYSDIR\sc.exe" create "TewiHTTPd" DisplayName= "Tewi HTTPd" binpath= "$INSTDIR\bin\tewisrv.exe" start= "auto"$\r$\n'
-
 
70
	FileWrite $9 '"$SYSDIR\sc.exe" start "TewiHTTPd"$\r$\n'
-
 
71
	FileClose $9
-
 
72
	nsExec::Exec '"$INSTDIR\install.bat"'
-
 
73
	Pop $0
-
 
74
	Delete $INSTDIR\install.bat
-
 
75
SectionEnd
-
 
76
 
-
 
77
Function .onInit
-
 
78
	StrCpy $1 ${SEL_EXEC}
-
 
79
FunctionEnd
-
 
80
 
-
 
81
Function .onSelChange
-
 
82
	!insertmacro StartRadioButtons $1
-
 
83
	!insertmacro RadioButton ${SEL_EXEC}
-
 
84
	!insertmacro RadioButton ${SEL_SERVICE}
-
 
85
	!insertmacro EndRadioButtons
-
 
86
FunctionEnd
-
 
87
 
45
Section "Uninstall"
88
Section "Uninstall"
-
 
89
	ReadINIStr $8 $INSTDIR\install.ini uninstall service
-
 
90
	${If} $8 == "true"
-
 
91
		FileOpen $9 $INSTDIR\uninstall.bat w
-
 
92
		FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
-
 
93
		FileClose $9
-
 
94
		nsExec::Exec '"$INSTDIR\uninstall.bat"'
-
 
95
		Pop $0
-
 
96
		FileOpen $9 $INSTDIR\uninstall.bat w
-
 
97
		DetailPrint "Waiting for 1s so service can stop..."
-
 
98
		Sleep 1000
-
 
99
		FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
-
 
100
		FileClose $9
-
 
101
		nsExec::Exec '"$INSTDIR\uninstall.bat"'
-
 
102
		Pop $0
-
 
103
		Delete $INSTDIR\uninstall.bat
-
 
104
	${EndIf}
-
 
105
 
46
	RMDir /r "$INSTDIR"
106
	RMDir /r "$INSTDIR"
47
	RMDir /r "$SMPROGRAMS\Tewi HTTPd"
107
	RMDir /r "$SMPROGRAMS\Tewi HTTPd"
48
 
108
 
49
	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
109
	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
50
SectionEnd
110
SectionEnd