/etc/init.d/roaraudio is in roaraudio 1.0~beta11-7.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | #!/bin/sh
# roaraudio initscript
#
# Copyright (c) 2008-2012 Philipp 'ph3-der-loewe' Schafft <lion@lion.leolix.org>
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3,
# or (at your option) any later version.
#
# This is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License with
# the Debian operating system, in /usr/share/common-licenses/GPL; if
# not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
#
### BEGIN INIT INFO
# Provides: roaraudio
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $network $local_fs $remote_fs $syslog
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: sound server for audio mixing
# Description: RoarAudio is a server for audio mixing. Its main purpose is to mix audio from
# different clients before sending it to its outputs (for example a soundcard).
# It is completely network transparent (UNIX sockets, TCP/IP, DECnet) and
# supports many common codecs like Ogg Vorbis, Speex or FLAC.
### END INIT INFO
#set -e
. /lib/lsb/init-functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/roard
ROARCTL=/usr/bin/roarctl
NAME=roaraudio
DESC="RoarAudio"
DAEMON_BN=`basename $DAEMON`
PIDFILE=/var/run/$DAEMON_BN.pid
SCRIPTNAME=/etc/init.d/$NAME
USER_LIST="$DAEMON_BN roard roar nobody";
# List of files to chown to the daemon user
CHOWN_LIST=''
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0;
# Read config file if it is present.
if [ -r /etc/default/$NAME ]
then
. /etc/default/$NAME
fi
if [ "$ROARAUDIO_DEFAULT_SOCKET" != '' ]
then
ln -s "$ROARAUDIO_DEFAULT_SOCKET" /etc/roarserver
fi
ROARD_OPTS="--log-syslog --daemon $ROARD_OPTS"
[ "$PIDFILE" = '' ] || ROARD_OPTS="--pidfile $PIDFILE $ROARD_OPTS"
[ "$ROARD_REALTIME" = 'YES' ] && ROARD_OPTS="--realtime $ROARD_OPTS"
[ "$ROARD_REALTIME" = 'DOUBLE' ] && ROARD_OPTS="--realtime --realtime $ROARD_OPTS"
[ "$ROARD_LOCATION" = '' ] || ROARD_OPTS="--location '$ROARD_LOCATION' $ROARD_OPTS"
[ "$ROARD_DESCRIPTION" = '' ] || ROARD_OPTS="--description '$ROARD_DESCRIPTION' $ROARD_OPTS"
[ "$ROARD_CONTACT" = '' ] || ROARD_OPTS="--contact '$ROARD_CONTACT' $ROARD_OPTS"
[ "$ROARD_SERIAL" = '' ] || ROARD_OPTS="--serial '$ROARD_SERIAL' $ROARD_OPTS"
[ "$ROARD_UIURL" = '' ] || ROARD_OPTS="--uiurl '$ROARD_UIURL' $ROARD_OPTS"
[ "$ROARD_SOCKET" = '' ] || ROARD_OPTS="--sock $ROARD_SOCKET $ROARD_OPTS"
[ "$ROARD_PORT" = '' ] || ROARD_OPTS="--port $ROARD_PORT $ROARD_OPTS"
if [ "$ROARD_OBJECT" = '' ]
then
[ "$ROARD_HOST" = '' ] || ROARD_OPTS="--bind $ROARD_HOST $ROARD_OPTS"
else
ROARD_OPTS="--sock $ROARD_HOST::$ROARD_OBJECT $ROARD_OPTS"
fi
case "$ROARD_AF" in
UNIX|unix)
ROARD_OPTS="-u $ROARD_OPTS"
;;
TCP|tcp)
ROARD_OPTS="-t $ROARD_OPTS"
;;
DECnet|DECNET|decnet)
ROARD_OPTS="-n $ROARD_OPTS"
;;
esac
ESD_OPTS=''
case "$ROARD_EMUL_ESD_AF" in
UNIX|unix)
ROARD_PROFILES="esd-unix $ROARD_PROFILES"
mkdir /tmp/.esd/ 2> /dev/null;
CHOWN_LIST="$CHOWN_LIST /tmp/.esd/"
;;
TCP|tcp)
_host='localhost';
[ "$ROARD_HOST" = '' ] || _host="$ROARD_HOST"
ESD_OPTS="--new-sock --proto esd -t -b $_host -p 16001"
;;
esac
RSOUND_OPTS=''
case "$ROARD_EMUL_RSOUND_AF" in
UNIX|unix)
ROARD_PROFILES="rsound-unix $ROARD_PROFILES"
;;
TCP|tcp)
_host='localhost';
[ "$ROARD_HOST" = '' ] || _host="$ROARD_HOST"
RSOUND_OPTS="--new-sock --proto rsound -t -b $_host -p 12345"
;;
DECnet|DECNET|decnet)
ROARD_PROFILES="rsound-dnet $ROARD_PROFILES"
;;
esac
if [ "$ROARD_PROFILES" != '' ]
then
_p=`echo "$ROARD_PROFILES" | sed 's/ */ --new-sock --proto-profile /g'`
ROARD_OPTS="$ROARD_OPTS --new-sock --proto-profile $_p"
fi
[ "$ROARD_SLP" = 'YES' ] && ROARD_OPTS="--slp $ROARD_OPTS"
[ "$ROARD_RATE" = '' ] || ROARD_OPTS="-R $ROARD_RATE $ROARD_OPTS"
[ "$ROARD_CHANNEL" = '' ] || ROARD_OPTS="-C $ROARD_CHANNEL $ROARD_OPTS"
[ "$ROARD_BITS" = '' ] || ROARD_OPTS="-B $ROARD_BITS $ROARD_OPTS"
[ "$ROARD_AIPROFILE" = '' ] || ROARD_OPTS="--aiprofile $ROARD_AIPROFILE $ROARD_OPTS"
[ "$ROARD_DRIVER" = '' ] || ROARD_OPTS="-o $ROARD_DRIVER $ROARD_OPTS"
[ "$ROARD_DEVICE" = '' ] || ROARD_OPTS="-O $ROARD_DEVICE $ROARD_OPTS"
[ "$ROARD_DRIVER_OPTIONS" = '' ] && ROARD_DRIVER_OPTIONS='sync,autoconf'
ROARD_OPTS="-oP -oO $ROARD_DRIVER_OPTIONS $ROARD_OPTS"
[ "$ROARD_MIXERDRV" = '' ] || ROARD_OPTS="-m $ROARD_MIXERDRV $ROARD_OPTS"
[ "$ROARD_MIXERDEV" = '' ] || ROARD_OPTS="-M $ROARD_MIXERDEV $ROARD_OPTS"
[ "$ROARD_MIXER_OPTIONS" = '' ] || ROARD_OPTS="-mO $ROARD_MIXER_OPTIONS $ROARD_OPTS"
[ "$ROARD_SOURCE_RADIONOISE" = 'YES' ] && ROARD_OPTS="-s radionoise $ROARD_OPTS"
for _p in $ROARD_ROLESTACK
do
ROARD_OPTS="--rolestack-push $_p $ROARD_OPTS"
done
for _p in $ROARD_PLUGINS
do
ROARD_OPTS="--plugin-load $_p $ROARD_OPTS"
done
[ "$ROARD_ACCLEV_GUEST" = '' ] || ROARD_OPTS="--guest-acclev $ROARD_ACCLEV_GUEST $ROARD_OPTS"
[ "$ROARD_ACCLEV_TRUST" = '' ] || ROARD_OPTS="--trust-acclev $ROARD_ACCLEV_TRUST $ROARD_OPTS"
[ "$ROARD_AUTHFILE_FILENAME" = '' ] || ROARD_OPTS="--authfile-gen $ROARD_AUTHFILE_FILENAME $ROARD_OPTS"
[ "$ROARD_AUTHFILE_TYPE" = '' ] || ROARD_OPTS="--authfile-type $ROARD_AUTHFILE_TYPE $ROARD_OPTS"
[ "$ROARD_AUTHFILE_ACCLEV" = '' ] || ROARD_OPTS="--authfile-acclev $ROARD_AUTHFILE_ACCLEV $ROARD_OPTS"
if [ "$ROARD_USER" = '' ]
then
for _u in $USER_LIST
do
_r=`id -un $_u 2> /dev/null`
if [ "$_u" = "$_r" ]
then
ROARD_USER="$_u";
break;
fi
done
else
_r=`id -un "$ROARD_USER" 2> /dev/null`
if [ "$_r" != "$ROARD_USER" ]
then
echo "Error starting RoarAudio: can not find configured user $ROARD_USER" >&2
echo "Hint: re-configure user in /etc/default/$NAME (see ROARD_USER)" >&2
exit 1;
fi
fi
if [ "$ROARD_USER" = '' ]
then
echo "Error starting RoarAudio: can not find any user to run roard as." >&2
echo "Hint: configure user in /etc/default/$NAME explicitly (see ROARD_USER)" >&2
exit 1;
else
ROARD_OPTS="--setuid -U $ROARD_USER $ROARD_OPTS"
fi
ROARD_OPTS="--setgid $ROARD_OPTS"
[ "$ROARD_GROUP" = '' ] || ROARD_OPTS="-G $ROARD_GROUP $ROARD_OPTS"
[ "$ROARD_CHROOT" = '' ] || ROARD_OPTS="--chroot $ROARD_CHROOT $ROARD_OPTS"
ROARD_OPTS="$ROARD_OPTS $ESD_OPTS $RSOUND_OPTS"
for _p in $CHOWN_LIST
do
chown "$ROARD_USER":"$ROARD_GROUP" "$_p"
done
set -e
case "$1" in
start)
[ "$ROARD" = 'YES' ] || exit 0;
echo -n "Starting $DESC: "
$DAEMON --start $ROARD_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
set +e
if [ "$PIDFILE" != '' ]
then
PID=`cat $PIDFILE 2> /dev/null`
if [ "$PID" != '' ]
then
kill -0 $PID 2> /dev/null
if [ "$?" != '0' ]
then
exit 0;
fi
else
exit 0;
fi
fi
$DAEMON --stop $ROARD_OPTS
echo "$NAME."
set -e
;;
status)
echo -n "Status of $DESC: "
set +e
if [ "$PIDFILE" != '' ]
then
PID=`cat $PIDFILE 2> /dev/null`
if [ "$PID" != '' ]
then
kill -0 $PID 2> /dev/null
if [ "$?" = '0' ]
then
echo "running."
exit 0;
else
echo "dead (stale pid file)."
exit 1;
fi
else
echo "not running."
exit 3;
fi
fi
set -e
echo "unknown (no pid file configured)."
exit 4
;;
restart|force-reload)
[ "$ROARD" = 'YES' ] || exec $0 stop
echo -n "Restarting $DESC: "
$DAEMON --restart $ROARD_OPTS
echo "$NAME."
;;
terminate|shutdown)
echo -n "Terminating $DESC: "
$DAEMON --shutdown $ROARD_OPTS
echo "$NAME."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|terminate|shutdown|status}" >&2
exit 1
;;
esac
exit 0
|