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