Преглед изворни кода

A couple more Solaris fixes and other minor things.

John C. Frickson пре 9 година
родитељ
комит
92566314cf
4 измењених фајлова са 50 додато и 41 уклоњено
  1. 15 17
      Makefile.in
  2. 1 1
      startup/solaris-inetd.xml.in
  3. 5 5
      startup/solaris-init.xml.in
  4. 29 18
      uninstall.in

+ 15 - 17
Makefile.in

@@ -47,19 +47,19 @@ default:
 	@echo;\
 	echo Please enter 'make [option]' where [option] is one of:;\
 	echo;\
-	echo "     all                builds nrpe and check_nrpe";\
-	echo "     nrpe               builds nrpe only";\
-	echo "     check_nrpe         builds check_nrpe only";\
-	echo "     install            install nrpe and check_nrpe";\
-	echo "     install-plugin     install the check_nrpe plugin";\
-	echo "     install-daemon     install the nrpe daemon";\
-	echo "     install-group      add the groups if they do not exist";\
-	echo "     install-user       add the user ids if they do not exist";\
-	echo "     install-group-user add the users and groups if they do not exist";\
-	echo "     install-config     install the nrpe configuration file";\
-	echo "     install-inetd      install the startup files for inetd, launchd, etc.";\
-	echo "     install-init       install the startup files for init, systemd, etc.";\
-	echo "     solaris-package    create the solaris package";\
+	echo "     all                  builds nrpe and check_nrpe";\
+	echo "     nrpe                 builds nrpe only";\
+	echo "     check_nrpe           builds check_nrpe only";\
+	echo "     install              install nrpe and check_nrpe";\
+	echo "     install-plugin       install the check_nrpe plugin";\
+	echo "     install-daemon       install the nrpe daemon";\
+	echo "     install-groups       add the groups if they do not exist";\
+	echo "     install-users        add the user ids if they do not exist";\
+	echo "     install-groups-users add the users and groups if they do not exist";\
+	echo "     install-config       install the nrpe configuration file";\
+	echo "     install-inetd        install the startup files for inetd, launchd, etc.";\
+	echo "     install-init         install the startup files for init, systemd, etc.";\
+	echo "     solaris-package      create the solaris package";\
 	echo
 
 all:
@@ -107,8 +107,7 @@ install-inetd:
 		if test $(INETD_TYPE) = smf10 -o $(INETD_TYPE) = smf11; then \
 			echo svccfg import $(INETD_DIR)/$(INETD_FILE); \
 			svccfg import $(INETD_DIR)/$(INETD_FILE); \
-			echo svcadm enable nrpe; \
-			svcadm enable nrpe; \
+			echo "*** Run 'svcadm enable nrpe' to start it"; \
 		fi;\
 	fi
 	@$(EGREP) -q "^nrpe[\t ]+5666/tcp" /etc/services || \
