#!/sbin/openrc-run name="JACK server" description="JACK server using a named profile" profile="${RC_SVCNAME#jackd.}" [ "$profile" = "$RC_SVCNAME" ] && profile="default" conf_file="/etc/jack/${profile}.conf" user_conf="/home/${SVCNAME_USER:-$profile}/.config/jack/${profile}.conf" command="/usr/bin/jackd" command_background="yes" pidfile="/run/${RC_SVCNAME}.pid" depend() { need localmount use alsasound dbus } start_pre() { if [ -f "$conf_file" ]; then . "$conf_file" elif [ -f "$user_conf" ]; then . "$user_conf" fi : "${JACK_OPTIONS:=}" : "${DRIVER:=alsa}" : "${DEVICE:=hw:0}" : "${DRIVER_SETTINGS:=}" command_args="$JACK_OPTIONS -d $DRIVER -d $DEVICE $DRIVER_SETTINGS" } start() { checkpath -d -m 0755 /run ulimit -r 95 || true ulimit -l unlimited || true ebegin "Starting ${RC_SVCNAME}" start-stop-daemon \ --start \ --background \ --make-pidfile \ --pidfile "$pidfile" \ --exec "$command" -- $command_args eend $? } stop() { ebegin "Stopping ${RC_SVCNAME}" start-stop-daemon --stop --pidfile "$pidfile" --retry TERM/5 eend $? }