29b87cde37
Slim Devices SlimServer streams a variety of audio formats including MP3, Ogg, and FLAC to Squeezebox and SLIMP3 network players as well as most software players. PR: ports/65601 Submitted by: Brooks Davis <brooks@freebsd.org>
42 lines
883 B
Bash
42 lines
883 B
Bash
#!/bin/sh
|
|
# $FreeBSD$
|
|
|
|
u=slimserv
|
|
g=slimserv
|
|
ugid=104
|
|
homedir=/nonexistent
|
|
shell=/sbin/nologin
|
|
comment="Slim Devices SlimServer pseudo-user"
|
|
statedir=/var/db/slimserver
|
|
|
|
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
|
|
;;
|
|
esac
|