 +	[ -d $RUN_D ] || mkdir -p $RUN_D
 +	chown $RUN_USER:$RUN_GROUP $RUN_D
 +	chmod 700 $RUN_D
-+	rm -f $LOG_F >/dev/null 2>&1
 +	# append any runtime options as needed
 +	TMP_F="${CONF_F}_tmp"; \
 +	ARGS=`cat /proc/cmdline` ; \

+
diff -Naur a/package/tor/files/tor.init b/package/tor/files/tor.init
--- a/package/tor/files/tor.init	1970-01-01 00:00:00.000000000 +0000
+++ b/package/tor/files/tor.init	2009-03-26 06:23:42.161177504 +0000
@@ -0,0 +1,137 @@
+#!/bin/sh 
+# make sure we check the system bin dirs
+export PATH=/usr/sbin:/sbin:$PATH

+	echo $ARGS | grep ' HASHPW=' >/dev/null 2>&1 ; \
+	if [ $? -eq 0 ]; then \
+	  HASHPW=`echo $ARGS | sed 's/.* HASHPW=//' | sed 's/ .*//'`; \
+	  cat $CONF_F | grep -v HashedControlPassword > $TMP_F; \
+	  echo "HashedControlPassword ${HASHPW}" >> $TMP_F; \
+	  mv -f $TMP_F $CONF_F; \
+	fi; \
+	echo $ARGS | grep ' CTLSOCK=' >/dev/null 2>&1 ; \
+	if [ $? -eq 0 ]; then \
+	  CTLADDR=`echo $ARGS | sed 's/.* CTLSOCK=//' | sed 's/ .*//'`; \
+	  CTLIP=`echo $CTLADDR | sed 's/:.*//'`; \
+	  CTLPORT=`echo $CTLADDR | sed 's/.*://'`; \
+	  cat $CONF_F | grep -v ControlListenAddress | grep -v ControlPort | grep -v SocksListenAddress | grep -v SocksPort > $TMP_F; \
+	  echo "ControlListenAddress ${CTLADDR}" >> $TMP_F; \
+	  echo "ControlPort ${CTLPORT}" >> $TMP_F; \
+	  echo "SocksListenAddress ${CTLIP}:9050" >> $TMP_F; \
+	  echo "SocksPort 9050" >> $TMP_F; \
+	  mv -f $TMP_F $CONF_F; \
+	fi; \
+	chown $RUN_USER:$RUN_GROUP $CONF_F ; \
+	if [ "$FOLLOWTOR" = "1" ]; then \
+	  nohup /etc/init.d/tor dofollow >/dev/null 2>&1 & \
+        else \
+	  $BIN --runasdaemon 1 -f $CONF_F > $SLOG_F 2>&1 ; \
+	fi; 
