* windows installer fixes / improvements

- move deprecated installer-only classes (Exec, Delete, and Copy) from
    i2p.jar into installer/
  - replace installer/resources/fixpaths.cmd with an improved method in java
  - combine the installer-only utility classes into a single jar and call the
    classes from within izpack
This commit is contained in:
kytv
2012-12-28 20:59:17 +00:00
parent cf10cb1c09
commit 4389f277d6
11 changed files with 350 additions and 175 deletions

View File

@ -620,6 +620,7 @@
<delete dir="debian/repo" />
<ant dir="core/java/" target="distclean" />
<ant dir="router/java/" target="distclean" />
<ant dir="installer/java" target="distclean" />
<ant dir="apps/ministreaming/java/" target="distclean" />
<ant dir="apps/streaming/java/" target="distclean" />
<ant dir="apps/i2ptunnel/java/" target="distclean" />
@ -802,7 +803,6 @@
<copy file="installer/resources/eepget.bat" todir="pkg-temp/" />
<copy file="installer/resources/i2prouter.bat" todir="pkg-temp/" />
<copy file="installer/resources/fixperms.bat" todir="pkg-temp/" />
<copy file="installer/resources/fixpaths.cmd" todir="pkg-temp/" />
<copy file="installer/resources/install_i2p_service_winnt.bat" todir="pkg-temp/" />
<copy file="installer/resources/set_config_dir_for_nt_service.bat" todir="pkg-temp/" />
<copy file="installer/resources/uninstall_i2p_service_winnt.bat" todir="pkg-temp/" />
@ -1154,40 +1154,11 @@
basedir="${basedir}/installer/lib/izpack/patches" />
</target>
<target name="utility-jars" depends="buildCore" >
<mkdir dir="pkg-temp/installer" />
<!-- set if unset -->
<property name="workspace.changes.util.tr" value="" />
<jar destfile="./pkg-temp/installer/copy.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Copy.class net/i2p/util/FileUtil.class">
<manifest>
<attribute name="Main-Class" value="net.i2p.util.Copy" />
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
<attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
</manifest>
</jar>
<jar destfile="./pkg-temp/installer/delete.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Delete.class net/i2p/util/FileUtil.class">
<manifest>
<attribute name="Main-Class" value="net.i2p.util.Delete" />
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
<attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
</manifest>
</jar>
<jar destfile="./pkg-temp/installer/exec.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Exec.class">
<manifest>
<attribute name="Main-Class" value="net.i2p.util.Exec" />
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
<attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
</manifest>
</jar>
<target name="buildUtilityJar" depends="buildCore">
<ant dir="installer/java" target="build" />
</target>
<target name="installer" depends="preppkg, buildProperties, util-list-changes, izpack-patches, utility-jars" >
<target name="installer" depends="preppkg, buildProperties, util-list-changes, izpack-patches, buildUtilityJar" >
<!--
Force 1.5 pack200 output
Doesnt work!
@ -1290,7 +1261,7 @@
<delete dir="pkg-temp" includes="eepget i2prouter INSTALL-headless.txt osid postinstall.sh runplain.sh" />
</target>
<target name="installer-windows" depends="clean, preppkg-windows-only, util-list-changes, izpack-patches, utility-jars" >
<target name="installer-windows" depends="clean, preppkg-windows-only, util-list-changes, izpack-patches, buildUtilityJar" >
<fixcrlf srcdir="pkg-temp" includes="*.config *.bat *.cmd **/*.xml **/*.properties **/*.txt scripts/*" encoding="utf8" eol="crlf"/>
<izpack input="${basedir}/installer/install.xml" output="${basedir}/install.jar" installerType="standard" basedir="${basedir}" />
<ant target="installerexe" />

View File

@ -1,12 +0,0 @@
package net.i2p.util;
/**
* Usage: Delete name
*
* @deprecated only for use by installer, to be removed from i2p.jar, use FileUtil.rmdir()
*/
public class Delete {
public static void main(String args[]) {
FileUtil.rmdir(args[0], false);
}
}

View File

