Browse Source

Patches for building RPMs - James Peterson

Ethan Galstad 23 years ago
parent
commit
fb6b90b972
11 changed files with 357 additions and 88 deletions
  1. 3 1
      Changelog
  2. 1 1
      Makefile.in
  3. 1 2
      common/common.h
  4. 4 1
      common/config.h.in
  5. 127 71
      configure
  6. 10 2
      configure.in
  7. 8 8
      nrpe.cfg.in
  8. 155 0
      nrpe.spec
  9. 1 1
      src/check_nrpe.c
  10. 1 1
      src/nrpe.c
  11. 46 0
      subst.in

+ 3 - 1
Changelog

@@ -3,7 +3,7 @@ NRPE Changelog
 **************
 
 
-1.6 - ??/??/2002
+1.6 - 12/30/2002
 ----------------
 - Updated sample commands to match new plugin argument format
 - Added sample init scripts for FreeBSD and Debian (Andrew Ryder)
@@ -11,6 +11,8 @@ NRPE Changelog
   -c option specifies config file in nrpe)
 - Added command_timeout directive to config file to allow user
   to specify timeout for executing plugins
+- Added spec file and misc patches for building RPMs (James Peterson)
+- Added --with-nrpe-port config directive (James Peterson)
 
 
 1.5 - 06/03/2002

+ 1 - 1
Makefile.in

@@ -48,7 +48,7 @@ clean:
 	cd $(SRC_BASE); $(MAKE) $@ ; cd ..
 	rm -f core
 	rm -f *~ */*~
-	rm -f config.log config.status config.cache nrpe.cfg Makefile $(SRC_COMMON)/config.h
+	rm -f config.log config.status config.cache nrpe.cfg Makefile subst $(SRC_COMMON)/config.h
 
 distclean: clean
 

+ 1 - 2
common/common.h

@@ -2,7 +2,7 @@
  *
  * COMMON.H - NRPE Common Include File
  * Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)
- * Last Modified: 06-03-2002
+ * Last Modified: 12-30-2002
  *
  * License:
  *
@@ -38,7 +38,6 @@
 
 
 #define DEFAULT_SOCKET_TIMEOUT	10	/* timeout after 10 seconds */
-#define DEFAULT_SERVER_PORT	5666	/* default port to use */
 
 #define MAX_INPUT_BUFFER	2048	/* max size of most buffers we use */
 

+ 4 - 1
common/config.h.in

@@ -2,7 +2,7 @@
  *
  * NRPE Common Header File
  * Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)
- * Last Modified: 06-03-2002
+ * Last Modified: 12-30-2002
  *
  * License:
  *
@@ -25,6 +25,9 @@
 #include <stdlib.h>
 
 
+#define DEFAULT_SERVER_PORT	@nrpe_port@	/* default port to use */
+
+
 #undef STDC_HEADERS
 #undef HAVE_STRDUP
 #undef HAVE_STRSTR

+ 127 - 71
configure

@@ -16,6 +16,8 @@ ac_help="$ac_help
 --with-nrpe-user=<user> sets user name to run NRPE"
 ac_help="$ac_help
 --with-nrpe-grp=<grp> sets group name to run NRPE"
+ac_help="$ac_help
+--with-nrpe-port=<port> sets port number for NRPE to listen on"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -532,7 +534,7 @@ fi
 PKG_NAME=nrpe
 PKG_VERSION="1.6"
 PKG_HOME_URL="http://www.nagios.org/"
-PKG_REL_DATE="07-08-2002"
+PKG_REL_DATE="12-30-2002"
 
 
 ac_aux_dir=
