fa8a699877
Update to 2.0.r1 also includes: - Rewrite of port Makefile, options closer aligned in order to bsd.port.mk - Added dependency of libiconv (library required by CGI's, currently installed via nagios-plugins port) - Added support for embedded Perl interpreter (requires Perl 5.8+), caching automatically assumed if enabled, off by default - Added support for use of nanosleep() in event timings, off by default - Added ability to override default view at http://webserver/nagios/ URL, suggested values listed in Makefile (validity after future Nagios releases not guaranteed) - Default install location for web component moved to www/nagios, overridable using existing NAGIOSWWWDIR tunable - Corrected minor build issues by tweaking use of CFLAGS - Moved pkg-install, pkg-deinstall and pkg-message into SUB_FILES - Added configuration file tunable (nagios_configfile) for /etc/rc.conf - Configuration tests now show error on failure instead of command to run - Host status (status.sav) now saved across application starts and restarts - Added patch to correct PERL_SYS_INIT3 call in base/utils.c, patch supplied and tested by Karl Friesen <krf@splip.com>, thanks! - Added Apache configuration suggestion in pkg-message for new installs Files changed: - ports/net-mgmt/nagios/Makefile - ports/net-mgmt/nagios/distinfo - ports/net-mgmt/nagios/files/patch-Makefile.in - ports/net-mgmt/nagios/pkg-plist Files created: - ports/net-mgmt/nagios/files/nagios.sh.in - ports/net-mgmt/nagios/files/patch-base-utils.c - ports/net-mgmt/nagios/files/patch-contrib-Makefile.in - ports/net-mgmt/nagios/files/pkg-deinstall.in - ports/net-mgmt/nagios/files/pkg-install.in - ports/net-mgmt/nagios/files/pkg-message.in Files to be removed: - ports/net-mgmt/nagios/files/DEINSTALL.tmpl - ports/net-mgmt/nagios/files/INSTALL.tmpl - ports/net-mgmt/nagios/files/MESSAGE.tmpl - ports/net-mgmt/nagios/files/nagios.sh.tmpl PR: ports/91499 Submitted by: Jarrod Sayers <jarrod@netleader.com.au>
69 lines
1.6 KiB
Bash
69 lines
1.6 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
NAGIOSDIR=%%NAGIOSDIR%%
|
|
NAGIOSUSER=%%NAGIOSUSER%%
|
|
NAGIOSGROUP=%%NAGIOSGROUP%%
|
|
|
|
ask() {
|
|
local question default answer
|
|
|
|
question=$1
|
|
default=$2
|
|
if [ -z "${PACKAGE_BUILDING}" ]; then
|
|
read -p "${question} [${default}]? " answer
|
|
fi
|
|
if [ "x${answer}" = "x" ]; then
|
|
answer=${default}
|
|
fi
|
|
echo ${answer}
|
|
}
|
|
|
|
yesno() {
|
|
local default question answer
|
|
|
|
question=$1
|
|
default=$2
|
|
while :; do
|
|
answer=$(ask "${question}" "${default}")
|
|
case "${answer}" in
|
|
[Yy][Ee][Ss]|[Yy])
|
|
return 0
|
|
;;
|
|
[Nn][Oo]|[Nn])
|
|
return 1
|
|
;;
|
|
esac
|
|
echo "Please answer yes or no."
|
|
done
|
|
}
|
|
|
|
if [ "$2" = "PRE-INSTALL" ]; then
|
|
if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then
|
|
echo "You already have a \"${NAGIOSGROUP}\" group, so I will use it."
|
|
else
|
|
echo "You need a \"${NAGIOSGROUP}\" group."
|
|
if yesno "Would you like me to create it" "YES"; then
|
|
/usr/sbin/pw groupadd "${NAGIOSGROUP}" -h - || exit
|
|
echo "Done."
|
|
else
|
|
echo "Please create the \"${NAGIOSGROUP}\" group manually and try again."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if /usr/sbin/pw user show "${NAGIOSUSER}" 2>&1 >/dev/null; then
|
|
echo "You already have a \"${NAGIOSUSER}\" user, so I will use it."
|
|
else
|
|
echo "You need a \"${NAGIOSUSER}\" user."
|
|
if yesno "Would you like me to create it" "YES"; then
|
|
/usr/sbin/pw useradd "${NAGIOSUSER}" -g "${NAGIOSGROUP}" -h - -d "${NAGIOSDIR}" \
|
|
-s /sbin/nologin -c "Nagios pseudo-user" || exit
|
|
else
|
|
echo "Please create the \"${NAGIOSUSER}\" user manually and try again."
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|