freebsd-ports/audio/slimserver/pkg-install
Brooks Davis f13dcde71c Various enhancements and fixes for slimserver:
- Use a new system to track which files in the CPAN directory should be
   installed.  As a side effect, generate most of the RUN_DEPENDS list
   at runtime.
 - Add a script to start softsqueeze.  The javavm port and a Jave VM
   must be installed to the script to actually work.  A dependency was
   not added at this point because that's a huge barrier.
 - Fix a bug in EXCEPTFILES processing.
 - Patch the configuration parsing code to default the cache and
   playlist directories to locations under /var/db/slimserver instead
   of the weird defaults.  This will fix the cache on new installs. [0]
 - Bump port revision.

Reported by:	Kraig Vander Berg <kraig at woodshoes dot net> [0]
2004-12-31 00:17:05 +00:00

66 lines
1.6 KiB
Bash

#!/bin/sh
# $FreeBSD$
name=slimserver
u=slimserv
g=slimserv
ugid=104
homedir=/nonexistent
shell=/sbin/nologin
comment="Slim Devices SlimServer pseudo-user"
statedir=/var/db/slimserver
cachedir=${statedir}/cache
playlistdir=${statedir}/playlists
pidfile=/var/run/${name}.pid
newsyslogfile=/etc/newsyslog.conf
logfile=/var/log/slimserver.log
logcomment="# added by audio/slimserver port"
logline="${logfile} ${u}:${g} 644 3 100 * Z ${pidfile}"
case $2 in
PRE-INSTALL)
if pw group show "${g}" >/dev/null 2>&1; then
echo "Using existing group \"${g}\"."
else
echo "Creating group \"${g}\", (gid: ${ugid})."
pw groupadd ${g} -g ${ugid}
if [ $? != 0 ]; then
echo "Failed to add group \"${g}\"."
exit 1
fi
fi
if pw user show "${u}" >/dev/null 2>&1; then
echo "Using existing user \"${u}\"."
else
echo "Creating user \"${u}\", (uid: ${ugid})."
pw useradd ${u} -u ${ugid} -g ${ugid} -h - \
-d ${homedir} -s ${shell} -c "${comment}"
if [ $? != 0 ]; then
echo "Failed to add user \"${u}\"."
exit 1
fi
fi
;;
POST-INSTALL)
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 egrep -q "^${logfile}\>" ${newsyslogfile}; then
echo "Using existing ${newsyslogfile} entry."
else
echo "Adding slimserver log entry to ${newsyslogfile}."
echo "$logcomment" >> ${newsyslogfile}
echo "$logline" >> ${newsyslogfile}
fi
;;
esac