| # 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 "Prepare for CUPS, after upstart-socket-bridge" |
| |
| start on started upstart-socket-bridge |
| |
| env CUPS_SOCKET=/run/cups/cups.sock |
| env lp_group=lp |
| |
| # HACK: Set permissions, since upstart-socket-bridge will create according to |
| # umask (i.e., 755), which means non-root users can't talk to cups... |
| script |
| set +e |
| output="$(chown root:${lp_group} "${CUPS_SOCKET}" 2>&1 && \ |
| chmod 770 "${CUPS_SOCKET}" 2>&1)" |
| if [ $? != 0 ]; then |
| logger -t "${UPSTART_JOB}" "Failed to modify cups socket: ${output}" |
| exit 1 |
| fi |
| end script |