1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-19 03:52:17 +00:00
freebsd-ports/net-mgmt/mrtg/pkg-install
Dmitry Sivachenko 404872b681 Install rcNG script to run mrtg in daemon mode.
Submitted by:	Jan Srzednicki <w@expro.pl>
2006-02-06 12:24:19 +00:00

50 lines
785 B
Bash

#!/bin/sh
# $FreeBSD$
#
case "$2" in
PRE-INSTALL)
USER=mrtg
GROUP=${USER}
UID=279
GID=${UID}
if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then
if pw groupadd ${GROUP} -g ${GID}; 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} -u ${UID} -g ${GROUP} -h - \
-s "/sbin/nologin" -d "/nonexistent" \
-c "MRTG daemon"; \
then
echo "Added user \"${USER}\"."
else
echo "Adding user \"${USER}\" failed..."
exit 1
fi
fi
;;
POST-INSTALL)
rundir=/var/run/mrtg
if [ ! -d "$rundir" ]; then
mkdir -p $rundir
echo "Created directory: ${rundir}"
fi
chown -R mrtg:mrtg $rundir
chmod 0700 $rundir
;;
esac
exit 0