source: installer/resources/postinstall.sh @ 46e3174

Last change on this file since 46e3174 was 46e3174, checked in by zzz <zzz@…>, 13 months ago

Build: Drop unmaintained sample apparmor script (ticket #2319)
We support apparmor for Debian package installs only.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1#!/bin/sh
2
3# I2P Installer - Installs and pre-configures I2P.
4#
5# postinstall
6# 2004 The I2P Project
7# https://geti2p.net
8# This code is public domain.
9#
10# author: hypercubus
11#
12# Installs the appropriate set of Java Service Wrapper support files for the
13# user's OS
14
15if [ ! "X$1" = "X" ]; then
16    cd $1
17fi
18
19chmod 755 ./i2prouter
20chmod 755 ./osid
21chmod 755 ./runplain.sh
22
23ERROR_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."
24LOGFILE=./postinstall.log
25
26HOST_OS=`./osid`
27
28if [ "X$HOST_OS" = "X" -o "X$HOST_OS" = "Xunknown" ]; then
29    echo "$ERROR_MSG"
30    echo "Host OS is $HOST_OS" >> $LOGFILE
31    echo "Host architecture is $OS_ARCH" >> $LOGFILE
32    echo "$ERROR_MSG" >> $LOGFILE
33    exit 1
34fi
35
36OS_ARCH=`uname -m`
37X86_64=`echo "${OS_ARCH}" | grep x86_64`
38
39case $HOST_OS in
40    debian | fedora | gentoo | linux | mandrake | redhat | suse )
41        # Tanuki-built arm wrapper works on armv5 and armv7 but not on Raspberry Pi armv6.
42        # Wrapper we built for Raspberry Pi does not work on Trimslice armv7.
43        if [ `echo $OS_ARCH |grep armv7` ]; then
44            wrapperpath="./lib/wrapper/linux-armv5"
45        elif [ `echo $OS_ARCH |grep armv6` ]; then
46            wrapperpath="./lib/wrapper/linux-armv6"
47        elif [ `echo $OS_ARCH |grep arm` ]; then
48            wrapperpath="./lib/wrapper/linux-armv5"
49        elif [ `echo $OS_ARCH |grep ppc` ]; then
50            wrapperpath="./lib/wrapper/linux-ppc"
51        elif [ "X$X86_64" = "X" ]; then
52            wrapperpath="./lib/wrapper/linux"
53        else
54            wrapperpath="./lib/wrapper/linux64"
55            # the 32bit libwrapper.so will be needed if a 32 bit jvm is used
56            cp ./lib/wrapper/linux/libwrapper.so ./lib/libwrapper-linux-x86-32.so
57        fi
58        cp ${wrapperpath}/libwrapper.so ./lib/
59        ;;
60    freebsd )
61        if [ ! `echo $OS_ARCH | grep amd64` ]; then
62            wrapperpath="./lib/wrapper/freebsd"
63        else
64            wrapperpath="./lib/wrapper/freebsd64"
65            # the 32bit libwrapper.so will be needed if a 32 bit jvm is used
66            cp ./lib/wrapper/freebsd/libwrapper.so ./lib/libwrapper-freebsd-x86-32.so
67        fi
68        cp ${wrapperpath}/libwrapper.so ./lib/
69        ;;
70    osx )
71        wrapperpath="./lib/wrapper/macosx"
72        cp ${wrapperpath}/libwrapper*.jnilib ./lib/
73        chmod 755 ./Start\ I2P\ Router.app/Contents/MacOS/i2prouter
74        chmod 755 ./install_i2p_service_osx.command
75        chmod 755 ./uninstall_i2p_service_osx.command
76        ;;
77    solaris )
78        wrapperpath="./lib/wrapper/solaris"
79        cp ${wrapperpath}/libwrapper.so ./lib/
80        ;;
81    netbsd|openbsd|kfreebsd)
82        # FIXME
83        # This isn't displayed when installing, but if we fall back to the "*)"
84        # choice, no cleanup happens and users are advised to copy the wrapper
85        # in place...but there is no wrapper. Figuring out how to display this,
86        # such as when doing a headless installation would be good.
87        echo "The java wrapper is not supported on this platform."
88        echo "Please use `pwd`/runplain.sh to start I2P."
89        # But at least the cleanup below will happen.
90        ;;
91    * )
92        echo "${ERROR_MSG}"
93        echo "Host OS is $HOST_OS" >> $LOGFILE
94        echo "Host architecture is $OS_ARCH" >> $LOGFILE
95        echo "$ERROR_MSG" >> $LOGFILE
96        exit 1
97        ;;
98esac
99
100if [ ! "X$wrapperpath" = "x" ]; then
101    cp $wrapperpath/i2psvc* .
102    chmod 755 ./i2psvc*
103fi
104
105chmod 755 ./eepget
106rm -rf ./icons ./lib/wrapper
107rm -f ./lib/*.dll ./*.bat ./*.cmd ./*.exe ./utility.jar
108
109if [ ! `echo $HOST_OS  |grep osx` ]; then
110    rm -rf ./Start\ I2P\ Router.app
111    rm -f *i2p_service_osx.command
112    rm -f net.i2p.router.plist.template
113    #rm -f I2P\ Router\ Console.webloc
114fi
115
116rm -f ./osid
117rm -f ./postinstall.sh
118exit 0
Note: See TracBrowser for help on using the repository browser.