Subversion Repositories Tewi

Rev

Rev 63 | Rev 77 | 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 76 2024-09-19 10:42:38Z nishi $
2
 
63 nishi 3
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Japanese.nlf"
4
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
5
 
54 nishi 6
Name "Tewi HTTPd"
7
OutFile "install.exe"
8
InstallDir "C:\Tewi"
76 nishi 9
Icon "tewi-install.ico"
54 nishi 10
LicenseData ../LICENSE
62 nishi 11
 
63 nishi 12
LangString EXEC_ONLY ${LANG_ENGLISH} "Install the executable only"
13
LangString EXEC_ONLY ${LANG_JAPANESE} "実行機能のみをインストールする"
14
LangString SERV_TOO ${LANG_ENGLISH} "Install the service too (NT-only)"
15
LangString SERV_TOO ${LANG_JAPANESE} "サービスもインストールする(NTのみ)"
16
LangString WAIT_STOP ${LANG_ENGLISH} "Waiting for 1 second so service can stop"
17
LangString WAIT_STOP ${LANG_JAPANESE} "サービスが止まるのを待っています"
18
 
62 nishi 19
!include "LogicLib.nsh"
20
!include "Sections.nsh"
21
 
54 nishi 22
Page license
62 nishi 23
Page components
54 nishi 24
Page instfiles
25
UninstPage uninstConfirm
26
UninstPage instfiles
27
Section
28
	CreateDirectory "$INSTDIR\etc"
29
	CreateDirectory "$INSTDIR\www"
60 nishi 30
	CreateDirectory "$INSTDIR\www\icons"
61 nishi 31
	CreateDirectory "$INSTDIR\modules"
54 nishi 32
	CreateDirectory "$INSTDIR\bin"
61 nishi 33
	SetOutPath "$INSTDIR"
34
	File /oname=LICENSE.txt "../LICENSE"
35
	SetOutPath "$INSTDIR\modules"
36
	File "../Module/*.dll"
54 nishi 37
	SetOutPath "$INSTDIR\etc"
61 nishi 38
	SetOverWrite off
39
	File /oname=tewi.conf "../example-win.conf"
54 nishi 40
	SetOutPath "$INSTDIR\www"
41
	File /oname=index.html "../itworks.html"
60 nishi 42
	SetOutPath "$INSTDIR\www\icons"
43
	File "../Icons/*.png"
61 nishi 44
	SetOverWrite on
54 nishi 45
 
46
	CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
61 nishi 47
	CreateShortcut "$SMPROGRAMS\Tewi HTTPd\License.lnk" "$INSTDIR\LICENSE.txt" ""
54 nishi 48
	CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd.lnk" "$INSTDIR\bin\tewi.exe" ""
49
	CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v"
50
	CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" ""
51
 
52
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd"
53
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
54
 
55
	WriteUninstaller "$INSTDIR\uninstall.exe"
56
SectionEnd
57
 
63 nishi 58
Section "$(EXEC_ONLY)" SEL_EXEC
62 nishi 59
	SetOutPath "$INSTDIR\bin"
60
	File "../tewi.exe"
61
	WriteINIStr $INSTDIR\install.ini uninstall service false
62
SectionEnd
63
 
63 nishi 64
Section /o "$(SERV_TOO)" SEL_SERVICE
62 nishi 65
	WriteINIStr $INSTDIR\install.ini uninstall service true
66
	FileOpen $9 $INSTDIR\install.bat w
67
	FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
68
	FileClose $9
69
	nsExec::Exec '"$INSTDIR\install.bat"'
70
	Pop $0
63 nishi 71
	DetailPrint "$(WAIT_STOP)"
62 nishi 72
	Sleep 1000
73
	CreateDirectory "$INSTDIR\logs"
74
	SetOutPath "$INSTDIR\bin"
75
	File "../tewi.exe"
76
	File /oname=tewisrv.exe "../tewi-service.exe"
77
	FileOpen $9 $INSTDIR\install.bat w
78
	FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
79
	FileWrite $9 '"$SYSDIR\sc.exe" create "TewiHTTPd" DisplayName= "Tewi HTTPd" binpath= "$INSTDIR\bin\tewisrv.exe" start= "auto"$\r$\n'
80
	FileWrite $9 '"$SYSDIR\sc.exe" start "TewiHTTPd"$\r$\n'
81
	FileClose $9
82
	nsExec::Exec '"$INSTDIR\install.bat"'
83
	Pop $0
84
	Delete $INSTDIR\install.bat
85
SectionEnd
86
 
87
Function .onInit
88
	StrCpy $1 ${SEL_EXEC}
89
FunctionEnd
90
 
91
Function .onSelChange
92
	!insertmacro StartRadioButtons $1
93
	!insertmacro RadioButton ${SEL_EXEC}
94
	!insertmacro RadioButton ${SEL_SERVICE}
95
	!insertmacro EndRadioButtons
96
FunctionEnd
97
 
54 nishi 98
Section "Uninstall"
62 nishi 99
	ReadINIStr $8 $INSTDIR\install.ini uninstall service
100
	${If} $8 == "true"
101
		FileOpen $9 $INSTDIR\uninstall.bat w
102
		FileWrite $9 '"$SYSDIR\sc.exe" stop "TewiHTTPd"$\r$\n'
103
		FileClose $9
104
		nsExec::Exec '"$INSTDIR\uninstall.bat"'
105
		Pop $0
106
		FileOpen $9 $INSTDIR\uninstall.bat w
63 nishi 107
		DetailPrint "$(WAIT_STOP)"
62 nishi 108
		Sleep 1000
109
		FileWrite $9 '"$SYSDIR\sc.exe" delete "TewiHTTPd"$\r$\n'
110
		FileClose $9
111
		nsExec::Exec '"$INSTDIR\uninstall.bat"'
112
		Pop $0
113
		Delete $INSTDIR\uninstall.bat
114
	${EndIf}
115
 
54 nishi 116
	RMDir /r "$INSTDIR"
117
	RMDir /r "$SMPROGRAMS\Tewi HTTPd"
118
 
119
	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
120
SectionEnd