@@ -566,7 +568,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:570: checking for a BSD compatible install" >&5
+echo "configure:572: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -623,7 +625,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:627: checking for $ac_word" >&5
+echo "configure:629: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -653,7 +655,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:657: checking for $ac_word" >&5
+echo "configure:659: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -704,7 +706,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:708: checking for $ac_word" >&5
+echo "configure:710: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -736,7 +738,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:740: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:742: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -747,12 +749,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 751 "configure"
+#line 753 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -778,12 +780,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:782: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:784: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:787: checking whether we are using GNU C" >&5
+echo "configure:789: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -792,7 +794,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:798: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -811,7 +813,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:815: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:817: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -843,7 +845,7 @@ else
 fi
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:847: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:849: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -871,7 +873,7 @@ fi
 
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:875: checking how to run the C preprocessor" >&5
+echo "configure:877: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -886,13 +888,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 890 "configure"
+#line 892 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:898: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -903,13 +905,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 907 "configure"
+#line 909 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:913: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:915: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -920,13 +922,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 924 "configure"
+#line 926 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:932: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -951,12 +953,12 @@ fi
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:955: checking for ANSI C header files" >&5
+echo "configure:957: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 960 "configure"
+#line 962 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -964,7 +966,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:970: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -981,7 +983,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 985 "configure"
+#line 987 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -999,7 +1001,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1003 "configure"
+#line 1005 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1020,7 +1022,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1024 "configure"
+#line 1026 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1031,7 +1033,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:1035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1055,12 +1057,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1059: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:1061: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1064 "configure"
+#line 1066 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -1069,7 +1071,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:1073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -1090,12 +1092,12 @@ EOF
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1094: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:1096: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1099 "configure"
+#line 1101 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -1111,7 +1113,7 @@ wait (&s);
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:1115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -1135,17 +1137,17 @@ for ac_hdr in ctype.h errno.h fcntl.h grp.h netdb.h pwd.h signal.h strings.h str
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1139: checking for $ac_hdr" >&5
+echo "configure:1141: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1144 "configure"
+#line 1146 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1151: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1173,12 +1175,12 @@ done
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1177: checking for working const" >&5
+echo "configure:1179: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1182 "configure"
+#line 1184 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1227,7 +1229,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:1231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1233: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1248,12 +1250,12 @@ EOF
 fi
 
 echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:1252: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:1254: checking whether struct tm is in sys/time.h or time.h" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1257 "configure"
+#line 1259 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -1261,7 +1263,7 @@ int main() {
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:1265: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1267: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -1282,12 +1284,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:1286: checking for mode_t" >&5
+echo "configure:1288: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1291 "configure"
+#line 1293 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1315,12 +1317,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1319: checking for pid_t" >&5
+echo "configure:1321: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1324 "configure"
+#line 1326 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1348,12 +1350,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1352: checking for size_t" >&5
+echo "configure:1354: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1357 "configure"
+#line 1359 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1381,12 +1383,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1385: checking return type of signal handlers" >&5
+echo "configure:1387: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1390 "configure"
+#line 1392 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -1403,7 +1405,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:1407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1409: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -1422,12 +1424,12 @@ EOF
 
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:1426: checking for uid_t in sys/types.h" >&5
+echo "configure:1428: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1431 "configure"
+#line 1433 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -1456,7 +1458,7 @@ EOF
 fi
 
 echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:1460: checking type of array argument to getgroups" >&5
+echo "configure:1462: checking type of array argument to getgroups" >&5
 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1464,7 +1466,7 @@ else
   ac_cv_type_getgroups=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 1468 "configure"
+#line 1470 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Rendell for this test.  */
@@ -1489,7 +1491,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:1493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
     ac_cv_type_getgroups=gid_t
 else
@@ -1503,7 +1505,7 @@ fi
 
 if test $ac_cv_type_getgroups = cross; then
         cat > conftest.$ac_ext <<EOF
-#line 1507 "configure"
+#line 1509 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -1528,7 +1530,7 @@ EOF
 
 
 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:1532: checking for main in -lnsl" >&5
+echo "configure:1534: checking for main in -lnsl" >&5
 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1536,14 +1538,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1540 "configure"
+#line 1542 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1564,7 +1566,7 @@ else
 fi
 
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:1568: checking for socket in -lsocket" >&5
+echo "configure:1570: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1572,7 +1574,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1576 "configure"
+#line 1578 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1583,7 +1585,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:1587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1607,12 +1609,12 @@ fi
 for ac_func in strdup strstr strtoul initgroups
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1611: checking for $ac_func" >&5
+echo "configure:1613: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1616 "configure"
+#line 1618 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1635,7 +1637,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1661,9 +1663,9 @@ done
 
 
 echo $ac_n "checking for type of socket size""... $ac_c" 1>&6
-echo "configure:1665: checking for type of socket size" >&5
+echo "configure:1667: checking for type of socket size" >&5
 cat > conftest.$ac_ext <<EOF
-#line 1667 "configure"
+#line 1669 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <sys/types.h>
@@ -1673,7 +1675,7 @@ int main() {
 int a = send(1, (const void *)0, (size_t *) 0, (int *) 0);
 ; return 0; }
 EOF
