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