Browse Source

Mostly changes for OpenBSD + a couple minor changes

John C. Frickson 9 years ago
parent
commit
f0dc578ad8

+ 13 - 8
Makefile.in

@@ -93,7 +93,7 @@ install-inetd:
 		exit 1; \
 	fi
 	@if test $(INETD_TYPE) = inetd; then \
-		$(EGREP) -q "^\W*nrpe\s+" $(INETD_DIR)/$(INETD_FILE) || \
+		$(EGREP) -q "^\W*nrpe\s+" $(INETD_DIR)/$(INETD_FILE) 2>/dev/null || \
 		   cat startup/$(SRC_INETD) >> $(INETD_DIR)/$(INETD_FILE); \
 	elif test $(INETD_TYPE) = systemd; then \
 		SRC_INETD_FILE=`echo "$(SRC_INETD)" | sed -e 's/socket/socket-svc/'`; \
@@ -129,8 +129,8 @@ install-init:
 		echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		$(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 	elif test $(INIT_TYPE) = smf10 -o $(INIT_TYPE) = smf11; then \
-		echo $(INSTALL) -m 775 -g sys -d $(INETD_DIR);\
-		$(INSTALL) -m 775 -g sys -d $(INITD_DIR);\
+		echo $(INSTALL) -m 775 -g sys -d $(INIT_DIR);\
+		$(INSTALL) -m 775 -g sys -d $(INIT_DIR);\
 		echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		$(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		echo svccfg import $(INIT_DIR)/$(INIT_FILE); \
@@ -140,8 +140,13 @@ install-init:
 		echo $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		$(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		if test $(INIT_TYPE) = newbsd; then\
-			echo "nrpe@bsd_enable@=YES" >> /etc/rc.conf;\
-			echo "nrpe_configfile=$(CFGDIR)/nrpe.cfg" >> /etc/rc.conf;\
+			if test $(DIST) = openbsd; then\
+				echo "# nrpe@bsd_enable@=NO" >> /etc/rc.conf;\
+				echo "nrpe@bsd_enable@=\"-d -c $(CFGDIR)/nrpe.cfg\"" >> /etc/rc.conf;\
+			else\
+				echo "nrpe@bsd_enable@=YES" >> /etc/rc.conf;\
+				echo "nrpe_configfile=$(CFGDIR)/nrpe.cfg" >> /etc/rc.conf;\
+			fi;\
 		fi;\
 	fi
 
@@ -176,9 +181,9 @@ distclean: clean
 	rm -f startup/bsd-init startup/debian-init startup/default-init startup/default-inetd
 	rm -f startup/default-service startup/default-socket startup/default-socket-svc
 	rm -f startup/default-xinetd startup/mac-org.nagios.PKG_NAME.plist startup/newbsd-init
-	rm -f startup/openrc-conf startup/openrc-init startup/rh-upstart-init
-	rm -f startup/solaris-init.xml startup/solaris-inetd.xml startup/tmpfile.conf
-	rm -f startup/upstart-init
+	rm -f startup/openbsd-init startup/openrc-conf startup/openrc-init
+	rm -f startup/rh-upstart-init startup/solaris-init.xml startup/solaris-inetd.xml
+	rm -f startup/tmpfile.conf startup/upstart-init
 	rm -f Makefile
 
 devclean: distclean

+ 2 - 2
build-aux/add_group_user

@@ -64,7 +64,7 @@ add_user(){
 			rc=`pw add user $uid -g $gid -s /usr/bin/false; echo $?`
 			;;
 
-		netbsd)
+		netbsd|openbsd)
 			echo useradd -g $gid $uid > /dev/stderr
 			rc=`useradd -g $gid $uid; echo $?`
 			;;
@@ -112,7 +112,7 @@ add_group(){
 			rc=`pw add group $gid; echo $?`
 			;;
 
-		netbsd)
+		netbsd|openbsd)
 			echo groupadd $gid > /dev/stderr
 			rc=`groupadd $gid; echo $?`
 			;;

+ 5 - 3
build-aux/ax_nagios_get_files

@@ -70,12 +70,14 @@ AS_CASE([$init_type],
 	[newbsd],
 		if test $dist_type = freebsd ; then
 			bsd_enable="_enable"
+			src_init=newbsd-init
 		elif test $dist_type = openbsd ; then
 			bsd_enable="_flags"
+			src_init=openbsd-init
 		elif test $dist_type = netbsd ; then
 			bsd_enable=""
-		fi
-		src_init=newbsd-init,
+			src_init=newbsd-init
+		fi,
 
 #	[gentoo],
 
@@ -107,7 +109,7 @@ AC_MSG_CHECKING(for which inetd files to use )
 if test x$src_inetd = x; then
 
 	AS_CASE([$inetd_type],
-		[inetd],
+		[inetd*],
 			src_inetd=default-inetd,
 
 		[xinetd],

+ 1 - 1
build-aux/ax_nagios_get_inetd

@@ -119,7 +119,7 @@ AC_DEFUN([AX_NAGIOS_GET_INETD],
 				if test -f /etc/xinetd.conf -a -d /etc/xinetd.d; then
 					inetd_disabled="(Not running)"
 					inetd_type=xinetd
-				elif test -f /etc/inetd.conf; then
+				elif test -f /etc/inetd.conf -o -f /usr/sbin/inetd; then
 					inetd_type=inetd
 					inetd_disabled="(Not running)"
 				fi

+ 1 - 4
build-aux/ax_nagios_get_paths

@@ -217,9 +217,6 @@ if test $install_method = "default"; then
 		if test x"$prefix" = "xNONE"; then prefix=${ac_default_prefix}; fi
 	fi
 	datarootdir=${datarootdir="$prefix"}
-	if test "$prefix" = /opt; then prefix="/opt/nagios"
-	elif test "$prefix" = /opt/local; then prefix="/opt/local/nagios"
-	fi
 
 elif test $install_method = "opt"; then
 	if test x"$prefix" = "xNONE"; then prefix="/opt/nagios"; fi
@@ -683,7 +680,7 @@ AS_CASE([$init_type],
 # Inetd (per connection) scripts/files
 #
 AS_CASE([$inetd_type],
-	[inetd],
+	[inetd*],
 		inetddir=${inetddir="/etc"}
 		inetdname=${inetdname="inetd.conf"},
 

+ 15 - 10
configure

@@ -3058,7 +3058,7 @@ esac
 				if test -f /etc/xinetd.conf -a -d /etc/xinetd.d; then
 					inetd_disabled="(Not running)"
 					inetd_type=xinetd
-				elif test -f /etc/inetd.conf; then
+				elif test -f /etc/inetd.conf -o -f /usr/sbin/inetd; then
 					inetd_type=inetd
 					inetd_disabled="(Not running)"
 				fi
@@ -3291,9 +3291,6 @@ if test $install_method = "default"; then
 		if test x"$prefix" = "xNONE"; then prefix=${ac_default_prefix}; fi
 	fi
 	datarootdir=${datarootdir="$prefix"}
-	if test "$prefix" = /opt; then prefix="/opt/nagios"
-	elif test "$prefix" = /opt/local; then prefix="/opt/local/nagios"
-	fi
 
 elif test $install_method = "opt"; then
 	if test x"$prefix" = "xNONE"; then prefix="/opt/nagios"; fi
@@ -3753,7 +3750,7 @@ esac
 # Inetd (per connection) scripts/files
 #
 case $inetd_type in #(
-  inetd) :
+  inetd*) :
     inetddir=${inetddir="/etc"}
 		inetdname=${inetdname="inetd.conf"} ;; #(
   xinetd) :
@@ -3814,12 +3811,14 @@ case $init_type in #(
   newbsd) :
     if test $dist_type = freebsd ; then
 			bsd_enable="_enable"
+			src_init=newbsd-init
 		elif test $dist_type = openbsd ; then
 			bsd_enable="_flags"
+			src_init=openbsd-init
 		elif test $dist_type = netbsd ; then
 			bsd_enable=""
-		fi
-		src_init=newbsd-init ;; #(
+			src_init=newbsd-init
+		fi ;; #(
   #	[gentoo],
 
 	openrc) :
@@ -3851,7 +3850,7 @@ $as_echo_n "checking for which inetd files to use ... " >&6; }
 if test x$src_inetd = x; then
 
 	case $inetd_type in #(
