source: installer/resources/install_i2p_service_winnt.bat @ d084d18

Last change on this file since d084d18 was d084d18, checked in by kytv <kytv@…>, 9 years ago

Update of Windows service installation/removal scripts

These scripts are based on InstallApp?-NT.bat.in and UninstallApp?-NT.bat.in from
WRAPPERSRC/src/bin of version 3.5.9 of the wrapper.

Tested in XP and Win7.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1@echo off
2setlocal
3
4rem Copyright (c) 1999, 2011 Tanuki Software, Ltd.
5rem http://www.tanukisoftware.com
6rem All rights reserved.
7rem
8rem This software is the proprietary information of Tanuki Software.
9rem You shall use it only in accordance with the terms of the
10rem license agreement you entered into with Tanuki Software.
11rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
12rem
13rem Java Service Wrapper general NT service install script
14rem
15
16rem -----------------------------------------------------------------------------
17rem These settings can be modified to fit the needs of your application
18rem Optimized for use with version 3.5.9 of the Wrapper.
19
20rem The base name for the Wrapper binary.
21set _WRAPPER_BASE=i2psvc
22
23rem The name and location of the Wrapper configuration file.   This will be used
24rem  if the user does not specify a configuration file as the first argument to
25rem  this script.
26set _WRAPPER_CONF_DEFAULT=.\wrapper.config
27
28rem _PASS_THROUGH tells the script to pass all arguments through to the JVM
29rem  as is.
30rem set _PASS_THROUGH=true
31
32rem Do not modify anything beyond this point
33rem -----------------------------------------------------------------------------
34
35rem
36rem Resolve the real path of the wrapper.exe
37rem  For non NT systems, the _REALPATH and _WRAPPER_CONF values
38rem  can be hard-coded below and the following test removed.
39rem
40if "%OS%"=="Windows_NT" goto nt
41echo This script only works with NT-based versions of Windows.
42goto :eof
43
44:nt
45rem
46rem Find the application home.
47rem
48rem %~dp0 is location of current script under NT
49set _REALPATH=%~dp0
50
51rem
52rem Decide on the specific Wrapper binary to use (See delta-pack)
53rem
54if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
55if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
56set _WRAPPER_L_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
57goto search
58:amd64
59set _WRAPPER_L_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
60goto search
61:ia64
62set _WRAPPER_L_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-ia-64.exe
63goto search
64:search
65set _WRAPPER_EXE=%_WRAPPER_L_EXE%
66if exist "%_WRAPPER_EXE%" goto conf
67set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe
68if exist "%_WRAPPER_EXE%" goto conf
69echo Unable to locate a Wrapper executable using any of the following names:
70echo %_WRAPPER_L_EXE%
71echo %_WRAPPER_EXE%
72pause
73goto :eof
74
75rem
76rem Find the wrapper.conf
77rem
78:conf
79set _WRAPPER_CONF="%~f1"
80if not [%_WRAPPER_CONF%]==[""] (
81    shift
82    goto :startup
83)
84set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT%"
85
86:: Add service path to wrapper.config
87call "%_REALPATH%"\set_config_dir_for_nt_service.bat install
88
89rem
90rem Install the Wrapper as an NT service.
91rem
92:startup
93
94rem Collect an parameters
95:parameters
96set _PARAMETERS=%_PARAMETERS% %1
97shift
98if not [%1]==[] goto :parameters
99
100:: We remove the existing service to
101:: 1) force the service to stop
102:: 2) update service configuration in case wrapper.config was edited
103:: 3) prevent hanging the installer if 'install as service' is selected
104::    and it's already enabled as a service.
105if [%_PASS_THROUGH%]==[] (
106    "%_WRAPPER_EXE%" -r %_WRAPPER_CONF%
107    "%_WRAPPER_EXE%" -i %_WRAPPER_CONF%
108) else (
109    "%_WRAPPER_EXE%" -r %_WRAPPER_CONF% -- %_PARAMETERS%
110    "%_WRAPPER_EXE%" -i %_WRAPPER_CONF% -- %_PARAMETERS%
111)
112if not errorlevel 1 goto :eof
113if "%2"=="--nopause" goto :eof
114pause
115
116:eof
Note: See TracBrowser for help on using the repository browser.