1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-21 04:06:46 +00:00
freebsd-ports/audio/slimserver/pkg-install
Brooks Davis b02588533d Upgrade to 5.2.1 which is mostly a bugfix release. I've commited a
modified version of the submitted patch.

Submitted by:	Patric.Guelat at imp.ch
2004-08-21 17:44:06 +00:00

60 lines
1.4 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
pidfile=/var/run/${name}.pid
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 egrep -q "^${logfile}\>" /etc/newsyslog.conf; then
echo "Using existing /etc/newsyslog.conf entry."
else
echo "Adding slimserver log entry to /etc/newsyslog.conf."
echo "$logcomment" >> /etc/newsyslog.conf
echo "$logline" >> /etc/newsyslog.conf
fi
;;
esac