#!/bin/sh ### # Place the PulseAudio init script. ### config() { NEW="$1" OLD="`dirname $NEW`/`basename $NEW .new`" # If there's no config file by that name, mv it over: if [ ! -r $OLD ]; then mv $NEW $OLD elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy rm $NEW fi # Otherwise, we leave the .new copy for the admin to consider... } # Prepare pulse system files. config etc/pulse/client.conf.new config etc/pulse/daemon.conf.new config etc/pulse/default.pa.new config etc/pulse/system.pa.new ### # Create pulse:user and group if thet don't exist. ### group_exists=`grep ^pulse etc/group` if [[ "${group_exists}" == "" ]]; then groupadd -g 216 pulse fi user_exists=`grep ^pulse etc/passwd` if [[ "${user_exists}" == "" ]]; then useradd -c "PulseAudio User" -d /var/run/pulse -u 216 -g pulse -G audio -s /bin/false pulse fi # Add root to the pulse group usermod -a -G pulse root # Fix permissions. group_exists=$(grep ^pulse etc/group) user_exists=$(grep ^pulse etc/passwd) if [ x"${user_exists}" != x"" -a x"${group_exists}" != x"" ]; then chown pulse.pulse /var/run/pulse &>/dev/null else echo "Warning: user/group 'pulse' do not exist!" echo " Cannot set permissions for /var/run/pulse." fi