[Lunar-commits] <moonbase> tor: init.d support

Christian Krause wookietreiber at lunar-linux.org
Sat May 14 21:39:35 CEST 2011


commit 9f64ae7df18e6fd05f5835bdabc544c1c76c5145
Author: Christian Krause <wookietreiber at lunar-linux.org>
Date:   Sat May 14 21:39:35 2011 +0200

    tor: init.d support
---
 zbeta/tor/BUILD      |   32 ++++++++++++++++++++++++++++++++
 zbeta/tor/DETAILS    |   15 +++++++--------
 zbeta/tor/init.d/tor |   12 ++++++++++++
 3 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/zbeta/tor/BUILD b/zbeta/tor/BUILD
new file mode 100644
index 0000000..6885072
--- /dev/null
+++ b/zbeta/tor/BUILD
@@ -0,0 +1,32 @@
+(
+
+  default_build  &&
+
+  # creates 'tor' user if necessary
+  if getent passwd | grep "^tor:" > /dev/null ; then
+    message "${MESSAGE_COLOR}user 'tor' already exists${DEFAULT_COLOR}"
+  else
+    useradd --system               \
+            --user-group           \
+            --home /var/lib/tor    \
+            --create-home          \
+            tor                   &&
+    message "${MESSAGE_COLOR}user 'tor' created${DEFAULT_COLOR}"
+  fi  &&
+
+  install -o tor -g tor -d /var/log/tor  &&
+
+  devoke_installwatch  &&
+
+  # reasonable defaults for a basic torrc, if not there yet,
+  # for the init.d script to work, properly
+  if [[ ! -f /etc/tor/torrc ]] ; then
+    echo 'RunAsDaemon 1'                          >> /etc/tor/torrc  &&
+    echo 'SocksPort 9050'                         >> /etc/tor/torrc  &&
+    echo 'SocksListenAddress 127.0.0.1'           >> /etc/tor/torrc  &&
+    echo 'PidFile /var/run/tor.pid'               >> /etc/tor/torrc  &&
+    echo 'Log "notice file /var/log/tor/tor.log"' >> /etc/tor/torrc  &&
+    echo 'DataDirectory /var/lib/tor'             >> /etc/tor/torrc
+  fi
+
+) > $C_FIFO 2>&1
diff --git a/zbeta/tor/DETAILS b/zbeta/tor/DETAILS
index 5ff0037..55a3580 100644
--- a/zbeta/tor/DETAILS
+++ b/zbeta/tor/DETAILS
@@ -3,17 +3,16 @@
           SOURCE=$MODULE-$VERSION.tar.gz
       SOURCE_URL=https://www.torproject.org/dist
       SOURCE_VFY=sha1:f25b89d8c677c83ee0559036d5b13d49b272b3b0
-        WEB_SITE=http://www.torproject.org
+        WEB_SITE=http://www.torproject.org/
          ENTERED=20101231
          UPDATED=20110228
            SHORT="defends you against network surveillance and traffic analysis"
 
 cat << EOF
-Tor is a network of virtual tunnels that allows people and groups
-to improve their privacy and security on the Internet. It also
-enables software developers to create new communication tools
-with built-in privacy features. Tor provides the foundation for
-a range of applications that allow organizations and individuals
-to share information over public networks without compromising
-their privacy.
+Tor is a network of virtual tunnels that allows people and groups to improve
+their privacy and security on the Internet. It also enables software
+developers to create new communication tools with built-in privacy features.
+Tor provides the foundation for a range of applications that allow
+organizations and individuals to share information over public networks
+without compromising their privacy.
 EOF
diff --git a/zbeta/tor/init.d/tor b/zbeta/tor/init.d/tor
new file mode 100755
index 0000000..57441cf
--- /dev/null
+++ b/zbeta/tor/init.d/tor
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# short: tor
+# chkconfig: 2345 90 10
+# processname: tor
+# description: The Onion Router - A low-latency anonymous proxy
+# pidfile: /var/run/tor.pid
+# runas: tor
+#
+
+. /lib/lsb/init-functions
+


More information about the Lunar-commits mailing list