@@ -132,8 +131,7 @@ install-init:
 		$(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		echo svccfg import $(INIT_DIR)/$(INIT_FILE); \
 		svccfg import $(INIT_DIR)/$(INIT_FILE); \
-		echo svcadm enable nrpe; \
-		svcadm enable nrpe; \
+		echo "*** Run 'svcadm enable nrpe' to start it"; \
 	else\
 		echo $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
 		$(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \

+ 1 - 1
startup/solaris-inetd.xml.in

@@ -21,7 +21,7 @@
 			restart_on='restart'
 			type='path'>
 			<service_fmri
-			    value='file://localhost/pkg@sysconfdir@/nrpe.cfg' />
+			    value='file://localhost@sysconfdir@/nrpe.cfg' />
 		</dependency>
 
 		<exec_method

+ 5 - 5
startup/solaris-init.xml.in

@@ -12,8 +12,6 @@
 		type='service'
 		version='1'>
 
-		<create-default-instance enabled='true' />
-
 		<single_instance />
 
 		<dependency
@@ -91,8 +89,8 @@
 		<exec_method
 			type='method'
 			name='start'
-			exec='@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f'
-			timeout_seconds='60'>
+			exec='@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -d'
+			timeout_seconds='5'>
 			<method_context>
 				<method_credential user='@nrpe_user@' group='@nrpe_group@'/>
 			</method_context>
@@ -115,13 +113,15 @@
 		</property_group>
 
 		<property_group name='general' type='framework'>
-			<propval name='enabled' type='boolean' value='true'/>
+			<propval name='enabled' type='boolean' value='false'/>
 			<propval name='action_authorization' type='astring'
 				value='solaris.smf.manage.nrpe'/>
 			<propval name='value_authorization' type='astring'
 				value='solaris.smf.manage.nrpe'/>
 		</property_group>
 
+		<instance name='default' enabled='false' />
+
 		<stability value='Unstable' />
 
 		<template>

+ 29 - 18
uninstall.in

@@ -31,8 +31,10 @@ INETD_DIR=@inetddir@
 INETD_FILE=@inetdname@
 SRC_INETD=@src_inetd@
 SRC_INIT=@src_init@
-USERID=@nrpe_user@
-GRPID=@nrpe_group@
+NRPE_USER=@nrpe_user@
+NRPE_GROUP=@nrpe_group@
+NAGIOS_USER=@nagios_user@
+NAGIOS_GROUP=@nagios_group@
 
 
 # Display usage message
@@ -46,8 +48,8 @@ usage() {
 	echo "      progs    Delete the program files"
 	echo "      config   Delete configuration file(s)"
 	echo "      startup  Delete startup files (inetd, init, etc.)"
-	echo "      user     Delete the $USERID user"
-	echo "      group    Delete the $GRPID group"
+	echo "      user     Delete the users"
+	echo "      group    Delete the groups"
 	echo "      script   Delete this uninstall script"
 	echo "      all      Do all of the above"
 	exit 1
@@ -67,7 +69,7 @@ get_opts() {
 			group)		delgrp=1;	;;
 			script)		delscpt=1;	;;
 			-v)			verb=1; force=""; redir=0 	;;
-			all)		progs=1; config=1; start=1	;;
+			all)		progs=1; config=1; start=1; delusr=1; delgrp=1; delscpt=1 ;;
 			*)			echo "Invalid argument: $arg";	usage	;;
 		esac
 	done
@@ -297,33 +299,42 @@ rm_config() {
 }
 
 rm_user() {
-	prt_msg 1 0 0 "*** Removing user ${USERID}"
-	prt_msg 2 0 1 "Delete ${USERID}" || return
+	prt_msg 1 0 0 "*** Removing users"
+	prt_msg 2 0 1 "Delete nrpe user:${NRPE_USER} and nagios user:${NAGIOS_USER}" || return
 
 	if test ${OPSYS} = aix; then
-		rmuser -p ${USERID}
+		rmuser -p ${NRPE_USER}
+		rmuser -p ${NAGIOS_USER}
 	elif test ${OPSYS} = osx; then
-		dscl . -delete /Groups/${GRPID} GroupMembership ${USERID}
-		dscl . -delete /Users name ${USERID}
+		dscl . -delete /Groups/${NRPE_GROUP} GroupMembership ${NRPE_USER}
+		dscl . -delete /Users name ${NRPE_USER}
+		dscl . -delete /Groups/${NAGIOS_GROUP} GroupMembership ${NAGIOS_USER}
+		dscl . -delete /Users name ${NAGIOS_USER}
 	elif test ${DIST} = "freebsd"; then
-		pw del user ${USERID}
+		pw del user ${NRPE_USER}
+		pw del user ${NAGIOS_USER}
 	else
-		userdel -r ${USERID}
+		userdel -r ${NRPE_USER}
+		userdel -r ${NAGIOS_USER}
 	fi
 }
 
 rm_group() {
-	prt_msg 1 0 0 "*** Removing group ${GROUPID}"
-	prt_msg 2 0 1 "Delete ${GROUPID}" || return
+	prt_msg 1 0 0 "*** Removing groups"
+	prt_msg 2 0 1 "Delete nrpe group:${NRPE_GROUP} and nagios group:${NAGIOS_GROUP}" || return
 
 	if test ${OPSYS} = aix; then
-		rmgroup -p ${GRPID}
+		rmgroup -p ${NRPE_GROUP}
+		rmgroup -p ${NAGIOS_GROUP}
 	elif test ${OPSYS} = osx; then
-		dscl . -delete /Groups/${GRPID}
+		dscl . -delete /Groups/${NRPE_GROUP}
+		dscl . -delete /Groups/${NAGIOS_GROUP}
 	elif test ${DIST} = "freebsd"; then
-		pw del group ${GRPID}
+		pw del group ${NRPE_GROUP}
+		pw del group ${NAGIOS_GROUP}
 	else
-		groupdel ${GRPID}
+		groupdel ${NRPE_GROUP}
+		groupdel ${NAGIOS_GROUP}
 	fi
 }