source: installer/resources/fixpaths.cmd @ c7385e5

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

*headdesk* I forget to add the wrapper.pid variable.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1@echo off
2:: fixpaths.cmd
3::
4:: This is a simple (and/or stupid) script whose sole purpose is to set the
5:: correct path for wrapper.logfile, by explicitly setting it to use the
6:: environment variable %temp%.
7::
8:: On every *NIX-like system, $SYSTEM_java_io_tmpdir/wrapper.log points to a system-level
9:: temp directory (/tmp on Linux, /var/tmp on BSD, etc.), but in Windows the value of %temp%
10:: depends on whose account a process is running under. If the same user that installs I2P
11:: is the only one that will run I2P, this isn't a problem.
12::
13:: The problem comes from trying to run the process as a service, or trying to run under an
14:: account other than the one that did the installation. For example if the user "Administrator"
15:: installed I2P on Windows 7, the value for wrapper.logfile will be set to the hardcoded value of
16:: C:\Users\Administrator\AppData\Local\Temp\wrapper.log (if it's left at the default value of
17:: $SYSTEM_java_io_tmpdir/wrapper.log.
18::
19:: If user Alice tries to run I2P, the wrapper will try to write its logfile to
20:: C:\Users\Administrator\AppData\Local\Temp\wrapper.log. Unfortunately Alice
21:: doesn't have the rights to access Administrator's temp directory. The same
22:: will happen with the "limited access account" that the I2P service runs
23:: under.
24::
25:: Since Windows doesn't have sed and it has a retarded find, we resort to this
26:: lameness.
27::
28cd /d %~dp0
29findstr /V /R "^wrapper.logfile=" wrapper.config > wrapper.tmp1
30findstr /V /R "^wrapper.java.pidfile=" wrapper.tmp1 > wrapper.tmp2
31findstr /V /R "^wrapper.pidfile=" wrapper.tmp2 > wrapper.new
32del /F /Q wrapper.tmp*
33echo wrapper.logfile=%%temp%%\wrapper.log >> wrapper.new
34echo wrapper.java.pidfile=%%temp%%\routerjvm.pid >> wrapper.new
35echo wrapper.pidfile=%%temp%%\i2p.pid >> wrapper.new
36move /Y wrapper.new wrapper.config
Note: See TracBrowser for help on using the repository browser.