-if { (eval echo configure:1677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define SOCKET_SIZE_TYPE size_t
@@ -1707,9 +1709,57 @@ else
   nrpe_grp=nagios
 fi
 
+# Check whether --with-nrpe_port or --without-nrpe_port was given.
+if test "${with_nrpe_port+set}" = set; then
+  withval="$with_nrpe_port"
+  nrpe_port=$withval
+else
+  nrpe_port=5666
+fi
+
 
 
 
+cat >> confdefs.h <<EOF
+#define DEFAULT_SERVER_PORT "$nrpe_port"
+EOF
+
+
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1733: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$PERL" in
+  /*)
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_PERL="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+PERL="$ac_cv_path_PERL"
+if test -n "$PERL"; then
+  echo "$ac_t""$PERL" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
 
 trap '' 1 2 15
 cat > confcache <<\EOF
@@ -1812,7 +1862,7 @@ done
 ac_given_srcdir=$srcdir
 ac_given_INSTALL="$INSTALL"
 
-trap 'rm -fr `echo "Makefile src/Makefile nrpe.cfg common/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile src/Makefile subst common/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -1854,6 +1904,8 @@ s%@CPP@%$CPP%g
 s%@SOCKETLIBS@%$SOCKETLIBS%g
 s%@nrpe_user@%$nrpe_user%g
 s%@nrpe_grp@%$nrpe_grp%g
+s%@nrpe_port@%$nrpe_port%g
+s%@PERL@%$PERL%g
 
 CEOF
 EOF
@@ -1895,7 +1947,7 @@ EOF
 
 cat >> $CONFIG_STATUS <<EOF
 
-CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile nrpe.cfg"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile subst"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
@@ -2074,6 +2126,9 @@ rm -fr confdefs* $ac_clean_files
 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 
 
+perl subst nrpe.cfg
+
+
 
 echo ""
 echo ""
@@ -2083,6 +2138,7 @@ echo ""
 echo " General Options:"
 echo " -------------------------"
 
+echo "$ac_t"" NRPE port:  $nrpe_port" 1>&6
 echo "$ac_t"" NRPE user:  $nrpe_user" 1>&6
 echo "$ac_t"" NRPE group: $nrpe_grp" 1>&6
 

+ 10 - 2
configure.in

@@ -6,7 +6,7 @@ AC_PREFIX_DEFAULT(/usr/local/nagios)
 PKG_NAME=nrpe
 PKG_VERSION="1.6"
 PKG_HOME_URL="http://www.nagios.org/"
-PKG_REL_DATE="07-08-2002"
+PKG_REL_DATE="12-30-2002"
 
 dnl Figure out how to invoke "install" and what install options to use.
 
@@ -50,11 +50,18 @@ AC_TRY_COMPILE([#include <stdlib.h>
 
 AC_ARG_WITH(nrpe_user,--with-nrpe-user=<user> sets user name to run NRPE,nrpe_user=$withval,nrpe_user=nagios)
 AC_ARG_WITH(nrpe_grp,--with-nrpe-grp=<grp> sets group name to run NRPE,nrpe_grp=$withval,nrpe_grp=nagios)
+AC_ARG_WITH(nrpe_port,--with-nrpe-port=<port> sets port number for NRPE to listen on,nrpe_port=$withval,nrpe_port=5666)
 AC_SUBST(nrpe_user)
 AC_SUBST(nrpe_grp)
+AC_SUBST(nrpe_port)
+AC_DEFINE_UNQUOTED(DEFAULT_SERVER_PORT,"$nrpe_port")
 
 
-AC_OUTPUT(Makefile src/Makefile nrpe.cfg)
+AC_PATH_PROG(PERL,perl)
+AC_OUTPUT(Makefile src/Makefile subst)
+
+perl subst nrpe.cfg
+
 
 
 dnl Review options
@@ -66,6 +73,7 @@ echo ""
 echo " General Options:"
 echo " -------------------------"
 
+AC_MSG_RESULT([ NRPE port:  $nrpe_port])
 AC_MSG_RESULT([ NRPE user:  $nrpe_user])
 AC_MSG_RESULT([ NRPE group: $nrpe_grp])
 

+ 8 - 8
nrpe.cfg.in

@@ -2,7 +2,7 @@
 # Sample NRPE Config File 
 # Written by: Ethan Galstad (nagios@nagios.org)
 # 
-# Last Modified: 10-24-2002
+# Last Modified: 12-30-2002
 #
 # NOTES:
 # This is a sample configuration file for the NRPE daemon.  It needs to be
@@ -17,7 +17,7 @@
 # NOTE: This must be a non-priviledged port (i.e. > 1024).
 # NOTE: This option is ignored if NRPE is running under either inetd or xinetd
 
-server_port=5666
+server_port=@nrpe_port@
 
 
 
@@ -101,9 +101,9 @@ command_timeout=60
 # to match the argument format the plugins expect.  Remember, these are
 # examples only!
 
-command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
-command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
-command[check_disk1]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hda1
-command[check_disk2]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hdb1
-command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
-command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200 
+command[check_users]=@libexecdir@/check_users -w 5 -c 10
+command[check_load]=@libexecdir@/check_load -w 15,10,5 -c 30,25,20
+command[check_disk1]=@libexecdir@/check_disk -w 20 -c 10 -p /dev/hda1
+command[check_disk2]=@libexecdir@/check_disk -w 20 -c 10 -p /dev/hdb1
+command[check_zombie_procs]=@libexecdir@/check_procs -w 5 -c 10 -s Z
+command[check_total_procs]=@libexecdir@/check_procs -w 150 -c 200 

+ 155 - 0
nrpe.spec

@@ -0,0 +1,155 @@
+%define name nrpe
+%define version 1.5
+%define release 3
+%define nsusr nagios
+%define nsgrp nagios
+%define nsport 5666
+
+# Reserve option to override port setting with:
+# rpm -ba|--rebuild --define 'nsport 5666'
+%{?port:%define nsport %{port}}
+
+# Macro that print mesages to syslog at package (un)install time
+%define nnmmsg logger -t %{name}/rpm
+
+Summary: Host/service/network monitoring agent for nagios
+URL: http://www.nagios.org
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Copyright: GPL
+Group: Application/System
+Source0: %{name}-%{version}.tar.gz
+Patch0: %{name}.patch
+BuildRoot: %{_tmppath}/%{name}-buildroot
+Prefix: %{_prefix}
+Prefix: /etc/init.d
+Prefix: /etc/nagios
+Requires: bash, grep, nagios-plugins
+PreReq: /usr/bin/logger, chkconfig, sh-utils, shadow-utils, sed, initscripts, fileutils, mktemp
+
+%description
+Nrpe is a agent application that will monitor services on your
+system. Nrpe is written in C and is designed to run under Linux
+(and some other *NIX variants) as a background process, 
+intermittently running checks on various services that you specify.
+
+The actual service checks are performed by separate "plugin" programs
+which return the status of the checks to Nagios. The plugins are
+available at http://sourceforge.net/projects/nagiosplug
+
+This package provide core agent.
+
+%package plugin
+Group: Application/System
+Summary: Provides nrpe plugin for Nagios.
+Requires: nagios-plugins
+
+%description plugin
+Nagios is a program that will monitor hosts and services on your
+network. It has the ability to email or page you when a problem arises
+and when a problem is resolved. Nagios is written in C and is
+designed to run under Linux (and some other *NIX variants) as a
+background process, intermittently running checks on various services
+that you specify.
+
+This package provides the nrpe plugin for Nagios-related applications.
+
+%prep
+%setup -q
+%patch0 -p1
+
+
+%pre
+# Create `nagios' user on the system if necessary
+if id %{nsusr} ; then
+	: # user already exists
+else
+	/usr/sbin/useradd -r -d /var/log/nagios -s /bin/sh -c "%{nsusr}" -g %{nsgrp} %{nsusr} || \
+		%nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process.
+fi
+
+# if LSB standard /etc/init.d does not exist,
+# create it as a symlink to the first match we find
+if [ -d /etc/init.d -o -L /etc/init.d ]; then
+  : # we're done
+elif [ -d /etc/rc.d/init.d ]; then
+  ln -s /etc/rc.d/init.d /etc/init.d
+elif [ -d /usr/local/etc/rc.d ]; then
+  ln -s  /usr/local/etc/rc.d /etc/init.d
+elif [ -d /sbin/init.d ]; then
+  ln -s /sbin/init.d /etc/init.d
+fi
+
+
+%preun
+if [ "$1" = 0 ]; then
+	/sbin/service nrpe stop > /dev/null 2>&1
+	/sbin/chkconfig --del nrpe
+fi
+
+%postun
+if [ "$1" -ge "1" ]; then
+	/sbin/service nrpe condrestart >/dev/null 2>&1 || :
+fi
+# Delete nagios user and group
+if [ $1 = 0 ]; then
+	/usr/sbin/userdel %{nsusr} || %nnmmsg "User %{nsusr} could not be deleted."
+	/usr/sbin/groupdel %{nsgrp} || %nnmmsg "Group %{nsgrp} could not be deleted."
+fi
+
+%build
+export PATH=$PATH:/usr/sbin
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
+./configure \
+	--with-init-dir=/etc/init.d \
+	--with-nrpe-port=%{nsport} \
+	--with-nrpe-user=%{nsusr} \
+	--with-nrpe-grp=%{nsgrp} \
+	--prefix=%{_prefix} \
+	--exec-prefix=%{_prefix}/sbin \
+	--bindir=%{_prefix}/sbin \
+	--sbindir=%{_prefix}/lib/nagios/cgi \
+	--libexecdir=%{_prefix}/lib/nagios/plugins \
+	--datadir=%{_prefix}/share/nagios \
+	--sysconfdir=/etc/nagios \
+	--localstatedir=/var/log/nagios 
+
+make all
+
+%install
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+install -d -m 0755 ${RPM_BUILD_ROOT}/etc/init.d
+install -d -m 0755 ${RPM_BUILD_ROOT}/etc/nagios
+install -d -m 0755 ${RPM_BUILD_ROOT}/usr/sbin
+install -d -m 0755 ${RPM_BUILD_ROOT}/usr/lib/nagios/plugins
+
+# install templated configuration files
+cp nrpe.cfg ${RPM_BUILD_ROOT}/etc/nagios/nrpe.cfg
+cp init-script ${RPM_BUILD_ROOT}/etc/init.d/nrpe
+cp src/nrpe ${RPM_BUILD_ROOT}/usr/sbin
+cp src/check_nrpe ${RPM_BUILD_ROOT}/usr/lib/nagios/plugins
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(755,root,root)
+/etc/init.d/nrpe
+%{_prefix}/sbin/nrpe
+%dir /etc/nagios
+%defattr(644,root,root)
+%config(noreplace) /etc/nagios/*.cfg
+%defattr(755,%{nsusr},%{nsgrp})
+%doc Changelog LEGAL README 
+
+%files plugin
+%defattr(755,root,root)
+%{_prefix}/lib/nagios/plugins
+%defattr(755,%{nsusr},%{nsgrp})
+%doc Changelog LEGAL README
+
+%changelog
+* Sat Dec 28 2002 James 'Showkilr' Peterson <showkilr@showkilr.com>
+- First RPM build (1.5-1)

+ 1 - 1
src/check_nrpe.c

@@ -4,7 +4,7 @@
  * Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)
  * License: GPL
  *
- * Last Modified: 07-08-2002
+ * Last Modified: 12-30-2002
  *
  * Command line: CHECK_NRPE -H <host_address> [-p port] [-c command] [-wt warn_time] \
  *                          [-ct crit_time] [-to to_sec]

+ 1 - 1
src/nrpe.c

@@ -4,7 +4,7 @@
  * Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)
  * License: GPL
  *
- * Last Modified: 10-24-2002
+ * Last Modified: 12-30-2002
  *
  * Command line: nrpe [--inetd | --standalone] -c <config_file>
  *

+ 46 - 0
subst.in

@@ -0,0 +1,46 @@
+#!/usr/bin/perl -w
+
+my ${exec_prefix};
+my ${prefix};
+
+${prefix}="@prefix@";
+${exec_prefix}="@exec_prefix@";
+while ($f = shift @ARGV) {
+
+	if (-x "/bin/mktemp") { 
+		$TEMP = `/bin/mktemp $f.$$.XXXXXX`;
+		die 'Cannot make temporary file $TEMP' if($?);
+		chomp $TEMP;
+	} else {
+		$XXXXXX = rand;
+		$TEMP = "$f.$$.$XXXXXX";
+	}
+
+	open(IN,"<$f.in");
+	open(OUT,">$TEMP") || die 'Cannot make temporary file $TEMP';
+
+	while (<IN>) {
+		s|\@nrpe_user\@|@nrpe_user@|g;
+		s|\@nrpe_grp\@|@nrpe_grp@|g;
+		s|\@nrpe_port\@|@nrpe_port@|g;
+		s|\@libexecdir\@|@libexecdir@|g; # put all --with-vars before directories
+		s|\@localstatedir\@|@localstatedir@|g;
+		s|\@sysconfdir\@|@sysconfdir@|g;
+		s|\@datadir\@|@datadir@|g;
+		s|\@sbindir\@|@sbindir@|g;
+		s|\@bindir\@|@bindir@|g;
+		s|\$\{exec_prefix\}|@exec_prefix@|g; # must be next to last
+		s|\$\{prefix\}|@prefix@|g; # must be last
+		print OUT $_;
+	}
+
+	close IN;
+	close OUT;
+
+	if ((! -e $f) || (`diff $f $TEMP`)) {
+		`mv $TEMP $f`;
+	} else {
+	         unlink $TEMP;
+	}
+
+}