| # Copyright 2016 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Set permissions and owners for sockets in /run/broker_service." |
| |
| start on started upstart-socket-bridge |
| |
| env BROKER_SERVICE_SOCKET_DIR=/run/broker_service |
| |
| # Non root users can't talk to the sockets, chmod them. |
| script |
| # We want to retry, in case upstart-socket-bridge hasn't finished creating |
| # our socket for us yet. |
| local n=0 |
| while [ $((n += 1)) -lt 10 ]; do |
| chmod 666 -R "${BROKER_SERVICE_SOCKET_DIR}" && \ |
| chown chronos:chronos -R "${BROKER_SERVICE_SOCKET_DIR}" && \ |
| exit 0 |
| # Delay before retry. |
| sleep 1 |
| done |
| exit 1 |
| end script |