[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r12085: Only create pid dir if we are about to start Tor (Luca Capel (tor/trunk/debian)



Author: weasel
Date: 2007-10-21 18:12:24 -0400 (Sun, 21 Oct 2007)
New Revision: 12085

Modified:
   tor/trunk/debian/changelog
   tor/trunk/debian/tor.init
Log:
Only create pid dir if we are about to start Tor (Luca Capello, closes: #447508)

Modified: tor/trunk/debian/changelog
===================================================================
--- tor/trunk/debian/changelog	2007-10-21 21:08:40 UTC (rev 12084)
+++ tor/trunk/debian/changelog	2007-10-21 22:12:24 UTC (rev 12085)
@@ -1,3 +1,10 @@
+tor (0.2.0.8-alpha-1+svn) experimentalX; urgency=low
+
+  * Only create pid dir if we are about to start Tor (Luca Capello,
+    closes: #447508).
+
+ -- Peter Palfrader <weasel@xxxxxxxxxx>  Mon, 22 Oct 2007 00:11:15 +0200
+
 tor (0.2.0.8-alpha-1) experimental; urgency=low
 
   * New upstream version.

Modified: tor/trunk/debian/tor.init
===================================================================
--- tor/trunk/debian/tor.init	2007-10-21 21:08:40 UTC (rev 12084)
+++ tor/trunk/debian/tor.init	2007-10-21 22:12:24 UTC (rev 12085)
@@ -61,16 +61,18 @@
 }
 
 
-if test ! -d $TORPIDDIR; then
-	echo "There is no $TORPIDDIR directory.  Creating one for you."
-	mkdir -m 02700 "$TORPIDDIR"
-	chown debian-tor:debian-tor "$TORPIDDIR"
-fi
+check_torpiddir () {
+	if test ! -d $TORPIDDIR; then
+		echo "There is no $TORPIDDIR directory.  Creating one for you."
+		mkdir -m 02700 "$TORPIDDIR"
+		chown debian-tor:debian-tor "$TORPIDDIR"
+	fi
 
-if test ! -x $TORPIDDIR; then
-	echo "Cannot access $TORPIDDIR directory, are you root?" >&2
-	exit 1
-fi
+	if test ! -x $TORPIDDIR; then
+		echo "Cannot access $TORPIDDIR directory, are you root?" >&2
+		exit 1
+	fi
+}
 
 
 case "$1" in
@@ -89,6 +91,8 @@
 		fi
 	fi
 
+	check_torpiddir
+
 	echo "Starting $DESC: $NAME..."
 	if ! su -s /bin/sh -c "$DAEMON --verify-config" debian-tor > /dev/null; then
 		echo "ABORTED: Tor configuration invalid:" >&2