@ -112,15 +112,12 @@
<!-- <panel classname="ProcessPanel"><os family="windows" /></panel> -->
<!-- unix|mac doesn't work, displays for windows too -->
<!-- Unfortunately unix is used for osx as well, so the XInfoPanel was shown *twice*
on OSX. Using the condition this way, the panel is shown on everything
*but* Windows.
<!--
Using the condition this way, the panel is shown on everything *but* Windows.
-->
<panel classname="XInfoPanel" condition="!izpack.windowsinstall" />
<!--<panel classname="XInfoPanel" ><os family="unix" /></panel> -->
<!--<panel classname="XInfoPanel" ><os family="mac" /></panel> -->
<panel classname="SimpleFinishPanel"/>
</panels>
</panels>
<packs>
<pack name="Base" required="yes">
@ -144,82 +141,164 @@
<value>64</value>
</condition>
</conditions>
<!-- postinstall stuff for windows -->
<!-- Wrapper for 32bit Windows JVM -->
<executable targetfile="$INSTALL_PATH/installer/copy.jar" type="jar" stage="postinstall" keep="true" failure="warn"
condition="!is64bit"> <os family="windows" />
<args><arg value="$INSTALL_PATH\lib\wrapper\win32\I2Psvc.exe" /><arg value="$INSTALL_PATH" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/copy.jar" type="jar" stage="postinstall" keep="true" failure="warn"
condition="!is64bit"> <os family="windows" />
<args><arg value="$INSTALL_PATH\lib\wrapper\win32\wrapper.dll" /><arg value="$INSTALL_PATH\lib" /></args></executable>
<executable targetfile="$INSTALL_PATH/utility.jar"
type="jar" class="net.i2p.installer.Copy"
stage="postinstall"
keep="true"
failure="warn"
condition="!is64bit">
<os family="windows" />
<args>
<arg value="$INSTALL_PATH\lib\wrapper\win32\I2Psvc.exe" />
<arg value="$INSTALL_PATH" />
</args>
</executable>
<executable targetfile="$INSTALL_PATH/utility.jar"
type="jar" class="net.i2p.installer.Copy"
stage="postinstall"
keep="true"
failure="warn"
condition="!is64bit">
<os family="windows" />
<args>
<arg value="$INSTALL_PATH\lib\wrapper\win32\wrapper.dll" />
<arg value="$INSTALL_PATH\lib" />
</args>
</executable>
<!-- wrapper for 64bit Windows JVM -->
<executable targetfile="$INSTALL_PATH/installer/copy.jar" type="jar" stage="postinstall" keep="true" failure="warn"
condition="is64bit" > <os family="windows" />
<args><arg value="$INSTALL_PATH\lib\wrapper\win64\I2Psvc.exe" /><arg value="$INSTALL_PATH" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/copy.jar" type="jar" stage="postinstall" keep="true" failure="warn"
condition="is64bit" > <os family="windows" />
<args><arg value="$INSTALL_PATH\lib\wrapper\win64\wrapper.dll" /><arg value="$INSTALL_PATH\lib" /></args></executable>
<!-- We still copy the 32 bit version of wrapper.dll (even with a
64bit jvm) so that if a 32 bit jvm is installed in the
future, nothing breaks.
-->
<executable targetfile="$INSTALL_PATH/installer/copy.jar" type="jar" stage="postinstall" keep="true" failure="warn"
condition="is64bit" > <os family="windows" />
<args><arg value="$INSTALL_PATH\lib\wrapper\win32\wrapper.dll" /><arg value="$INSTALL_PATH\lib\wrapper-windows-x86-32.dll" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH\i2prouter" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH\install_i2p_service_unix" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH\install-headless.txt" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH\runplain.sh" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH\osid" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH\postinstall.sh" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH\uninstall_i2p_service_unix" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH\lib\wrapper" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH\eepget" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/Start I2P Router.app" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/net.i2p.router.plist.template" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/install_i2p_service_osx.command" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/uninstall_i2p_service_osx.command" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/man" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/locale" /></args></executable>
<!-- Placeholder for an OSX 'shortcut' to the router console
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/I2P Router Console.webloc" /></args></executable>
<executable targetfile="$INSTALL_PATH/utility.jar"
type="jar" class="net.i2p.installer.Copy"
stage="postinstall"
keep="true"
failure="warn"
condition="is64bit">
<os family="windows" />
<args>
<arg value="$INSTALL_PATH\lib\wrapper\win64\I2Psvc.exe" />
<arg value="$INSTALL_PATH" />
</args>
</executable>
<executable targetfile="$INSTALL_PATH/utility.jar"
type="jar" class="net.i2p.installer.Copy"
stage="postinstall"
keep="true"
failure="warn"
condition="is64bit">
<os family="windows" />
<args>
<arg value="$INSTALL_PATH\lib\wrapper\win64\wrapper.dll" />
<arg value="$INSTALL_PATH\lib" />
</args>
</executable>
<!--
We still copy the 32 bit version of wrapper.dll (even with a
64bit jvm) so that if a 32 bit jvm is installed in the future,
nothing breaks.
-->
<executable targetfile="$INSTALL_PATH/utility.jar"
type="jar" class="net.i2p.installer.Copy"
stage="postinstall"
keep="true"
failure="warn"
condition="is64bit">
<os family="windows" />
<args>
<arg value="$INSTALL_PATH\lib\wrapper\win32\wrapper.dll" />
<arg value="$INSTALL_PATH\lib\wrapper-windows-x86-32.dll" />
</args>
</executable>
<!-- workaround for bad default path for wrapper.log in Windows. -->
<executable targetfile="$INSTALL_PATH/fixpaths.cmd" type="bin" stage="postinstall" keep="false"> <os family="windows" />
<executable targetfile="$INSTALL_PATH/utility.jar"
type="jar" class="net.i2p.installer.FixWinPaths"
stage="postinstall" keep="true">
<os family="windows" />
<args>
<arg value="$INSTALL_PATH\wrapper.config" />
</args>
</executable>
<!-- Now we'll get rid of the UNIX-only stuff -->
<executable targetfile="$INSTALL_PATH/utility.jar"
type="jar" class="net.i2p.installer.Delete"
stage="postinstall" keep="true" failure="warn">
<os family="windows" />
<args>
<arg value="$INSTALL_PATH\i2prouter" />
<arg value="$INSTALL_PATH\install_i2p_service_unix" />
<arg value="$INSTALL_PATH\install-headless.txt" />
<arg value="$INSTALL_PATH\runplain.sh" />
<arg value="$INSTALL_PATH\osid" />
<arg value="$INSTALL_PATH\postinstall.sh" />
<arg value="$INSTALL_PATH\uninstall_i2p_service_unix" />
<arg value="$INSTALL_PATH\lib\wrapper" />
<arg value="$INSTALL_PATH\eepget" />
<arg value="$INSTALL_PATH/Start I2P Router.app" />
<arg value="$INSTALL_PATH/net.i2p.router.plist.template" />
<arg value="$INSTALL_PATH/install_i2p_service_osx.command" />
<arg value="$INSTALL_PATH/uninstall_i2p_service_osx.command" />
<arg value="$INSTALL_PATH/man" />
<arg value="$INSTALL_PATH/locale" />
<!-- Placeholder for an OSX 'shortcut' to the router console
<arg value="$INSTALL_PATH/I2P Router Console.webloc" />
-->
</args>
</executable>
<!-- workaround for vista permission problems - see comments above -->
<executable targetfile="$INSTALL_PATH/fixperms.bat" type="bin" stage="postinstall" keep="true" failure="warn"
condition="izpack.windowsinstall.vista|izpack.windowsinstall.7" >
<args><arg value="$INSTALL_PATH" /></args>
<args>
<arg value="$INSTALL_PATH" />
</args>
</executable>
<!-- else delete it -->
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"
condition="izpack.windowsinstall.xp|izpack.windowsinstall.2003" >
<args><arg value="$INSTALL_PATH\fixperms.bat" /></args>
<executable targetfile="$INSTALL_PATH/utility.jar"
type="jar" class="net.i2p.installer.Delete"
stage="postinstall" keep="true" failure="warn" condition="izpack.windowsinstall.xp|izpack.windowsinstall.2003">
<args>
<arg value="$INSTALL_PATH\fixperms.bat" />
</args>
</executable>
<!--
<executable targetfile="$INSTALL_PATH/installer/exec.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH" /><arg value="$INSTALL_PATH\I2Psvc.exe" /><arg value="-c" /><arg value="$INSTALL_PATH\wrapper.config" /></args></executable>
<executable targetfile="$INSTALL_PATH/utility.jar"
type="jar" class="net.i2p.installer.Exec"
stage="postinstall" keep="true" failure="warn">
<os family="windows" />
<args>
<arg value="$INSTALL_PATH" />
<arg value="$INSTALL_PATH\I2Psvc.exe" />
<arg value="-c" />
<arg value="$INSTALL_PATH\wrapper.config" />
</args>
</executable>
-->
<!--
and now we delete the installer utility jar.
I moved this out of installer/ because the directory
couldn't be deleted while the jar was active and would
remain on the system.
This, however, works fine.
-->
<executable targetfile="$INSTALL_PATH/utility.jar"
type="jar" class="net.i2p.installer.Delete"
stage="postinstall" keep="false" failure="warn">
<os family="windows" />
<args>
<arg value="$INSTALL_PATH/utility.jar" />
</args>
</executable>
<!-- postinstall stuff for *nix -->
<!-- stage=never means chmod a+x -->
<executable targetfile="$INSTALL_PATH/postinstall.sh" type="bin" stage="never" keep="true" failure="warn"><os family="unix" /></executable>
@ -231,10 +310,6 @@
removed when uninstalling.
-->
<executable targetfile="$INSTALL_PATH/uninstall_i2p_service_winnt.bat" stage="uninstall" os="windows" />
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="false" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/installer/" /></args></executable>
</pack>
<!-- to disable by default, add preselected="no" -->
@ -253,3 +328,6 @@
</packs>
</installation>
<!--
vim:fenc=utf-8:ai:si:ts=4:sw=4:et:nu:
-->

72
installer/java/build.xml Normal file
View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="utility_jars">
<target name="all" depends="clean, build" />
<target name="build" depends="builddep, jar" />
<target name="builddep">
<!-- noop, since the core doesnt depend on anything -->
</target>
<condition property="depend.available">
<typefound name="depend" />
</condition>
<target name="depend" if="depend.available">
<depend
cache="../../build"
srcdir="./src"
destdir="./build/obj" >
</depend>
</target>
<!-- only used if not set by a higher build.xml -->
<property name="javac.compilerargs" value="" />
<property name="javac.classpath" value="" />
<target name="compile" depends="depend">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<javac srcdir="./src" debug="true" source="1.5" target="1.5" deprecation="on"
includeAntRuntime="false"
destdir="./build/obj" classpath="${javac.classpath}:../../core/java/build/obj" >
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>
<target name="listChangedFiles" if="mtn.available" >
<exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
<arg value="list" />
<arg value="changed" />
<arg value="." />
</exec>
<!-- \n in an attribute value generates an invalid manifest -->
<exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
<arg value="-s" />
<arg value="[:space:]" />
<arg value="," />
</exec>
</target>
<target name="jar" depends="compile, listChangedFiles">
<!-- set if unset -->
<property name="workspace.changes.util.tr" value="" />
<jar destfile="../../pkg-temp/utility.jar">
<fileset dir="../../core/java/build/obj" includes="**/FileUtil.class"/>
<fileset dir="./build/obj" includes="**" />
<manifest>
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
<attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
</manifest>
</jar>
</target>
<target name="clean">
<delete dir="./build" />
</target>
<target name="cleandep" depends="clean">
<!-- noop, since the core doesn't depend on anything -->
</target>
<target name="distclean" depends="clean">
<!-- noop, since the core doesn't depend on anything -->
</target>
</project>
<!--
vim:fenc=utf-8:ai:si:ts=4:sw=4:et:nu:fdm=indent:fdn=1:
-->

