]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blobdiff - debian/spamass-milter.init
Merge branch 'upstream'
[deb_pkgs/spamass-milter.git] / debian / spamass-milter.init
index 907f97fdd9423759b3f82943143f4a5f7730ca6d..310ae83ce6182856b2ac0a93c5204b58595a9438 100644 (file)
@@ -36,8 +36,8 @@
 
 ### BEGIN INIT INFO
 # Provides:          spamass-milter
-# Required-Start:    $syslog $local_fs
-# Required-Stop:     $syslog $local_fs
+# Required-Start:    $syslog $local_fs $remote_fs
+# Required-Stop:     $syslog $local_fs $remote_fs
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 # Short-Description: milter for spamassassin
@@ -92,20 +92,19 @@ set -e
 start() {
     # Because the default socket is in the same location as the
     # pidfile, we create them in this order.
-    if [ ! -d $(dirname $PIDFILE) ]; then
-       mkdir -p $(dirname $PIDFILE);
-       if [ -d $(dirname $PIDFILE) ] && [ -n "$RUNAS" ]; then
-           chown "$RUNAS" $(dirname $PIDFILE);
-       fi;
-    fi;
+    for DIR in "$(dirname $PIDFILE)" "$(dirname $SOCKET)"; do 
     # if the dirname is '.', then it's some kind of odd socket, like
     # an inet socket. Don't create the directory in such a case
-    if [ $(dirname $SOCKET) != "." ] && [ ! -d $(dirname $SOCKET) ]; then
-       mkdir -p $(dirname $SOCKET);
-       if [ -n "$SOCKETOWNER" ]; then
-           chown "$RUNAS" $(dirname $SOCKET);
+       if [ "$DIR" != "." ] && [ ! -d "$DIR" ]; then
+           mkdir -p "$DIR";
+           if [ -x /sbin/restorecon ]; then 
+               /sbin/restorecon "$DIR";
+           fi;
+           if [ -n "$RUNAS" ]; then
+               chown "$RUNAS" "$DIR";
+           fi;
        fi;
-    fi;
+    done;
     if [ -n "$RUNAS" ] && [ -d $(dirname $PIDFILE) ] &&
        [ "$(stat -c '%U' $(dirname $PIDFILE))" != "$RUNAS" ]; then
        echo "WARNING: $NAME will run as user $RUNAS but $(dirname $PIDFILE) is not owned by $RUNAS";