ports/audio/squeezecenter/files/squeezecenter.sh.in
Brooks Davis af5ef7aea3 Upgrade to 6.0.1.
Stop trying to use ports versions of all the CPAN bits and do things the way
the vendor expects.  It's less elegant, but much easier to maintain.  Do build
our own versions of binary modules so we have a chance on all platforms, but
use a slightly modified version of their script to do so (mostly make it
non interactive and fetch the files from DISTDIR/DIST_SUBDIR rather
than direct from slimdevices each build).

Mark RESTRICTED.  The distfiles and the build contain non-restributable bits.
Some of the people building packages for linux are working on a way around
this (not distributing the firmware and using alternate images), but that's
no here yet.

Nagged by:	many :-)
Prodded by:	my dying cd player
2005-04-21 05:17:02 +00:00

91 lines
1.9 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: slimserver
# REQUIRE: LOGIN
# KEYWORD: FreeBSD shutdown
#
# Add the following lines to /etc/rc.conf to enable slimserver:
#
#slimserver_enable="YES"
#
. %%RC_SUBR%%
name=slimserver
start_precmd="slimserver_start_precmd"
stop_cmd="slimserver_stop"
rcvar=`set_rcvar`
command=%%PREFIX%%/%%SLIMDIR%%/slimserver.pl
pidfile=/var/run/slimserver/${name}.pid
logfile=/var/log/slimserver.log
statedir=/var/db/slimserver
cachedir=${statedir}/cache
playlistdir=${statedir}/playlists
conffile=${statedir}/slimserver.conf
u=slimserv
g=slimserv
command_args="--daemon --prefsfile=${conffile} --logfile=${logfile} --user=${u} --group=${g} --pidfile=${pidfile}"
PGREP=%%PGREPBASE%%/bin/pgrep
slimserver_start_precmd()
{
if [ ! -d ${statedir} ]; then
mkdir -p ${statedir}
chown -R ${u}:${g} ${statedir}
fi
if [ ! -d ${cachedir} ]; then
mkdir -p ${cachedir}
chown -R ${u}:${g} ${cachedir}
fi
if [ ! -d ${playlistdir} ]; then
mkdir -p ${playlistdir}
chown -R ${u}:${g} ${playlistdir}
fi
if [ ! -d /var/run/slimserver ]; then
mkdir -p /var/run/slimserver
chown -R ${u}:${g} /var/run/slimserver
fi
if [ ! -f ${conffile} ]; then
touch ${conffile}
chown ${u}:${g} ${conffile}
fi
if [ ! -f ${logfile} ]; then
touch ${logfile}
chown ${u}:${g} ${logfile}
fi
}
slimserver_stop()
{
if [ ! -f ${pidfile} ]; then
exit
fi
echo 'Stopping SlimServer.'
rc_pid=`cat ${pidfile}`
rc_pid=`${PGREP} -u ${u} | grep ${rc_pid}`
if [ -n "${rc_pid}" ]; then
# Should be mDNSResponderPosix, but the port truncates
rc_pids="${rc_pid} `${PGREP} -u ${u} mDNSResponderPos`"
kill $sig_stop $rc_pids
wait_for_pids $rc_pids
else
echo "${name} not running? (check ${pidfile})"
fi
rm -f ${pidfile}
}
# set defaults
slimserver_enable=${slimserver_enable:-"NO"}
slimserver_flags=${slimserver_flags:-""}
load_rc_config ${name}
run_rc_command "$1"