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

[or-cvs] r19133: {torvm} Handle failure to start Tor more gracefully; use notices.log (torvm/trunk/build/kamikaze/patches)



Author: coderman
Date: 2009-03-26 00:02:09 -0400 (Thu, 26 Mar 2009)
New Revision: 19133

Modified:
   torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch
   torvm/trunk/build/kamikaze/patches/002-kamikaze-mod-basefiles.patch
Log:
Handle failure to start Tor more gracefully; use notices.log to determine if startup worked at all.

Modified: torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch
===================================================================
--- torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch	2009-03-26 00:54:06 UTC (rev 19132)
+++ torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch	2009-03-26 04:02:09 UTC (rev 19133)
@@ -313,8 +313,8 @@
 +
 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-25 13:16:19.421298376 +0000
-@@ -0,0 +1,132 @@
++++ b/package/tor/files/tor.init	2009-03-26 03:54:19.952640296 +0000
+@@ -0,0 +1,136 @@
 +#!/bin/sh 
 +# make sure we check the system bin dirs
 +export PATH=/usr/sbin:/sbin:$PATH
@@ -344,6 +344,7 @@
 +	[ -f $CONF_F ] || cp -f /etc/tor/torrc $CONF_F
 +	[ -f $GEOIP_F ] || cp -f /etc/tor/geoip $GEOIP_F
 +	[ -d $LOG_D ] || mkdir -p $LOG_D
++	rm -f $LOG_F >/dev/null 2>&1
 +	chown $RUN_USER:$RUN_GROUP $LOG_D
 +	[ -d $DATA_D ] || mkdir -p $DATA_D
 +	chmod 700 $DATA_D
@@ -415,9 +416,12 @@
 +
 +elif [ "$1" = "dofollow" ]; then
 +	$BIN --runasdaemon 0 -f $CONF_F > $SLOG_F 2>&1
-+	reboot >/dev/null 2>&1 &
-+	sleep 1
-+	halt >/dev/null 2>&1
++	if [ -f $LOG_F ]; then
++	  # no log means we didn't really start; don't abort by default.
++	  reboot >/dev/null 2>&1 &
++	  sleep 1
++	  halt >/dev/null 2>&1
++	fi
 +
 +elif [ "$1" = "status" ]; then
 +	while true; do

Modified: torvm/trunk/build/kamikaze/patches/002-kamikaze-mod-basefiles.patch
===================================================================
--- torvm/trunk/build/kamikaze/patches/002-kamikaze-mod-basefiles.patch	2009-03-26 00:54:06 UTC (rev 19132)
+++ torvm/trunk/build/kamikaze/patches/002-kamikaze-mod-basefiles.patch	2009-03-26 04:02:09 UTC (rev 19133)
@@ -1253,7 +1253,7 @@
 -tty1::askfirst:/bin/ash --login
 diff -Naur a/package/base-files/files/etc/preinit b/package/base-files/files/etc/preinit
 --- a/package/base-files/files/etc/preinit	2008-08-14 22:21:35.073308000 +0000
-+++ b/package/base-files/files/etc/preinit	2009-03-26 00:52:20.326675768 +0000
++++ b/package/base-files/files/etc/preinit	2009-03-26 03:48:34.351179704 +0000
 @@ -1,6 +1,13 @@
  #!/bin/sh
  # Copyright (C) 2006 OpenWrt.org
@@ -1262,12 +1262,19 @@
 +# bypass default kamikaze init if we're running with Tor VM modifications
 +if [ -f /etc/torvminit ]; then
 +  chmod +x /etc/torvminit >/dev/null 2>&1
-+  exec /etc/torvminit
-+fi
++  . /etc/torvminit
++else
 +
  . /etc/diag.sh
  
  failsafe_ip() {
+@@ -86,3 +93,6 @@
+ 	
+ 	exec /sbin/init
+ fi
++
++# end not Tor VM init
++fi
 diff -Naur a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile
 --- a/package/base-files/files/etc/profile	2009-01-07 04:38:57.851159000 +0000
 +++ b/package/base-files/files/etc/profile	2009-03-16 00:59:14.150729840 +0000
@@ -1411,7 +1418,7 @@
 +net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=1800
 diff -Naur a/package/base-files/files/etc/torvminit b/package/base-files/files/etc/torvminit
 --- a/package/base-files/files/etc/torvminit	1970-01-01 00:00:00.000000000 +0000
-+++ b/package/base-files/files/etc/torvminit	2009-03-26 00:50:46.993864512 +0000
++++ b/package/base-files/files/etc/torvminit	2009-03-26 03:49:06.422304152 +0000
 @@ -0,0 +1,235 @@
 +#!/bin/sh
 +# Copyright (C) 2008-2009  The Tor Project, Inc.