-  inetd) :
+  inetd*) :
     src_inetd=default-inetd ;; #(
   xinetd) :
     src_inetd=default-xinetd ;; #(
@@ -4963,7 +4962,7 @@ fi
 
 ac_config_headers="$ac_config_headers include/config.h"
 
-ac_config_files="$ac_config_files Makefile src/Makefile package/solaris/Makefile nrpe.spec uninstall sample-config/nrpe.cfg startup/bsd-init startup/debian-init startup/default-init startup/default-inetd startup/default-service startup/default-socket startup/default-socket-svc startup/default-xinetd startup/mac-org.nagios.PKG_NAME.plist startup/newbsd-init startup/openrc-conf startup/openrc-init startup/solaris-init.xml startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init startup/rh-upstart-init"
+ac_config_files="$ac_config_files Makefile src/Makefile package/solaris/Makefile nrpe.spec uninstall sample-config/nrpe.cfg startup/bsd-init startup/debian-init startup/default-init startup/default-inetd startup/default-service startup/default-socket startup/default-socket-svc startup/default-xinetd startup/mac-org.nagios.PKG_NAME.plist startup/newbsd-init startup/openbsd-init startup/openrc-conf startup/openrc-init startup/solaris-init.xml startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init startup/rh-upstart-init"
 
 
 ac_ext=c
