فهرست منبع

Changes for *BSD

John C. Frickson 9 سال پیش
والد
کامیت
5ad7bd47f7
7فایلهای تغییر یافته به همراه44 افزوده شده و 17 حذف شده
  1. 2 2
      Makefile.in
  2. 10 0
      build-aux/add_group_user
  3. 6 0
      build-aux/ax_nagios_get_files
  4. 9 1
      configure
  5. 1 0
      configure.ac
  6. 2 11
      startup/newbsd-init.in
  7. 14 3
      uninstall.in

+ 2 - 2
Makefile.in

@@ -140,8 +140,8 @@ 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 "*** Add 'nrpe_enable=\"YES\"' to /etc/rc.conf and";\
-			echo "*** optionally set 'nrpe_configfile'";\
+			echo "nrpe@bsdenable@=YES" >> /etc/rc.conf;\
+			echo "nrpe_configfile=$(CFGDIR)/nrpe.cfg" >> /etc/rc.conf;\
 		fi;\
 	fi
 

+ 10 - 0
build-aux/add_group_user

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

+ 6 - 0
build-aux/ax_nagios_get_files

@@ -47,6 +47,7 @@ AC_DEFUN([AX_NAGIOS_GET_FILES],
 
 src_inetd=""
 src_init=""
+bsd_enable=""
 
 AC_MSG_CHECKING(for which init file to use )
 
@@ -64,6 +65,11 @@ AS_CASE([$init_type],
 		src_init=default-service,
 
 	[bsd],
+		if test $dist_type = freebsd ; then
+			bsd_enable="_enable"
+		elif test $dist_type = openbsd ; then
+			bsd_enable="_flags"
+		fi
 		src_init=bsd-init,
 
 	[newbsd],

+ 9 - 1
configure

@@ -640,6 +640,7 @@ LIBOBJS
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
+bsd_enable
 src_inetd
 src_init
 src_tmpfile
@@ -2548,6 +2549,7 @@ LC_TIME=C
 
 
 
+
 
 
 # Find a good install program.  We prefer a C program (faster),
@@ -3792,6 +3794,7 @@ $as_echo "$install_method" >&6; }
 
 src_inetd=""
 src_init=""
+bsd_enable=""
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which init file to use " >&5
 $as_echo_n "checking for which init file to use ... " >&6; }
@@ -3807,7 +3810,12 @@ case $init_type in #(
     src_tmpfile=tmpfile.conf
 		src_init=default-service ;; #(
   bsd) :
-    src_init=bsd-init ;; #(
+    if test $dist_type = freebsd ; then
+			bsd_enable="_enable"
+		elif test $dist_type = openbsd ; then
+			bsd_enable="_flags"
+		fi
+		src_init=bsd-init ;; #(
   newbsd) :
     src_init=newbsd-init ;; #(
   #	[gentoo],

+ 1 - 0
configure.ac

@@ -78,6 +78,7 @@ AC_SUBST(subsyslockfile)
 AC_SUBST(src_tmpfile)
 AC_SUBST(src_init)
 AC_SUBST(src_inetd)
+AC_SUBST(bsd_enable)
 
 dnl Figure out how to invoke "install" and what install options to use.
 AC_PROG_INSTALL

+ 2 - 11
startup/newbsd-init.in

@@ -6,26 +6,17 @@
 # REQUIRE: LOGIN
 # KEYWORD: shutdown
 
-#
-# Add the following lines to /etc/rc.conf to enable nrpe:
-#
-# nrpe_enable (bool):    Set to "NO" by default.
-#                        Set it to "YES" to enable nrpe.
-# nrpe_configfile (str): Set to "@pkgsysconfdir@/nrpe.cfg" by default.
-#
-
 . /etc/rc.subr
 
 sig_reload=HUP
