Added command scripts for osx to install i2p as a daemon in launchd.

.command extension make it possible to double click on it like bat files
in windows. Daemon is runned as the user who executes the command file.
This commit is contained in:
meeh
2012-09-05 21:36:24 +00:00
parent 9fd2f1e6a7
commit 5056706742
6 changed files with 81 additions and 0 deletions

View File

@@ -768,6 +768,9 @@
<copy todir="pkg-temp/lib/wrapper/macosx/">
<fileset dir="installer/lib/wrapper/macosx/" excludes="*.txt" />
</copy>
<copy file="installer/resources/net.i2p.router.plist.template" todir="pkg-temp/" />
<copy file="installer/resources/install_i2p_service_osx.command" todir="pkg-temp/" />
<copy file="installer/resources/uninstall_i2p_service_osx.command" todir="pkg-temp/" />
</target>
<target name="preppkg-osx-only" depends="preppkg-osx, jbigi-osx-only" >

View File

@@ -137,6 +137,9 @@
<parsable targetfile="$INSTALL_PATH/eepget.bat" type="shell" os="windows" />
<parsable targetfile="$INSTALL_PATH/runplain.sh" type="shell"> <os family="unix" /> </parsable>
<parsable targetfile="$INSTALL_PATH/Start I2P Router.app/Contents/MacOS/i2prouter" type="shell" os="mac" />
<parsable targetfile="$INSTALL_PATH/net.i2p.router.plist.template" type="shell" os="mac" />
<parsable targetfile="$INSTALL_PATH/install_i2p_service_osx.command" type="shell" os="mac" />
<parsable targetfile="$INSTALL_PATH/uninstall_i2p_service_osx.command" type="shell" os="mac" />
<conditions>
<condition type="variable" id="is64bit">
@@ -186,6 +189,12 @@
<args><arg value="$INSTALL_PATH\eepget" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/Start I2P Router.app" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/net.i2p.router.plist" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/install_i2p_service_osx.command" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/uninstall_i2p_service_osx.command" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />
<args><arg value="$INSTALL_PATH/man" /></args></executable>
<executable targetfile="$INSTALL_PATH/installer/delete.jar" type="jar" stage="postinstall" keep="true" failure="warn"> <os family="windows" />

View File

@@ -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

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.i2p.router</string>
<key>OnDemand</key>
<false/>
<key>StandardOutPath</key>
<string>~/.i2p/wrapper.log</string>
<key>StandardErrorPath</key>
<string>~/.i2p/wrapper.log</string>
<key>ProgramArguments</key>
<array>
<string>COMMAND</string>
<string>console</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>UserName</key>
<string>USERNAME</string>
<key>ServiceDescription</key>
<string>I2P Router service</string>
<key>Disabled</key>
<false/>
<key>WorkingDirectory</key>
<string>I2PPATH</string>
</dict>
</plist>

View File

@@ -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

View File

@@ -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