Skip to content

Commit

Permalink
Changes for *BSD
Browse files Browse the repository at this point in the history
  • Loading branch information
John C. Frickson committed May 26, 2016
1 parent a340a79 commit 5ad7bd4
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions build-aux/add_group_user
Original file line number Diff line number Diff line change
Expand Up @@ -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 $?`
Expand Down Expand Up @@ -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 $?`
Expand Down
6 changes: 6 additions & 0 deletions build-aux/ax_nagios_get_files
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand All @@ -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],
Expand Down
10 changes: 9 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ LIBOBJS
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
bsd_enable
src_inetd
src_init
src_tmpfile
Expand Down Expand Up @@ -2548,6 +2549,7 @@ LC_TIME=C
# Find a good install program. We prefer a C program (faster),
Expand Down Expand Up @@ -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; }
Expand All @@ -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],
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 2 additions & 11 deletions startup/newbsd-init.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions uninstall.in
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 5ad7bd4

Please sign in to comment.