[Pkg-privacy-commits] [onioncat] 261/340: Use a dedicated sub-directory in /var/run/.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:04:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository onioncat.

commit 598eb8f396bdb36673421b2dd414e965a51693db
Author: intrigeri <intrigeri at boum.org>
Date:   Thu Aug 18 01:57:12 2011 +0200

    Use a dedicated sub-directory in /var/run/.
---
 debian/onioncat.init | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/debian/onioncat.init b/debian/onioncat.init
index 64ab9ed..ff6f467 100644
--- a/debian/onioncat.init
+++ b/debian/onioncat.init
@@ -21,7 +21,8 @@ NAME=ocat
 NAMEL=onioncat
 DESC="OnionCat Tor hidden service connector"
 SCRIPTNAME=/etc/init.d/$NAMEL
-PIDFILE=/var/run/$NAME.pid
+PIDDIR=/var/run/$NAME
+PIDFILE=$PIDDIR/pid
 
 test -x $DAEMON || exit 0
 
@@ -46,8 +47,20 @@ is_true() {
     fi
 }
 
+check_piddir() {
+   if test ! -d $PIDDIR; then
+      mkdir -m 02700 "$PIDDIR"
+      chown onioncat:onioncat "$PIDDIR"
+
+      if test ! -x $IDDIR; then
+	 echo "Cannot access '$PIDDIR' directory, are you root?" >&2
+	 exit 1
+      fi
+}
+
 do_start() {
    if is_true "$ENABLED"; then
+      check_piddir
       start-stop-daemon --start --quiet --pidfile $PIDFILE \
          --exec $DAEMON -- -u $DAEMON_USER -P $PIDFILE $DAEMON_OPTS \
 	 || return 2

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onioncat.git



More information about the Pkg-privacy-commits mailing list