Files
i2p.i2p/installer/resources/postinstall.sh

112 lines
3.2 KiB
Bash
Raw Normal View History

#!/bin/sh
# I2P Installer - Installs and pre-configures I2P.
#
# postinstall
# 2004 The I2P Project
2008-11-26 15:20:00 +00:00
# http://www.i2p2.de/
# This code is public domain.
#
# author: hypercubus
#
# Installs the appropriate set of Java Service Wrapper support files for the
# user's OS then launches the I2P router as a background service.
2004-09-02 04:47:02 +00:00
if [ ! "X$1" = "X" ]; then
cd $1
fi
chmod 755 ./i2prouter
# chmod 755 ./install_i2p_service_unix
chmod 755 ./osid
chmod 755 ./runplain.sh
# chmod 755 ./uninstall_i2p_service_unix
ERROR_MSG="Cannot determine operating system type. From the subdirectory in lib/wrapper matching your operating system, please move i2psvc to your base I2P directory, and move the remaining two files to the lib directory."
LOGFILE=./postinstall.log
2004-09-02 04:47:02 +00:00
HOST_OS=`./osid`
if [ "X$HOST_OS" = "X" -o "X$HOST_OS" = "Xunknown" ]; then
echo "$ERROR_MSG"
echo "Host OS is $HOST_OS" >> $LOGFILE
echo "Host architecture is $OS_ARCH" >> $LOGFILE
echo "$ERROR_MSG" >> $LOGFILE
exit 1
fi
OS_ARCH=`uname -m`
X86_64=`echo "${OS_ARCH}" | grep x86_64`
case $HOST_OS in
debian | fedora | gentoo | linux | mandrake | redhat | suse )
if [ `echo $OS_ARCH |grep armv7` ]; then
wrapperpath="./lib/wrapper/linux-armv7"
cp ${wrapperpath}/libwrapper.so ./lib/
elif [ `echo $OS_ARCH |grep arm` ]; then
wrapperpath="./lib/wrapper/linux-armv5"
cp ${wrapperpath}/libwrapper.so ./lib/
2011-07-30 23:25:14 +00:00
elif [ `echo $OS_ARCH |grep ppc` ]; then
wrapperpath="./lib/wrapper/linux-ppc"
cp ${wrapperpath}/libwrapper.so ./lib/
elif [ "X$X86_64" = "X" ]; then
wrapperpath="./lib/wrapper/linux"
cp ${wrapperpath}/libwrapper.so ./lib/
else
wrapperpath="./lib/wrapper/linux64"
cp ${wrapperpath}/libwrapper.so ./lib
We will install a copy of the 32 bit version of the wrapper libs when on x64 for use with a 32 bit JRE. Rationale: On an x64 system using a 32 bit jvm Without the 32 bit libwrapper, messages like this will be shown in wrapper.log with the wrapper in MTN & I2P >= 0.8.7: ----------------------- Launching a JVM... WrapperManager: Initializing... WrapperManager: WrapperManager: WARNING - Unable to load the Wrapper's native library 'libwrapper.so'. WrapperManager: The file is located on the path at the following location but WrapperManager: could not be loaded: WrapperManager: $I2P/lib/libwrapper.so WrapperManager: Please verify that the file is both readable and executable by the WrapperManager: current user and that the file has not been corrupted in any way. WrapperManager: One common cause of this problem is running a 32-bit version WrapperManager: of the Wrapper with a 64-bit version of Java, or vica versa. WrapperManager: This is a 32-bit JVM. WrapperManager: Reported cause: WrapperManager: $I2P/lib/libwrapper.so: $I2P/lib/libwrapper.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch) WrapperManager: System signals will not be handled correctly. ----------------------- With libwrapper.so removed, one sees the following: WrapperManager: WARNING - Unable to load the Wrapper's native library because none of the WrapperManager: following files: WrapperManager: libwrapper-linux-x86-32.so WrapperManager: libwrapper.so WrapperManager: could be located on the following java.library.path: WrapperManager: $I2P WrapperManager: $I2P/lib WrapperManager: Please see the documentation for the wrapper.java.library.path WrapperManager: configuration property. WrapperManager: System signals will not be handled correctly. ----------------------- The 32 bit lib names, when installed on an x64 system, will match the alternate names that the wrapper looks for.
2011-06-12 21:42:09 +00:00
# the 32bit libwrapper.so will be needed if a 32 bit jvm is used
cp ./lib/wrapper/linux/libwrapper.so ./lib/libwrapper-linux-x86-32.so
fi
;;
freebsd )
if [ ! `echo $OS_ARCH | grep amd64` ]; then
wrapperpath="./lib/wrapper/freebsd"
cp ${wrapperpath}/libwrapper.so ./lib/
else
wrapperpath="./lib/wrapper/freebsd64"
cp ${wrapperpath}/libwrapper.so ./lib/
We will install a copy of the 32 bit version of the wrapper libs when on x64 for use with a 32 bit JRE. Rationale: On an x64 system using a 32 bit jvm Without the 32 bit libwrapper, messages like this will be shown in wrapper.log with the wrapper in MTN & I2P >= 0.8.7: ----------------------- Launching a JVM... WrapperManager: Initializing... WrapperManager: WrapperManager: WARNING - Unable to load the Wrapper's native library 'libwrapper.so'. WrapperManager: The file is located on the path at the following location but WrapperManager: could not be loaded: WrapperManager: $I2P/lib/libwrapper.so WrapperManager: Please verify that the file is both readable and executable by the WrapperManager: current user and that the file has not been corrupted in any way. WrapperManager: One common cause of this problem is running a 32-bit version WrapperManager: of the Wrapper with a 64-bit version of Java, or vica versa. WrapperManager: This is a 32-bit JVM. WrapperManager: Reported cause: WrapperManager: $I2P/lib/libwrapper.so: $I2P/lib/libwrapper.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch) WrapperManager: System signals will not be handled correctly. ----------------------- With libwrapper.so removed, one sees the following: WrapperManager: WARNING - Unable to load the Wrapper's native library because none of the WrapperManager: following files: WrapperManager: libwrapper-linux-x86-32.so WrapperManager: libwrapper.so WrapperManager: could be located on the following java.library.path: WrapperManager: $I2P WrapperManager: $I2P/lib WrapperManager: Please see the documentation for the wrapper.java.library.path WrapperManager: configuration property. WrapperManager: System signals will not be handled correctly. ----------------------- The 32 bit lib names, when installed on an x64 system, will match the alternate names that the wrapper looks for.
2011-06-12 21:42:09 +00:00
# the 32bit libwrapper.so will be needed if a 32 bit jvm is used
cp ./lib/freebsd/libwrapper.so ./lib/libwrapper-freebsd-x86-32.so
fi
;;
osx )
wrapperpath="./lib/wrapper/macosx"
cp ${wrapperpath}/libwrapper.jnilib ./lib/
chmod 755 ./Start\ I2P\ Router.app/Contents/MacOS/i2prouter
;;
solaris )
wrapperpath="./lib/wrapper/solaris"
cp ${wrapperpath}/libwrapper.so ./lib/
;;
* )
echo "${ERROR_MSG}"
echo "Host OS is $HOST_OS" >> $LOGFILE
echo "Host architecture is $OS_ARCH" >> $LOGFILE
echo "$ERROR_MSG" >> $LOGFILE
exit 1
;;
esac
cp $wrapperpath/i2psvc .
chmod 755 ./eepget
chmod 755 ./i2psvc
rm -rf ./icons
rm -rf ./lib/wrapper
rm -f ./lib/*.dll
rm -f ./*.bat
rm -f ./*.exe
rm -rf ./installer
if [ ! `echo $HOST_OS |grep osx` ]; then
rm -rf ./Start\ I2P\ Router.app
#rm -f I2P\ Router\ Console.webloc
fi
# no, let's not start the router from the install script any more
# ./i2prouter start
rm -f ./osid
rm -f ./postinstall.sh
exit 0
2004-09-02 04:47:02 +00:00