-
-
Save ihashacks/6110615 to your computer and use it in GitHub Desktop.
tor init script patch for those of us mounting /var/log in RAM disk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- tor.init 2013-07-29 23:06:25.329990252 -0700 | |
+++ tor.init-patched 2013-07-28 22:26:13.919215615 -0700 | |
@@ -24,6 +24,7 @@ | |
DAEMON=/usr/sbin/tor | |
NAME=tor | |
DESC="tor daemon" | |
+TORLOGDIR=/var/log/tor | |
TORPIDDIR=/var/run/tor | |
TORPID=$TORPIDDIR/tor.pid | |
DEFAULTSFILE=/etc/default/$NAME | |
@@ -95,6 +96,20 @@ | |
} | |
+check_torlogdir () { | |
+ if test ! -d $TORLOGDIR; then | |
+ mkdir -m 02750 "$TORLOGDIR" | |
+ chown debian-tor:debian-tor "$TORLOGDIR" | |
+ ! [ -x /sbin/restorecon ] || /sbin/restorecon "$TORLOGDIR" | |
+ fi | |
+ | |
+ if test ! -x $TORLOGDIR; then | |
+ log_action_end_msg 1 "cannot access $TORLOGDIR directory, are you root?" | |
+ exit 1 | |
+ fi | |
+} | |
+ | |
+ | |
check_torpiddir () { | |
if test ! -d $TORPIDDIR; then | |
mkdir -m 02750 "$TORPIDDIR" | |
@@ -108,6 +123,7 @@ | |
fi | |
} | |
+ | |
check_config () { | |
if ! $DAEMON $VERIFY_ARGS > /dev/null; then | |
log_failure_msg "Checking if $NAME configuration is valid" | |
@@ -133,6 +149,7 @@ | |
fi | |
fi | |
+ check_torlogdir | |
check_torpiddir | |
check_config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment