| # Copyright 2017 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 "Prepare for ippusb, after upstart-socket-bridge" |
| |
| start on started upstart-socket-bridge |
| |
| # Set the owners for the socket. Since the socket is created by |
| # upstart-socket-bridge based on the umask (755) we need to manually change it. |
| script |
| ippusb_socket="/run/ippusb/ippusb_manager.sock" |
| ippusb_group="ippusb" |
| ippusb_user="ippusb" |
| |
| # We want to retry, in case upstart-socket-bridge hasn't finished creating our |
| # socket for us yet. |
| n=0 |
| while [ $((n += 1)) -lt 10 ]; do |
| chown "${ippusb_user}":"${ippusb_group}" "${ippusb_socket}" && \ |
| chmod 770 "${ippusb_socket}" && exit 0 |
| sleep 1 |
| done |
| exit 1 |
| end script |