Changeset 62 in Main for trunk/Server/install.nsi


Ignore:
Timestamp:
Sep 19, 2024, 5:02:26 AM (2 months ago)
Author:
Nishi
Message:

add installer.sh

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Server/install.nsi

    r61 r62  
    66Icon "tewi.ico"
    77LicenseData ../LICENSE
     8
     9!include "LogicLib.nsh"
     10!include "Sections.nsh"
     11
    812Page license
     13Page components
    914Page instfiles
    1015UninstPage uninstConfirm
     
    1823        SetOutPath "$INSTDIR"
    1924        File /oname=LICENSE.txt "../LICENSE"
    20         SetOutPath "$INSTDIR\bin"
    21         File "tewi.exe"
    2225        SetOutPath "$INSTDIR\modules"
    2326        File "../Module/*.dll"
     
    4346SectionEnd
    4447
     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
    4588Section "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
    46106        RMDir /r "$INSTDIR"
    47107        RMDir /r "$SMPROGRAMS\Tewi HTTPd"
Note: See TracChangeset for help on using the changeset viewer.