Browse Source

Some changes for FreeBSD

John C. Frickson 9 years ago
parent
commit
33e70b9474
3 changed files with 16 additions and 22 deletions
  1. 5 1
      Makefile.in
  2. 2 2
      build-aux/add_group_user
  3. 9 19
      startup/newbsd-init.in

+ 5 - 1
Makefile.in

@@ -128,7 +128,7 @@ install-init:
 	elif test $(INIT_TYPE) = systemd; then\
 	elif test $(INIT_TYPE) = systemd; then\
 		echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		$(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		$(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
-	elif test $(INETD_TYPE) = smf10 -o $(INETD_TYPE) = smf11; then \
+	elif test $(INIT_TYPE) = smf10 -o $(INIT_TYPE) = smf11; then \
 		echo $(INSTALL) -m 775 -g sys -d $(INETD_DIR);\
 		echo $(INSTALL) -m 775 -g sys -d $(INETD_DIR);\
 		$(INSTALL) -m 775 -g sys -d $(INITD_DIR);\
 		$(INSTALL) -m 775 -g sys -d $(INITD_DIR);\
 		echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
@@ -139,6 +139,10 @@ install-init:
 	else\
 	else\
 		echo $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		echo $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		$(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 "*** Add 'nrpe_enable=\"YES\"' and";\
+			echo "    set 'nrpe_configfile' in /etc/rc.conf";\
+		fi;\
 	fi
 	fi
 
 
 install-config:
 install-config:

+ 2 - 2
build-aux/add_group_user

@@ -60,8 +60,8 @@ add_user(){
 			;;
 			;;
 
 
 		freebsd)
 		freebsd)
-			echo pw add user -g $gid $uid > /dev/stderr
-			rc=`pw add user -g $gid $uid; echo $?`
+			echo pw add user $uid -g $gid -s /usr/bin/false > /dev/stderr
+			rc=`pw add user $uid -g $gid -s /usr/bin/false; echo $?`
 			;;
 			;;
 
 
 		*)
 		*)

+ 9 - 19
startup/newbsd-init.in

@@ -11,7 +11,6 @@
 #
 #
 # nrpe_enable (bool):    Set to "NO" by default.
 # nrpe_enable (bool):    Set to "NO" by default.
 #                        Set it to "YES" to enable nrpe.
 #                        Set it to "YES" to enable nrpe.
-# nrpe_flags (str):      Set to "" by default.
 # nrpe_configfile (str): Set to "@pkgsysconfdir@/nrpe.cfg" by default.
 # nrpe_configfile (str): Set to "@pkgsysconfdir@/nrpe.cfg" by default.
 #
 #
 
 
@@ -19,36 +18,27 @@
 
 
 sig_reload=HUP
 sig_reload=HUP
 
 
-nrpe_enable=${nrpe_enable:-"NO"}
-command=${nrpe_program:-"@sbindir@/nrpe"}
+: ${nrpe_enable:="NO"}
+: ${nrpe_configfile:="@pkgsysconfdir@/nrpe.cfg"}
+: ${nrpe_program:="@sbindir@/nrpe"}
+: ${pidfile:="@piddir@/nrpe.pid"}
 command_args="-c ${nrpe_configfile} -d"
 command_args="-c ${nrpe_configfile} -d"
 extra_commands=reload
 extra_commands=reload
-pidfile=${pidfile:-"/var/run/nrpe.pid"}
-nrpe_configfile=${nrpe_configfile:-"@pkgsysconfdir@/nrpe.cfg"}
-
 name=nrpe
 name=nrpe
 rcvar=nrpe_enable
 rcvar=nrpe_enable
 load_rc_config "${name}"
 load_rc_config "${name}"
 required_files="${nrpe_configfile}"
 required_files="${nrpe_configfile}"
+sig_reload=HUP
 
 
 start_precmd=nrpe_prestart
 start_precmd=nrpe_prestart
 stop_precmd=find_pidfile
 stop_precmd=find_pidfile
 
 
-find_pidfile()
-{
-    [ -n "$nrpe_pidfile" ] &&
-        warn "No longer necessary to set nrpe_pidfile in rc.conf[.local]"
-
-    if getpidfile_from_conf pid_file ${nrpe_configfile}; then
-        pidfile="$_pidfile_from_conf"
-	else
-	    pidfile='%%PIDDIR%%/nrpe.pid'
-}
-
 nrpe_prestart()
 nrpe_prestart()
 {
 {
-    find_pidfile
-    install -d -o ${nrpe_user:-nagios} ${pidfile%/*}
+	[ -n "$nrpe_pidfile" ] &&
+		warn "No longer necessary to set nrpe_pidfile in rc.conf[.local]"
+
+	install -d -o @nrpe_user@ ${pidfile%/*}
 }
 }
 
 
 run_rc_command "$1"
 run_rc_command "$1"