Skip to content

Commit

Permalink
A couple more Solaris fixes and other minor things.
Browse files Browse the repository at this point in the history
  • Loading branch information
John C. Frickson committed May 18, 2016
1 parent 426f720 commit 9256631
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 41 deletions.
32 changes: 15 additions & 17 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 || \
Expand All @@ -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); \
Expand Down
2 changes: 1 addition & 1 deletion startup/solaris-inetd.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions startup/solaris-init.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
type='service'
version='1'>

<create-default-instance enabled='true' />

<single_instance />

<dependency
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down
47 changes: 29 additions & 18 deletions uninstall.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 9256631

Please sign in to comment.