Makefile.am | 2 + bmc-watchdog/Makefile.am | 6 +- bmc-watchdog/bmc-watchdog.init | 178 +++++++++++------------------------ bmc-watchdog/bmc-watchdog.logrotate | 2 +- configure.ac | 1 + ipmidetectd/Makefile.am | 4 +- ipmidetectd/ipmidetectd.init | 144 +++++++++++----------------- libipmiconsole/src/Makefile.am | 3 + 8 files changed, 125 insertions(+), 215 deletions(-) diff --git a/Makefile.am b/Makefile.am index efc25a6..668ba04 100644 --- a/Makefile.am +++ b/Makefile.am @@ -90,3 +90,5 @@ uninstall-extra: $(docdir) EXTRA_DIST = $(EXTRA) freeipmi.spec + +ACLOCAL_AMFLAGS = -I config diff --git a/bmc-watchdog/Makefile.am b/bmc-watchdog/Makefile.am index e504b49..cc2e206 100644 --- a/bmc-watchdog/Makefile.am +++ b/bmc-watchdog/Makefile.am @@ -21,8 +21,8 @@ install-data-local: $(INSTALL_INIT_SCRIPTS) $(INSTALL_LOGROTATE_CONFIG) \ $(INSTALL_LOGDIR) install-init-scripts: - $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/init.d - $(INSTALL) -m 755 $(srcdir)/bmc-watchdog.init $(DESTDIR)$(sysconfdir)/init.d/bmc-watchdog + $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/rc.d/init.d + $(INSTALL) -m 755 $(srcdir)/bmc-watchdog.init $(DESTDIR)$(sysconfdir)/rc.d/init.d/bmc-watchdog $(INSTALL) -m 755 -d $(DESTDIR)/$(sysconfdir)/sysconfig $(INSTALL) -m 444 $(srcdir)/bmc-watchdog.sysconfig $(DESTDIR)$(sysconfdir)/sysconfig/bmc-watchdog @@ -34,6 +34,6 @@ install-logdir: $(INSTALL) -m 755 -d $(DESTDIR)$(localstatedir)/log/$(PACKAGE) uninstall-local: - $(RM) -f $(DESTDIR)$(sysconfdir)/init.d/bmc-watchdog + $(RM) -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/bmc-watchdog $(RM) -f $(DESTDIR)$(sysconfdir)/logrotate.d/bmc-watchdog $(RM) -f $(DESTDIR)$(sysconfdir)/sysconfig/bmc-watchdog diff --git a/bmc-watchdog/bmc-watchdog.init b/bmc-watchdog/bmc-watchdog.init index 69dc718..5af126c 100755 --- a/bmc-watchdog/bmc-watchdog.init +++ b/bmc-watchdog/bmc-watchdog.init @@ -1,137 +1,71 @@ #!/bin/sh # -# chkconfig: - 99 01 -# description: bmc-watchdog startup script +# template Summary of the service. # -### BEGIN INIT INFO -# Provides: bmc-watchdog -# Required-Start: $network $remote_fs $syslog -# Required-Stop: $network $remote_fs $syslog -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Start and stop bmc-watchdog -# Description: BMC watchdog timer daemon -### END INIT INFO +# chkconfig: - 99 01 +# description: bmc-watchdog startup script +# processname: bmc-watchdog -DAEMON=/usr/sbin/bmc-watchdog -PIDFILE=/var/run/bmc-watchdog.pid -LOCKFILE=/var/lock/subsys/bmc-watchdog -CONFFILE=/etc/sysconfig/bmc-watchdog +# Do not load RH compatibility interface. +WITHOUT_RC_COMPAT=1 + # -[ -f $DAEMON ] || exit 5 +# Source function library. +. /etc/init.d/functions -if [ -r $CONFFILE ]; then - . $CONFFILE -fi +SourceIfNotEmpty /etc/sysconfig/bmc-watchdog -# Load Redhat or Suse appropriate libs -if [ -f /etc/rc.d/init.d/functions ] ; then - . /etc/rc.d/init.d/functions - Xstart() { +LOCKFILE=/var/lock/subsys/bmc-watchdog +RETVAL=0 - # Default deamon mode - # - # timer use = SMS/OS - # pre-timeout interrupt = none - # action = reset - # -F, -P, -L, -S, -O - clear flags - # initial-countdown = 900 seconds (15 mins) - # reset-period = 60 seconds +start() +{ + start_daemon $NICE --lockfile "$LOCKFILE" --expect-user root -- bmc-watchdog $OPTIONS + RETVAL=$? + return $RETVAL +} - daemon -20 $DAEMON $OPTIONS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch $LOCKFILE - } - Xstop() { - killproc bmc-watchdog - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f $LOCKFILE - } - Xstatus() { - status bmc-watchdog - RETVAL=$? - return $RETVAL - } - Xcondrestart() { - if test -e $LOCKFILE; then - $0 stop - $0 start - RETVAL=$? - fi - } - Xexit() { - exit $RETVAL - } -elif [ -f /etc/rc.status ] ; then - . /etc/rc.status - Xstart() { - startproc -20 $DAEMON $OPTIONS - rc_status -v - RETVAL=$? - return $RETVAL - } - Xstop() { - killproc -TERM $DAEMON - rc_status -v - RETVAL=$? - return $RETVAL - } - Xstatus() { - echo -n "Checking for bmc-watchdog: " - checkproc $DAEMON - rc_status -v - RETVAL=$? - return $RETVAL - } - Xcondrestart() { - $0 status - if test $? = 0; then - $0 restart - else - rc_reset - fi - rc_status - RETVAL=$? - return $RETVAL - } - Xexit() { - rc_exit - } -else - echo "Unknown distribution type" - exit 1 -fi +stop() +{ + stop_daemon --lockfile "$LOCKFILE" --expect-user root -- bmc-watchdog + RETVAL=$? + return $RETVAL +} -RETVAL=0 +restart() +{ + stop + start +} +# See how we were called. case "$1" in - start) - echo -n "Starting bmc-watchdog: " - Xstatus >/dev/null 2>&1 && exit 0 - Xstart - ;; - - stop) - echo -n "Shutting down bmc-watchdog: " - Xstop - ;; - - restart) - $0 stop - $0 start - RETVAL=$? - ;; - status) - Xstatus - ;; - condrestart|try-restart|force-reload) - Xcondrestart - ;; - *) - echo "Usage: $0 {start|stop|restart|status|condrestart|try-restart|force-reload}" - exit 2 + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + condstop) + if [ -e "$LOCKFILE" ]; then + stop + fi + ;; + condrestart|condreload) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + status) + status --expect-user root -- bmc-watchdog + RETVAL=$? + ;; + *) + msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}" + RETVAL=1 esac exit $RETVAL diff --git a/bmc-watchdog/bmc-watchdog.logrotate b/bmc-watchdog/bmc-watchdog.logrotate index cf6f7f2..8ff47e2 100644 --- a/bmc-watchdog/bmc-watchdog.logrotate +++ b/bmc-watchdog/bmc-watchdog.logrotate @@ -11,6 +11,6 @@ nomail notifempty postrotate - /etc/init.d/bmc-watchdog condrestart > /dev/null 2>&1 || true + /sbin/service freeipmi-bmc-watchdog condreload endscript } diff --git a/configure.ac b/configure.ac index 322a397..2534bf8 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,7 @@ dnl We require a modern autoconf and automake AC_PREREQ([2.57]) AC_CONFIG_AUX_DIR([config]) +AC_CONFIG_MACRO_DIR([config]) dnl Locate the sources. AC_CONFIG_SRCDIR([ChangeLog.0]) diff --git a/ipmidetectd/Makefile.am b/ipmidetectd/Makefile.am index 3101d47..0d330b4 100644 --- a/ipmidetectd/Makefile.am +++ b/ipmidetectd/Makefile.am @@ -20,8 +20,8 @@ install-data-local: $(INSTALL_INIT_SCRIPTS) $(INSTALL) -m 644 $(srcdir)/ipmidetectd.conf $(DESTDIR)$(IPMIDETECTD_CONFIG_FILE_DEFAULT) install-init-scripts: - $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/init.d - $(INSTALL) -m 755 $(srcdir)/ipmidetectd.init $(DESTDIR)$(sysconfdir)/init.d/ipmidetectd + $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/rc.d/init.d + $(INSTALL) -m 755 $(srcdir)/ipmidetectd.init $(DESTDIR)$(sysconfdir)/rc.d/init.d/ipmidetectd uninstall-local: $(RM) -f $(DESTDIR)$(sysconfdir)/init.d/ipmidetectd diff --git a/ipmidetectd/ipmidetectd.init b/ipmidetectd/ipmidetectd.init index 2f6963d..8db8d5b 100644 --- a/ipmidetectd/ipmidetectd.init +++ b/ipmidetectd/ipmidetectd.init @@ -3,7 +3,9 @@ # # chkconfig: - 70 40 # description: ipmidetectd startup script -# +# chkconfig: - 99 01 +# description: ipmidetectd startup script +# processname: ipmidetectd ### BEGIN INIT INFO # Provides: ipmidetectd # Required-Start: $network $remote_fs $syslog @@ -13,100 +15,68 @@ # Description: IPMI node detection monitoring daemon ### END INIT INFO +# Do not load RH compatibility interface. +WITHOUT_RC_COMPAT=1 IPMIDETECTD=/usr/sbin/ipmidetectd IPMIDETECTD_CONF=/etc/freeipmi/ipmidetectd.conf LOCKFILE=/var/lock/subsys/ipmidetectd -[ -f $IPMIDETECTD ] || exit 5 -[ -f $IPMIDETECTD_CONF ] || exit 6 +# Source function library. +. /etc/init.d/functions -# Load Redhat or Suse appropriate libs -if [ -f /etc/rc.d/init.d/functions ] ; then - . /etc/rc.d/init.d/functions - Xstart() { - daemon $IPMIDETECTD - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch $LOCKFILE - } - Xstop() { - killproc ipmidetectd -TERM - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f $LOCKFILE - } - Xstatus() { - status ipmidetectd - RETVAL=$? - return $RETVAL - } - Xcondrestart() { - if test -e $LOCKFILE; then - $0 stop - $0 start - RETVAL=$? - fi - } - Xexit() { - exit $RETVAL - } -elif [ -f /etc/rc.status ] ; then - . /etc/rc.status - Xstart() { - startproc $IPMIDETECTD - rc_status -v - } - Xstop() { - killproc -TERM $IPMIDETECTD - rc_status -v - } - Xstatus() { - echo -n "Checking for ipmidetectd: " - checkproc $IPMIDETECTD - rc_status -v - } - Xcondrestart() { - $0 status - if test $? = 0; then - $0 restart - else - rc_reset - fi - rc_status - } - Xexit() { - rc_exit - } -else - echo "Unknown distribution type" - exit 1 -fi +SourceIfNotEmpty /etc/sysconfig/freeipmi-ipmidetectd +LOCKFILE=/var/lock/subsys/freeipmi-ipmidetectd RETVAL=0 +start() +{ + start_daemon $NICE --lockfile "$LOCKFILE" --expect-user root -- ipmidetectd $DAEMON_OPTIONS + RETVAL=$? + return $RETVAL +} + +stop() +{ + stop_daemon --lockfile "$LOCKFILE" --expect-user root -- ipmidetectd + RETVAL=$? + return $RETVAL +} + +restart() +{ + stop + start +} + +# See how we were called. case "$1" in - start) - echo -n "Starting ipmidetectd: " - Xstatus >/dev/null 2>&1 && exit 0 - Xstart - ;; - stop) - echo -n "Shutting down ipmidetectd: " - Xstop - ;; - restart) - $0 stop - $0 start - RETVAL=$? - ;; - status) - Xstatus - ;; - condrestart|try-restart|force-reload) - Xcondrestart - ;; - *) - echo "Usage: $0 {start|stop|restart|status|condrestart|try-restart|force-reload}" - exit 2 + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + condstop) + if [ -e "$LOCKFILE" ]; then + stop + fi + ;; + condrestart|condreload) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + status) + status --expect-user root -- ipmidetectd + RETVAL=$? + ;; + *) + msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}" + RETVAL=1 esac + exit $RETVAL diff --git a/libipmiconsole/src/Makefile.am b/libipmiconsole/src/Makefile.am index 0be4c79..479af4d 100644 --- a/libipmiconsole/src/Makefile.am +++ b/libipmiconsole/src/Makefile.am @@ -61,6 +61,9 @@ libipmiconsole_la_SOURCES = \ ipmiconsole_processing.c \ ipmiconsole_util.c +install-logdir: + $(INSTALL) -m 755 -d $(DESTDIR)/var/log/ipmiconsole + $(top_builddir)/common/src/debugutil/libdebugutil.la : force-dependency-check @cd `dirname $@` && $(MAKE) `basename $@`