@@ -7370,7 +7369,12 @@ $as_echo_n "checking for SSL libraries... " >&6; }
 					/opt/openssl/lib/pa20_64 /opt/openssl/lib/hpux32 \
 					/opt/openssl/lib /opt/openssl; do
 			ssllibdir="$dir"
-			if test -f "$dir/libssl.$soext"; then
+			if test "$dist_type" = "openbsd"; then
+				if test -f $dir/libssl.$soext*; then
+					found_ssl=yes
+					break
+				fi
+			elif test -f "$dir/libssl.$soext"; then
 				found_ssl=yes
 				break
 			fi
@@ -8254,6 +8258,7 @@ do
     "startup/default-xinetd") CONFIG_FILES="$CONFIG_FILES startup/default-xinetd" ;;
     "startup/mac-org.nagios.PKG_NAME.plist") CONFIG_FILES="$CONFIG_FILES startup/mac-org.nagios.PKG_NAME.plist" ;;
     "startup/newbsd-init") CONFIG_FILES="$CONFIG_FILES startup/newbsd-init" ;;
+    "startup/openbsd-init") CONFIG_FILES="$CONFIG_FILES startup/openbsd-init" ;;
     "startup/openrc-conf") CONFIG_FILES="$CONFIG_FILES startup/openrc-conf" ;;
     "startup/openrc-init") CONFIG_FILES="$CONFIG_FILES startup/openrc-init" ;;
     "startup/solaris-init.xml") CONFIG_FILES="$CONFIG_FILES startup/solaris-init.xml" ;;

+ 7 - 1
configure.ac

@@ -121,6 +121,7 @@ AC_CONFIG_FILES([Makefile
 	startup/default-xinetd
 	startup/mac-org.nagios.PKG_NAME.plist
 	startup/newbsd-init
+	startup/openbsd-init
 	startup/openrc-conf
 	startup/openrc-init
 	startup/solaris-init.xml
@@ -423,7 +424,12 @@ if test x$check_for_ssl = xyes; then
 					/opt/openssl/lib/pa20_64 /opt/openssl/lib/hpux32 \
 					/opt/openssl/lib /opt/openssl; do
 			ssllibdir="$dir"
-			if test -f "$dir/libssl.$soext"; then
+			if test "$dist_type" = "openbsd"; then
+				if test -f $dir/libssl.$soext*; then
+					found_ssl=yes
+					break
+				fi
+			elif test -f "$dir/libssl.$soext"; then
 				found_ssl=yes
 				break
 			fi

+ 18 - 0
startup/openbsd-init.in

@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+#
+
+daemon="@sbindir@/nrpe"
+
+. /etc/rc.d/rc.subr
+
+rc_pre() {
+	install -d -o @nrpe_user@ ${pidfile%/*}
+}
+
+rc_reload() {
+	pkill -HUP -xf "${pexp}"
+}
+
+rc_cmd "$1"