From fd854160887ca26acff55cff5760dcb5d381008c Mon Sep 17 00:00:00 2001 From: hypercubus Date: Wed, 25 Aug 2004 11:20:56 +0000 Subject: [PATCH] service wrapper is now fully integrated --- build.xml | 20 ++++- installer/ProcessPanel.Spec.xml | 14 --- installer/install.xml | 5 +- installer/resources/ProcessPanel.Spec.xml | 12 +++ installer/resources/install_i2p_service_unix | 83 ++++++----------- installer/resources/osid | 87 ++++++++++++++++++ installer/resources/postinstall | 44 +++++++++ installer/resources/postinstall.bat | 18 ++++ .../resources/uninstall_i2p_service_unix | 89 +++++++------------ 9 files changed, 242 insertions(+), 130 deletions(-) delete mode 100644 installer/ProcessPanel.Spec.xml create mode 100644 installer/resources/ProcessPanel.Spec.xml create mode 100644 installer/resources/osid create mode 100644 installer/resources/postinstall create mode 100644 installer/resources/postinstall.bat diff --git a/build.xml b/build.xml index 8c5fd91a0..2b29fd87f 100644 --- a/build.xml +++ b/build.xml @@ -218,17 +218,35 @@ - + + + + + + + + + + + + + + + + + + + diff --git a/installer/ProcessPanel.Spec.xml b/installer/ProcessPanel.Spec.xml deleted file mode 100644 index 29feec591..000000000 --- a/installer/ProcessPanel.Spec.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - console - - - \ No newline at end of file diff --git a/installer/install.xml b/installer/install.xml index 5c255e456..53d54908c 100644 --- a/installer/install.xml +++ b/installer/install.xml @@ -11,7 +11,7 @@ http://www.i2p.net - + @@ -24,6 +24,7 @@ + @@ -31,8 +32,8 @@ - + diff --git a/installer/resources/ProcessPanel.Spec.xml b/installer/resources/ProcessPanel.Spec.xml new file mode 100644 index 000000000..bdd8198a3 --- /dev/null +++ b/installer/resources/ProcessPanel.Spec.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/installer/resources/install_i2p_service_unix b/installer/resources/install_i2p_service_unix index 81a9ba032..c9bd87a5c 100644 --- a/installer/resources/install_i2p_service_unix +++ b/installer/resources/install_i2p_service_unix @@ -9,20 +9,22 @@ # # author: hypercubus # -# Installs I2P as a service on various *nix systems using Wrapper. This script -# must be run as root. +# Installs I2P as a service on various *nix systems using Java Service Wrapper. +# This script must be run as root. # -# Wrapper can be found at: +# Java Service Wrapper can be found at: # http://wrapper.tanukisoftware.org/doc/english/introduction.html if [ $UID -ne 0 ]; then - echo 'Sorry, you need root privileges to install services.' + echo "Sorry, you need root privileges to install services." exit 1 fi -HOST_OS=`uname -a` -if [ ! '$HOST_OS' ]; then - echo 'Cannot determine operating system type. Aborting service installation.' +ERROR_MSG="Cannot determine operating system type. Please install the service manually." +HOST_OS=`./osid` + +if [[ ! $HOST_OS || $HOST_OS = "unknown" ]]; then + echo "$ERROR_MSG" exit 1 fi @@ -62,55 +64,26 @@ install_sysv() ln -sf /etc/init.d/i2psvc /etc/rc3.d/S20i2psvc } -if [[ `echo "$HOST_OS" | grep Darwin` || `echo "$HOST_OS" | grep Macintosh` ]]; then - install_bsd - exit 0 -fi - -if [[ `echo "$HOST_OS" | grep FreeBSD` ]]; then - install_bsd - exit 0 -fi - -if [[ `echo "$HOST_OS" | grep Linux` ]]; then - - LINUX_DISTRO=`cat /proc/version` - - if [[ `echo "$LINUX_DISTRO" | grep Debian` ]]; then +case $HOST_OS in + debian ) install_debian - exit 0 - fi - - if [[ `echo "$LINUX_DISTRO" | grep Fedora` ]]; then + ;; + fedora | mandrake | redhat | suse ) install_redhat - exit 0 - fi - - if [[ `echo "$LINUX_DISTRO" | grep Gentoo` ]]; then + ;; + freebsd | osx ) + install_bsd + ;; + gentoo ) install_gentoo - exit 0 - fi + ;; + solaris ) + install_sysv + ;; + * ) + echo "$ERROR_MSG" + exit 1 + ;; +esac - if [[ `echo "$LINUX_DISTRO" | grep Mandrake` ]]; then - install_redhat - exit 0 - fi - - if [[ `echo "$LINUX_DISTRO" | grep "Red Hat"` ]]; then - install_redhat - exit 0 - fi - - if [[ `echo "$LINUX_DISTRO" | grep Suse` ]]; then - install_redhat - exit 0 - fi -fi - -if [[ `echo "$HOST_OS" | grep Solaris` ]]; then - install_sysv() - exit 0 -fi - -echo 'Cannot determine operating system type. Aborting service installation.' -exit 1 +exit 0 diff --git a/installer/resources/osid b/installer/resources/osid new file mode 100644 index 000000000..dffc26ae0 --- /dev/null +++ b/installer/resources/osid @@ -0,0 +1,87 @@ +#!/bin/sh + +# I2P Installer - Installs and pre-configures I2P. +# +# osid +# 2004 The I2P Project +# http://www.i2p.net +# This code is public domain. +# +# author: hypercubus +# +# Identifies the host OS by returning the corresponding standardized ID string: +# +# debian = Debian +# fedora = Fedora +# freebsd = FreeBSD +# gentoo = Gentoo +# linux = unidentified Linux distro +# mandrake = Mandrake +# osx = Mac OS X +# redhat = Red Hat +# solaris = Solaris +# suse = SuSE +# unknown = OS could not be determined + +HOST_OS=`uname -a` + +if [ ! '$HOST_OS' ]; then + echo unknown + exit 0 +fi + +if [[ `echo "$HOST_OS" | grep Darwin` && `echo "$HOST_OS" | grep Mac` ]]; then + echo osx + exit 0 +fi + +if [[ `echo "$HOST_OS" | grep FreeBSD` ]]; then + echo freebsd + exit 0 +fi + +if [[ `echo "$HOST_OS" | grep Linux` ]]; then + + LINUX_DISTRO=`cat /proc/version` + + if [[ `echo "$LINUX_DISTRO" | grep Debian` ]]; then + echo debian + exit 0 + fi + + if [[ `echo "$LINUX_DISTRO" | grep Fedora` ]]; then + echo fedora + exit 0 + fi + + if [[ `echo "$LINUX_DISTRO" | grep Gentoo` ]]; then + echo gentoo + exit 0 + fi + + if [[ `echo "$LINUX_DISTRO" | grep Mandrake` ]]; then + echo mandrake + exit 0 + fi + + if [[ `echo "$LINUX_DISTRO" | grep "Red Hat"` ]]; then + echo redhat + exit 0 + fi + + if [[ `echo "$LINUX_DISTRO" | grep Suse` ]]; then + echo suse + exit 0 + fi + + echo linux + exit 0 +fi + +if [[ `echo "$HOST_OS" | grep Solaris` ]]; then + echo solaris + exit 0 +fi + +echo unknown +exit 0 diff --git a/installer/resources/postinstall b/installer/resources/postinstall new file mode 100644 index 000000000..be598c705 --- /dev/null +++ b/installer/resources/postinstall @@ -0,0 +1,44 @@ +#!/bin/sh + +# I2P Installer - Installs and pre-configures I2P. +# +# postinstall +# 2004 The I2P Project +# http://www.i2p.net +# 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. + +ERROR_MSG="Cannot determine operating system type. Please move the service files manually from the subdirectory in lib/wrapper for your OS." +HOST_OS=`./osid` + +if [[ ! $HOST_OS || $HOST_OS = "unknown" ]]; then + echo "$ERROR_MSG" + exit 1 +fi + +case $HOST_OS in + debian | fedora | gentoo | linux | mandrake | redhat | suse ) + wrapperpath="./lib/wrapper/linux" + ;; + freebsd ) + wrapperpath="./lib/wrapper/freebsd" + ;; + osx ) + wrapperpath="./lib/wrapper/macosx" + ;; + solaris ) + wrapperpath="./lib/wrapper/solaris" + ;; + * ) + echo "$ERROR_MSG" + exit 1 + ;; +esac + +cp $wrapperpath/i2psvc . +cp $wrapperpath/* ./lib/ +exit 0 diff --git a/installer/resources/postinstall.bat b/installer/resources/postinstall.bat new file mode 100644 index 000000000..9c00fa9c6 --- /dev/null +++ b/installer/resources/postinstall.bat @@ -0,0 +1,18 @@ +:: I2P Installer - Installs and pre-configures I2P. +:: +:: postinstall.bat +:: 2004 The I2P Project +:: http://www.i2p.net +:: This code is public domain. +:: +:: author: hypercubus +:: +:: Installs the Java Service Wrapper support files for Win32 then launches the +:: I2P router as a background service. + +@echo off +set INSTALL_PATH=%~dp0 +copy "%INSTALL_PATH%lib\wrapper\win32\I2Psvc.exe" "%INSTALL_PATH%" +copy "%INSTALL_PATH%lib\wrapper\win32\wrapper.dll" "%INSTALL_PATH%lib" +copy "%INSTALL_PATH%lib\wrapper\win32\wrapper.jar" "%INSTALL_PATH%lib" +"%INSTALL_PATH%i2prouter.bat" diff --git a/installer/resources/uninstall_i2p_service_unix b/installer/resources/uninstall_i2p_service_unix index ac0f97f7c..701c18fff 100644 --- a/installer/resources/uninstall_i2p_service_unix +++ b/installer/resources/uninstall_i2p_service_unix @@ -9,26 +9,28 @@ # # author: hypercubus # -# Uninstalls the Wrapper-based I2P service on various *nix systems. This script -# must be run as root. +# Uninstalls the Java Service Wrapper-based I2P service on various *nix systems. +# This script must be run as root. # -# Wrapper can be found at: +# Java Service Wrapper can be found at: # http://wrapper.tanukisoftware.org/doc/english/introduction.html if [ $UID -ne 0 ]; then - echo 'Sorry, you need root privileges to uninstall services.' + echo "Sorry, you need root privileges to uninstall services." exit 1 fi -HOST_OS=`uname -a` -if [ ! '$HOST_OS' ]; then - echo 'Cannot determine operating system type. Please uninstall the service manually.' +ERROR_MSG="Cannot determine operating system type. Please uninstall the service manually." +HOST_OS=`./osid` + +if [[ ! $HOST_OS || $HOST_OS = "unknown" ]]; then + echo "$ERROR_MSG" exit 1 fi -# The following are several different service installation methods covering some -# of the major *nix operating systems. Most *nix OSes should be able to use one -# of these styles. TODO: AIX, HP-UX, HP-UX/64, IRIX, OSF/1. +# The following are several different service uninstallation methods covering +# some of the major *nix operating systems. Most *nix OSes should be able to use +# one of these styles. TODO: AIX, HP-UX, HP-UX/64, IRIX, OSF/1. uninstall_bsd() { @@ -62,55 +64,26 @@ uninstall_sysv() rm /etc/rc3.d/S20i2psvc } -if [[ `echo "$HOST_OS" | grep Darwin` || `echo "$HOST_OS" | grep Macintosh` ]]; then - uninstall_bsd - exit 0 -fi - -if [[ `echo "$HOST_OS" | grep FreeBSD` ]]; then - uninstall_bsd - exit 0 -fi - -if [[ `echo "$HOST_OS" | grep Linux` ]]; then - - LINUX_DISTRO=`cat /proc/version` - - if [[ `echo "$LINUX_DISTRO" | grep Debian` ]]; then +case $HOST_OS in + debian ) uninstall_debian - exit 0 - fi - - if [[ `echo "$LINUX_DISTRO" | grep Fedora` ]]; then + ;; + fedora | mandrake | redhat | suse ) uninstall_redhat - exit 0 - fi - - if [[ `echo "$LINUX_DISTRO" | grep Gentoo` ]]; then + ;; + freebsd | osx ) + uninstall_bsd + ;; + gentoo ) uninstall_gentoo - exit 0 - fi + ;; + solaris ) + uninstall_sysv + ;; + * ) + echo "$ERROR_MSG" + exit 1 + ;; +esac - if [[ `echo "$LINUX_DISTRO" | grep Mandrake` ]]; then - uninstall_redhat - exit 0 - fi - - if [[ `echo "$LINUX_DISTRO" | grep "Red Hat"` ]]; then - uninstall_redhat - exit 0 - fi - - if [[ `echo "$LINUX_DISTRO" | grep Suse` ]]; then - uninstall_redhat - exit 0 - fi -fi - -if [[ `echo "$HOST_OS" | grep Solaris` ]]; then - uninstall_sysv() - exit 0 -fi - -echo 'Cannot determine operating system type. Please uninstall the service manually.' -exit 1 +exit 0