X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=debian%2Fspamass-milter.init;h=310ae83ce6182856b2ac0a93c5204b58595a9438;hb=63c79ae6614b1d7087fcad2f10e7a2ded35f4ba8;hp=907f97fdd9423759b3f82943143f4a5f7730ca6d;hpb=c7266fb65a48efe8db3985dea9271ee94b3cd69b;p=deb_pkgs%2Fspamass-milter.git diff --git a/debian/spamass-milter.init b/debian/spamass-milter.init index 907f97f..310ae83 100644 --- a/debian/spamass-milter.init +++ b/debian/spamass-milter.init @@ -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";