diff --git a/build.xml b/build.xml index b9c9940f2..d0555659a 100644 --- a/build.xml +++ b/build.xml @@ -768,6 +768,9 @@ + + + diff --git a/installer/install.xml b/installer/install.xml index b4fd5787b..8d5bfac0f 100644 --- a/installer/install.xml +++ b/installer/install.xml @@ -137,6 +137,9 @@ + + + @@ -186,6 +189,12 @@ + + + + + + diff --git a/installer/resources/install_i2p_service_osx.command b/installer/resources/install_i2p_service_osx.command new file mode 100644 index 000000000..9bfee453c --- /dev/null +++ b/installer/resources/install_i2p_service_osx.command @@ -0,0 +1,20 @@ +#!/bin/bash +# 2012, The I2P Project +# http://www.i2p2.de/ +# This code is public domain. +# Author: Meeh +cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +shfile="tmp$$.sh" +echo -n 'cat `pwd`/net.i2p.router.plist |' > `pwd`/$shfile +echo -n "sed 's#USERNAME#`whoami`#' " >> `pwd`/$shfile +echo -n '| sed "s#COMMAND#`pwd`/i2prouter#" | sed "s#I2PPATH#`pwd`/#" > /Library/LaunchDaemons/net.i2p.router.plist' >> `pwd`/$shfile +chmod +x `pwd`/$shfile +echo "Please enter your password for sudo privileges to install I2P as a launchd service" +sudo ./$shfile +sudo launchctl load -F /Library/LaunchDaemons/net.i2p.router.plist +if [ $? == 0 ]; then + echo "I2P Router wrapper was successfully installed as a launchd service." +else + echo "I2P Router wrapper was not installed as a launchd service." +fi +rm -f `pwd`/$shfile diff --git a/installer/resources/net.i2p.router.plist.template b/installer/resources/net.i2p.router.plist.template new file mode 100644 index 000000000..65fa2ac96 --- /dev/null +++ b/installer/resources/net.i2p.router.plist.template @@ -0,0 +1,31 @@ + + + + + Label + net.i2p.router + OnDemand + + StandardOutPath + ~/.i2p/wrapper.log + StandardErrorPath + ~/.i2p/wrapper.log + ProgramArguments + + COMMAND + console + + RunAtLoad + + KeepAlive + + UserName + USERNAME + ServiceDescription + I2P Router service + Disabled + + WorkingDirectory + I2PPATH + + diff --git a/installer/resources/postinstall.sh b/installer/resources/postinstall.sh index a48ede06c..78dc62831 100644 --- a/installer/resources/postinstall.sh +++ b/installer/resources/postinstall.sh @@ -74,6 +74,8 @@ case $HOST_OS in wrapperpath="./lib/wrapper/macosx" cp ${wrapperpath}/libwrapper*.jnilib ./lib/ chmod 755 ./Start\ I2P\ Router.app/Contents/MacOS/i2prouter + chmod 755 ./install_i2p_service_osx.command + chmod 755 ./uninstall_i2p_service_osx.command ;; solaris ) wrapperpath="./lib/wrapper/solaris" @@ -114,6 +116,9 @@ rm -rf ./installer if [ ! `echo $HOST_OS |grep osx` ]; then rm -rf ./Start\ I2P\ Router.app + rm -f install_i2p_service_osx.command + rm -f install_i2p_service_osx.command + rm -f net.i2p.router.plist.template #rm -f I2P\ Router\ Console.webloc fi diff --git a/installer/resources/uninstall_i2p_service_osx.command b/installer/resources/uninstall_i2p_service_osx.command new file mode 100644 index 000000000..5100bab9c --- /dev/null +++ b/installer/resources/uninstall_i2p_service_osx.command @@ -0,0 +1,13 @@ +#!/bin/bash +# 2012, The I2P Project +# http://www.i2p2.de/ +# This code is public domain. +# Author: Meeh +echo "Please enter your password for sudo privileges to uninstall I2P from launchd" +sudo launchctl unload -w /Library/LaunchDaemons/net.i2p.router.plist +if [ $? == 0 ]; then + sudo rm -f /Library/LaunchDaemons/net.i2p.router.plist + echo "I2P Router wrapper was successfully uninstalled from launchd." +else + echo "I2P Router wrapper was not uninstalled from launchd." +fi