View File

@ -1,9 +1,11 @@
package net.i2p.util;
package net.i2p.installer;
import net.i2p.util.FileUtil;
/**
* Usage: Copy from to
*
* @deprecated only for use by installer, to be removed from i2p.jar, use FileUtil.copy()
* only for use by installer
*/
public class Copy {
public static void main(String args[]) {

View File

@ -0,0 +1,15 @@
package net.i2p.installer;
import net.i2p.util.FileUtil;
/**
* Usage: Delete name
*
* only for use by installer
*/
public class Delete {
public static void main(String args[]) {
for(int file=0; file < args.length; file++)
FileUtil.rmdir(args[file], false);
}
}

View File

@ -1,11 +1,11 @@
package net.i2p.util;
package net.i2p.installer;
import java.io.File;
/**
* Usage: Exec dir command [args ...]
*
* @deprecated only for use by installer, to be removed from i2p.jar, use ShellCommand
* only for use by installer
*/
public class Exec {
public static void main(String args[]) {

View File

@ -0,0 +1,89 @@
package net.i2p.installer;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
/**
* Usage: FixWinPaths WrapperConfigFile
*
* only for use by installer
*/
public class FixWinPaths{
public static void main(String args[]) {
if(args.length != 1) {
System.err.println("Usage: FixWinPaths [wrapper.conf]\r\n");
System.exit(1);
}
// This is only intended for Windows systems
if(!System.getProperty("os.name").startsWith("Win")) {
return;
}
replace(args[0]);
}
private static void replace(String file) {
// Shouldn't be true
if (!file.contains("wrapper.conf"))
return;
String wConf = file;
String wConfTemp = wConf + ".tmp";
BufferedReader br = null;
BufferedWriter bw = null;
try {
br = new BufferedReader(new FileReader(wConf));
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(wConfTemp), "UTF-8"));
String line;
while ((line = br.readLine()) != null) {
if (line.startsWith("wrapper.logfile="))
line = "wrapper.logfile=%appdata%\\i2p\\wrapper.log";
else if (line.startsWith("#wrapper.java.pidfile="))
line = "#wrapper.java.pidfile=%appdata%\\i2p\\routerjvm.pid";
else if (line.startsWith("#wrapper.pidfile="))
line = "#wrapper.pidfile=%appdata%\\i2p\\i2p.pid";
if (line.contains("\\i2p/"))
line = line.replace("\\i2p/", "\\i2p\\");
if (line.contains("lib/"))
line = line.replace("lib/", "lib\\");
if (line.contains("\\/"))
line = line.replace("\\/", "\\");
if (line.contains("logs/log-router"))
line = line.replace("logs/log-router", "logs\\log-router");
bw.write(line);
bw.newLine();
}
} catch (IOException e) {
return;
} finally {
try {
if(br != null)
br.close();
} catch (IOException e) {
//
}
try {
if(bw != null)
bw.close();
} catch (IOException e) {
//
}
}
// Once everything is complete, delete the original wrapper.conf
File oldFile = new File(wConf);
oldFile.delete();
// ...and rename temp file's name to wrapper.conf
File newFile = new File(wConfTemp);
newFile.renameTo(oldFile);
}
}

View File

@ -1,39 +0,0 @@
@echo off
:: fixpaths.cmd
::
:: This is a simple (and/or stupid) script whose sole purpose is to set the
:: correct path for wrapper.logfile, by explicitly setting it to use the
:: environment variable %temp%.
::
:: On every *NIX-like system, $SYSTEM_java_io_tmpdir/wrapper.log points to a system-level
:: temp directory (/tmp on Linux, /var/tmp on BSD, etc.), but in Windows the value of %temp%
:: depends on whose account a process is running under. If the same user that installs I2P
:: is the only one that will run I2P, this isn't a problem.
::
:: The problem comes from trying to run the process as a service, or trying to run under an
:: account other than the one that did the installation. For example if the user "Administrator"
:: installed I2P on Windows 7, the value for wrapper.logfile will be set to the hardcoded value of
:: C:\Users\Administrator\AppData\Local\Temp\wrapper.log (if it's left at the default value of
:: $SYSTEM_java_io_tmpdir/wrapper.log.
::
:: If user Alice tries to run I2P, the wrapper will try to write its logfile to
:: C:\Users\Administrator\AppData\Local\Temp\wrapper.log. Unfortunately Alice
:: doesn't have the rights to access Administrator's temp directory. The same
:: will happen with the "limited access account" that the I2P service runs
:: under.
::
:: Since Windows doesn't have sed and it has a retarded find, we resort to this
:: lameness.
::
cd /d %~dp0
findstr /V /R "^wrapper.logfile=" wrapper.config > wrapper.tmp1
findstr /V /R "^wrapper.java.pidfile=" wrapper.tmp1 > wrapper.tmp2
findstr /V /R "^wrapper.pidfile=" wrapper.tmp2 > wrapper.new
del /F /Q wrapper.tmp*
echo #PORTABLE installation: >> wrapper.new
echo # The remaining lines should be commented out (or removed) >> wrapper.new
echo # for PORTABLE I2P installations: >> wrapper.new
echo wrapper.logfile=%%temp%%\wrapper.log >> wrapper.new
echo wrapper.java.pidfile=%%temp%%\routerjvm.pid >> wrapper.new
echo wrapper.pidfile=%%temp%%\i2p.pid >> wrapper.new
move /Y wrapper.new wrapper.config

View File

@ -117,7 +117,7 @@ rm -f ./lib/*.dll
rm -f ./*.bat
rm -f ./*.cmd
rm -f ./*.exe
rm -rf ./installer
rm -rf ./utility.jar
if [ ! `echo $HOST_OS |grep osx` ]; then
rm -rf ./Start\ I2P\ Router.app

View File

@ -142,7 +142,6 @@ wrapper.console.loglevel=INFO
# Log file to use for wrapper output logging.
# You may wish to change this.
# NOTE: On Linux/Mac this is overridden in the i2prouter script; changes here will have no effect.
# Windows users may wish to change this to %APPDATA%\I2P\wrapper.log
# System temp directory:
wrapper.logfile=$SYSTEM_java_io_tmpdir/wrapper.log
# PORTABLE installation: