- 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;