-
-: ${nrpe_enable:="NO"}
+: ${nrpe@bsdenable@:="NO"}
 : ${nrpe_configfile:="@pkgsysconfdir@/nrpe.cfg"}
 : ${nrpe_program:="@sbindir@/nrpe"}
 : ${pidfile:="@piddir@/nrpe.pid"}
 command_args="-c ${nrpe_configfile} -d"
 extra_commands=reload
 name=nrpe
-rcvar=nrpe_enable
+rcvar=nrpe@bsdenable@
 load_rc_config "${name}"
 required_files="${nrpe_configfile}"
 sig_reload=HUP

+ 14 - 3
uninstall.in

@@ -176,12 +176,12 @@ rm_startup() {
 
 	if test "$SRC_INETD" != unknown; then
 		if test "$INETD_TYPE" = inetd; then
-			rc=`grep -E -q "^\W*@PKG_NAME@\s+" "$INETD_DIR/$INETD_FILE"`
+			rc=`grep -E -q "^\W*$NAME\s+" "$INETD_DIR/$INETD_FILE"`
 			if test $rc -eq 0; then
 				num=1
 				prt_msg 2 0 1 "($INETD_TYPE) Remove entries from $INETD_DIR/$INETD_FILE" && {
 					prt_msg 2 1 0 "($INETD_TYPE) Creating temp file: $INETD_DIR/$INETD_FILE.$NAME.unin"
-					grep -v -q "\W*@PKG_NAME@\s+" "$INETD_DIR/$INETD_FILE" > "$INETD_DIR/$INETD_FILE.$NAME.unin"
+					grep -v -q "\W*$NAME\s+" "$INETD_DIR/$INETD_FILE" > "$INETD_DIR/$INETD_FILE.$NAME.unin"
 					prt_msg 2 1 0 "($INETD_TYPE) Renaming original to: $INETD_DIR/$INETD_FILE.$NAME_save"
 					mv "$INETD_DIR/$INETD_FILE" "$INETD_DIR/$INETD_FILE.$NAME_save"
 					prt_msg 2 1 0 "($INETD_TYPE) Renaming $INETD_DIR/$INETD_FILE.unin to $INETD_DIR/$INETD_FILE"
@@ -267,11 +267,22 @@ rm_startup() {
 			}
 			prt_msg 2 0 1 "($INIT_TYPE) Delete $INIT_DIR/$INIT_FILE" && {
 				rm $force "$INIT_DIR/$INIT_FILE"
+				if test ${OPSYS} = bsd; then
+					prt_msg 2 0 1 "($INITD_TYPE) Remove entries from $INETD_DIR/rc.conf" && {
+						prt_msg 2 1 0 "($INIT_TYPE) Creating temp file: $INETD_DIR/rc.conf.$NAME.unin"
+						grep -v -q "^$NAME" "$INETD_DIR/rc.conf" > "$INETD_DIR/rc.conf.$NAME.unin"
+						prt_msg 2 1 0 "($INIT_TYPE) Renaming original to: $INETD_DIR/rc.conf.$NAME_save"
+						mv "$INETD_DIR/rc.conf" "$INETD_DIR/rc.conf.$NAME_save"
+						prt_msg 2 1 0 "($INIT_TYPE) Renaming $INETD_DIR/rc.conf.unin to $INETD_DIR/rc.conf"
+						mv "$INETD_DIR/rc.conf.unin" "$INETD_DIR/rc.conf"
+						prt_msg 2 0 0 "($INIT_TYPE) Old $INETD_DIR/rc.conf saved as $INETD_DIR/rc.conf.$NAME_save"
+					}
+				fi
 				if test $INIT_TYPE = upstart; then
 					prt_msg 2 0 1 "($INIT_TYPE) initctl reload-configuration" && {
 						initctl reload-configuration
 					}
-				elif test "$INETD_TYPE" = smf10 -o "$INETD_TYPE" = smf11; then
+				elif test "$INIT_TYPE" = smf10 -o "$INIT_TYPE" = smf11; then
 					prt_msg 2 0 1 "($INIT_TYPE) svcadm restart svc:/system/manifest-import" && {
 						svcadm restart svc:/system/manifest-import
 					}