mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-23 00:43:28 +00:00
37e5012591
PR: ports/137507 Submitted by: J. Kelly Hays <kelly.hays@jkhfamily.org> (maintainer)
55 lines
997 B
Bash
55 lines
997 B
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
PW=/usr/sbin/pw
|
|
UID=242
|
|
GID=$UID
|
|
USER="prosody"
|
|
GROUP="prosody"
|
|
PREFIX="%%PREFIX%%"
|
|
|
|
case $2 in
|
|
|
|
PRE-INSTALL)
|
|
|
|
if ${PW} group show "${GROUP}" 2>/dev/null; then
|
|
echo "You already have a group \"${GROUP}\", so I will use it."
|
|
else
|
|
if ${PW} groupadd ${GROUP} -g ${GID}; then
|
|
echo "Added group \"${GROUP}\"."
|
|
else
|
|
echo "Adding group \"${GROUP}\" failed..."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if ${PW} user show "${USER}" 2>/dev/null; then
|
|
echo "You already have a user \"${USER}\", so I will use it."
|
|
else
|
|
if ${PW} useradd ${USER} -u ${UID} -g daemon -h - \
|
|
-d "/nonexistent" -s /usr/sbin/nologin -c "Prosody XMPP Server"
|
|
then
|
|
echo "Added user \"${USER}\"."
|
|
else
|
|
echo "Adding user \"${USER}\" failed..."
|
|
exit 1
|
|
fi
|
|
fi
|
|
;;
|
|
|
|
POST-INSTALL)
|
|
chown "${USER}:${GROUP}" $PREFIX/var/lib/prosody
|
|
for file in `find $PREFIX/etc/prosody -type f`; do
|
|
if [ ! -s "${file%.sample}" ]; then
|
|
cp -p $file ${file%.sample}
|
|
fi
|
|
done
|
|
;;
|
|
*)
|
|
echo "?"
|
|
;;
|
|
esac
|
|
exit 0
|