summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2010-09-30 22:02:54 -0400
committerRoger Dingledine <arma@torproject.org>2010-09-30 22:02:54 -0400
commit28b55c92d52ac6cdf4e3307eb2276f784456d3c0 (patch)
tree369e5621a951bd72403d6d49fd17c7baa1ccc687 /contrib
parentfe9402271a7a9ef21827b66311622adaadd0574a (diff)
parentdadd9608d2720368c78e01f485fc2e2783e6a677 (diff)
downloadtor-28b55c92d52ac6cdf4e3307eb2276f784456d3c0.tar.gz
tor-28b55c92d52ac6cdf4e3307eb2276f784456d3c0.zip
Merge branch 'maint-0.2.2'
Diffstat (limited to 'contrib')
-rw-r--r--contrib/osx/package.sh3
-rw-r--r--contrib/tor.sh.in50
2 files changed, 48 insertions, 5 deletions
diff --git a/contrib/osx/package.sh b/contrib/osx/package.sh
index 488bd27c1b..2be4498328 100644
--- a/contrib/osx/package.sh
+++ b/contrib/osx/package.sh
@@ -89,7 +89,6 @@ EOF
DOC=$BUILD_DIR/tor_resources/documents
mkdir $DOC
mkdir $DOC/howto
-cp AUTHORS $DOC/AUTHORS.txt
groff doc/tor.1.in -T ps -m man | pstopdf -i -o $DOC/tor-reference.pdf
groff doc/tor-resolve.1 -T ps -m man | pstopdf -i -o $DOC/tor-resolve.pdf
mkdir $DOC/Advanced
@@ -145,7 +144,7 @@ cp LICENSE $BUILD_DIR/output/Tor\ License.txt
find $BUILD_DIR/output -print0 | sudo xargs -0 chown root:wheel
-mv $BUILD_DIR/output "$BUILD_DIR/Tor-$VERSION-$ARCH-Bundle"
+sudo mv $BUILD_DIR/output "$BUILD_DIR/Tor-$VERSION-$ARCH-Bundle"
rm -f "Tor-$VERSION-$ARCH-Bundle.dmg"
USER="`whoami`"
sudo hdiutil create -format UDZO -imagekey zlib-level=9 -srcfolder "$BUILD_DIR/Tor-$VERSION-$ARCH-Bundle" "Tor-$VERSION-$ARCH-Bundle.dmg"
diff --git a/contrib/tor.sh.in b/contrib/tor.sh.in
index e169761a62..92f890681f 100644
--- a/contrib/tor.sh.in
+++ b/contrib/tor.sh.in
@@ -16,6 +16,15 @@
# description: Onion Router - A low-latency anonymous proxy
#
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/tor
+NAME=tor
+DESC="tor daemon"
+TORPIDDIR=/var/run/tor
+TORPID=$TORPIDDIR/tor.pid
+WAITFORDAEMON=60
+ARGS=""
+
# Library functions
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
@@ -23,9 +32,6 @@ elif [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi
-# Increase open file descriptors a reasonable amount
-ulimit -n 8192
-
TORCTL=@BINDIR@/torctl
# torctl will use these environment variables
@@ -44,9 +50,47 @@ else
SUPROG=/bin/su
fi
+# Raise ulimit based on number of file descriptors available (thanks, Debian)
+
+if [ -r /proc/sys/fs/file-max ]; then
+ system_max=`cat /proc/sys/fs/file-max`
+ if [ "$system_max" -gt "80000" ] ; then
+ MAX_FILEDESCRIPTORS=32768
+ elif [ "$system_max" -gt "40000" ] ; then
+ MAX_FILEDESCRIPTORS=16384
+ elif [ "$system_max" -gt "10000" ] ; then
+ MAX_FILEDESCRIPTORS=8192
+ else
+ MAX_FILEDESCRIPTORS=1024
+ cat << EOF
+
+Warning: Your system has very few filedescriptors available in total.
+
+Maybe you should try raising that by adding 'fs.file-max=100000' to your
+/etc/sysctl.conf file. Feel free to pick any number that you deem appropriate.
+Then run 'sysctl -p'. See /proc/sys/fs/file-max for the current value, and
+file-nr in the same directory for how many of those are used at the moment.
+
+EOF
+ fi
+else
+ MAX_FILEDESCRIPTORS=8192
+fi
+
+NICE=""
+
case "$1" in
start)
+ if [ -n "$MAX_FILEDESCRIPTORS" ]; then
+ echo -n "Raising maximum number of filedescriptors (ulimit -n) to $MAX_FILEDESCRIPTORS"
+ if ulimit -n "$MAX_FILEDESCRIPTORS" ; then
+ echo "."
+ else
+ echo ": FAILED."
+ fi
+ fi
+
action $"Starting tor:" $TORCTL start
RETVAL=$?
;;