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

Last change on this file since 62 was 62, checked in by Nishi, on Sep 19, 2024 at 5:02:26 AM

add installer.sh

  • Property svn:keywords set to Id
File size: 3.3 KB
RevLine 
[54]1# $Id: install.nsi 62 2024-09-18 20:02:26Z nishi $
2
3Name "Tewi HTTPd"
4OutFile "install.exe"
5InstallDir "C:\Tewi"
6Icon "tewi.ico"
7LicenseData ../LICENSE
[62]8
9!include "LogicLib.nsh"
10!include "Sections.nsh"
11
[54]12Page license
[62]13Page components
[54]14Page instfiles
15UninstPage uninstConfirm
16UninstPage instfiles
17Section
18 CreateDirectory "$INSTDIR\etc"
19 CreateDirectory "$INSTDIR\www"
[60]20 CreateDirectory "$INSTDIR\www\icons"
[61]21 CreateDirectory "$INSTDIR\modules"
[54]22 CreateDirectory "$INSTDIR\bin"
[61]23 SetOutPath "$INSTDIR"
24 File /oname=LICENSE.txt "../LICENSE"
25 SetOutPath "$INSTDIR\modules"
26 File "../Module/*.dll"
[54]27 SetOutPath "$INSTDIR\etc"
[61]28 SetOverWrite off
29 File /oname=tewi.conf "../example-win.conf"
[54]30 SetOutPath "$INSTDIR\www"
31 File /oname=index.html "../itworks.html"
[60]32 SetOutPath "$INSTDIR\www\icons"
33 File "../Icons/*.png"
[61]34 SetOverWrite on
[54]35
36 CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
[61]37 CreateShortcut "$SMPROGRAMS\Tewi HTTPd\License.lnk" "$INSTDIR\LICENSE.txt" ""
[54]38 CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd.lnk" "$INSTDIR\bin\tewi.exe" ""
39 CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v"
40 CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" ""
41
42 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "DisplayName" "Tewi HTTPd"
43 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
44
45 WriteUninstaller "$INSTDIR\uninstall.exe"
46SectionEnd
47
[62]48Section "Install the executable only" SEL_EXEC
49 SetOutPath "$INSTDIR\bin"
50 File "../tewi.exe"
51 WriteINIStr $INSTDIR\install.ini uninstall service false
52SectionEnd
53
54Section /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
75SectionEnd
76
77Function .onInit
78 StrCpy $1 ${SEL_EXEC}
79FunctionEnd
80
81Function .onSelChange
82 !insertmacro StartRadioButtons $1
83 !insertmacro RadioButton ${SEL_EXEC}
84 !insertmacro RadioButton ${SEL_SERVICE}
85 !insertmacro EndRadioButtons
86FunctionEnd
87
[54]88Section "Uninstall"
[62]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
[54]106 RMDir /r "$INSTDIR"
107 RMDir /r "$SMPROGRAMS\Tewi HTTPd"
108
109 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd"
110SectionEnd
Note: See TracBrowser for help on using the repository browser.