OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 description "Run pulseaudio when the system starts" |
| 6 author "chromium-os-dev@googlegroups.com" |
| 7 |
| 8 start on started syslog |
| 9 stop on starting halt |
| 10 respawn |
| 11 |
| 12 env USERNAME=chronos |
| 13 env XAUTHORITY=/home/chronos/.Xauthority |
| 14 env DISPLAY=:0.0 |
| 15 # TODO(ajwong): pulseaudio wants CAP_NICE. Readd --use-capabilities after |
| 16 # resolving that dependency. |
| 17 env MINIJAIL_FLAGS="" |
| 18 env PULSEAUDIO_FIRST_RUN=/tmp/pulseaudio-first-run |
| 19 env PULSE_STATE_PATH=/home/chronos/.pulse |
| 20 env PULSE_RUNTIME_PATH=/var/run/pulse |
| 21 env USER_ID=1000 |
| 22 |
| 23 pre-start script |
| 24 # Signal whether or not we need to do initial configuration of pulseaudio. |
| 25 if [ -d ${PULSE_STATE_PATH} ]; then |
| 26 rm -f "${PULSEAUDIO_FIRST_RUN}" |
| 27 else |
| 28 # Try to clean out any bad cruft at this directory, just incase. |
| 29 rm -rf "${PULSE_STATE_PATH}" |
| 30 touch "${PULSEAUDIO_FIRST_RUN}" |
| 31 fi |
| 32 end script |
| 33 |
| 34 script |
| 35 # Create pulseaudio runtime directory for pulseaudio's pidfile and socket. |
| 36 mkdir -p "${PULSE_RUNTIME_PATH}" |
| 37 chown -R chronos:chronos "${PULSE_RUNTIME_PATH}" |
| 38 |
| 39 if [ -f "${PULSEAUDIO_FIRST_RUN}" ] ; then |
| 40 # Clean up the first-run signal file. |
| 41 rm -f "${PULSEAUDIO_FIRST_RUN}" |
| 42 exec /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \ |
| 43 /usr/bin/pulseaudio -F /etc/pulse/firstrun.pa |
| 44 else |
| 45 exec /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \ |
| 46 /usr/bin/pulseaudio |
| 47 fi |
| 48 end script |
OLD | NEW |