mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-17 03:25:46 +00:00
d2fe699014
- OPTIONS'ify - Use PORTDOCS - Remove 3 lines pkg-plist - Move dnrd.sh to dnrd.sh.in and use USE_RC_SUBR facility PR: ports/85744 [1] Submitted by: maintainer [1] Reworked by: myself Approved by: maintainer
43 lines
812 B
Bash
43 lines
812 B
Bash
#!/bin/sh
|
|
|
|
|
|
USER=${DNRDUSER:-dnrd}
|
|
GROUP=${USER}
|
|
SYSCONF_DIR=${SYSCONF_DIR:-${PKG_PREFIX}/etc/dnrd}
|
|
|
|
case $2 in
|
|
PRE-INSTALL)
|
|
if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then
|
|
if pw groupadd ${GROUP}; then
|
|
echo "Added group \"${GROUP}\"."
|
|
else
|
|
echo "Adding group \"${GROUP}\" failed..."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if ! pw usershow "${USER}" 2>/dev/null 1>&2; then
|
|
if pw useradd ${USER} -g ${GROUP} -h - \
|
|
-s "/sbin/nologin" -d "/var/empty" \
|
|
-c "DNRD daemon"; \
|
|
then
|
|
echo "Added user \"${USER}\"."
|
|
else
|
|
echo "Adding user \"${USER}\" failed..."
|
|
exit 1
|
|
fi
|
|
fi
|
|
;;
|
|
|
|
POST-INSTALL)
|
|
if [ ! -d ${SYSCONF_DIR} ]; then
|
|
mkdir -p ${SYSCONF_DIR}
|
|
if [ ! -d ${SYSCONF_DIR} ]; then
|
|
echo "Creating \"${SYSCONF_DIR}\" failed."
|
|
exit 1
|
|
fi
|
|
fi
|
|
;;
|
|
esac
|
|
exit 0
|