2004-08-25 11:20:56 +00:00
#!/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/
2004-08-25 11:20:56 +00:00
# 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
2004-08-26 19:08:25 +00:00
cd $1
fi
2011-06-07 14:53:10 +00:00
chmod 755 ./i2prouter
# chmod 755 ./install_i2p_service_unix
chmod 755 ./osid
chmod 755 ./runplain.sh
# chmod 755 ./uninstall_i2p_service_unix
2004-08-26 17:22:37 +00:00
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."
2011-06-14 18:11:43 +00:00
LOGFILE = ./postinstall.log
2004-09-02 04:47:02 +00:00
2004-08-25 11:20:56 +00:00
HOST_OS = ` ./osid`
2011-06-14 18:11:43 +00:00
if [ " X $HOST_OS " = "X" -o " X $HOST_OS " = "Xunknown" ] ; then
2004-08-25 11:20:56 +00:00
echo " $ERROR_MSG "
2011-06-14 18:11:43 +00:00
echo " Host OS is $HOST_OS " >> $LOGFILE
echo " Host architecture is $OS_ARCH " >> $LOGFILE
echo " $ERROR_MSG " >> $LOGFILE
2004-08-25 11:20:56 +00:00
exit 1
fi
2005-09-18 23:08:16 +00:00
OS_ARCH = ` uname -m`
2011-06-07 14:53:10 +00:00
X86_64 = ` echo " ${ OS_ARCH } " | grep x86_64`
2005-09-18 23:08:16 +00:00
2004-08-25 11:20:56 +00:00
case $HOST_OS in
debian | fedora | gentoo | linux | mandrake | redhat | suse )
2011-07-26 21:59:59 +00:00
if [ ` echo $OS_ARCH | grep armv7` ] ; then
wrapperpath = "./lib/wrapper/linux-armv7"
cp ${ wrapperpath } /libwrapper.so ./lib/
2012-11-22 00:36:45 +00:00
elif [ ` echo $OS_ARCH | grep armv6` ] ; then
wrapperpath = "./lib/wrapper/linux-armv6"
cp ${ wrapperpath } /libwrapper.so ./lib/
2011-07-26 21:59:59 +00:00
elif [ ` echo $OS_ARCH | grep arm` ] ; then
wrapperpath = "./lib/wrapper/linux-armv5"
2011-06-14 18:11:43 +00:00
cp ${ wrapperpath } /libwrapper.so ./lib/
2011-09-19 12:21:38 +00:00
elif [ ` echo $OS_ARCH | grep ppc` ] ; then
wrapperpath = "./lib/wrapper/linux-ppc"
cp ${ wrapperpath } /libwrapper.so ./lib/
2011-06-14 18:11:43 +00:00
elif [ " X $X86_64 " = "X" ] ; then
2005-09-18 23:08:16 +00:00
wrapperpath = "./lib/wrapper/linux"
2011-06-07 14:53:10 +00:00
cp ${ wrapperpath } /libwrapper.so ./lib/
2005-09-18 23:08:16 +00:00
else
wrapperpath = "./lib/wrapper/linux64"
2011-06-07 14:53:10 +00:00
cp ${ wrapperpath } /libwrapper.so ./lib
2011-09-19 12:21:38 +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
2005-09-18 23:08:16 +00:00
fi
2004-08-25 11:20:56 +00:00
; ;
freebsd )
2011-09-19 12:21:38 +00:00
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/
# 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
2004-08-25 11:20:56 +00:00
; ;
osx )
wrapperpath = "./lib/wrapper/macosx"
2012-04-14 17:38:08 +00:00
cp ${ wrapperpath } /libwrapper*.jnilib ./lib/
2011-09-19 12:21:38 +00:00
chmod 755 ./Start\ I2P\ Router.app/Contents/MacOS/i2prouter
2012-09-05 21:36:24 +00:00
chmod 755 ./install_i2p_service_osx.command
chmod 755 ./uninstall_i2p_service_osx.command
2004-08-25 11:20:56 +00:00
; ;
solaris )
wrapperpath = "./lib/wrapper/solaris"
2011-06-07 14:53:10 +00:00
cp ${ wrapperpath } /libwrapper.so ./lib/
2004-08-25 11:20:56 +00:00
; ;
2012-11-19 22:41:54 +00:00
netbsd| openbsd| kfreebsd)
2011-09-19 12:21:38 +00:00
# FIXME
# This isn't displayed when installing, but if we fall back to the "*)"
# choice, no cleanup happens and users are advised to copy the wrapper
# in place...but there is no wrapper. Figuring how how to display this,
# such as when doing a headless installation would be good.
echo "The java wrapper is not supported on this platform."
echo "Please use `pwd`/runplain.sh to start I2P."
# But at least the cleanup below will happen.
; ;
2004-08-25 11:20:56 +00:00
* )
2011-06-07 14:53:10 +00:00
echo " ${ ERROR_MSG } "
2011-06-14 18:11:43 +00:00
echo " Host OS is $HOST_OS " >> $LOGFILE
echo " Host architecture is $OS_ARCH " >> $LOGFILE
echo " $ERROR_MSG " >> $LOGFILE
2004-08-25 11:20:56 +00:00
exit 1
; ;
esac
2011-09-19 12:21:38 +00:00
if [ ! " X $wrapperpath " = "x" ] ; then
2012-04-14 17:38:08 +00:00
cp $wrapperpath /i2psvc* .
chmod 755 ./i2psvc*
2011-09-19 12:21:38 +00:00
fi
2011-06-07 14:53:10 +00:00
chmod 755 ./eepget
2004-09-08 22:04:13 +00:00
rm -rf ./icons
rm -rf ./lib/wrapper
2004-09-03 16:52:27 +00:00
rm -f ./lib/*.dll
rm -f ./*.bat
2011-09-17 15:39:54 +00:00
rm -f ./*.cmd
2005-09-16 04:12:24 +00:00
rm -f ./*.exe
2009-06-11 23:38:15 +00:00
rm -rf ./installer
2011-06-23 10:18:19 +00:00
if [ ! ` echo $HOST_OS | grep osx` ] ; then
rm -rf ./Start\ I2P\ Router.app
2012-09-05 21:36:24 +00:00
rm -f install_i2p_service_osx.command
rm -f install_i2p_service_osx.command
rm -f net.i2p.router.plist.template
2011-06-23 10:18:19 +00:00
#rm -f I2P\ Router\ Console.webloc
fi
2009-07-15 15:29:37 +00:00
# no, let's not start the router from the install script any more
# ./i2prouter start
2011-08-06 22:38:37 +00:00
rm -f ./osid
rm -f ./postinstall.sh
2004-08-25 11:20:56 +00:00
exit 0