Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=134... Commit: 13403d711348cd27da18f1b5cf3acd7a2d938d91 Parent: fb034f744c3ff377641e266fbe08da3b90bbb67f Author: David Teigland teigland@redhat.com AuthorDate: Wed Jan 18 12:24:05 2012 -0600 Committer: David Teigland teigland@redhat.com CommitterDate: Wed Jan 18 12:26:44 2012 -0600
move init files
and don't install with makefile, so spec file can do what it prefers
Signed-off-by: David Teigland teigland@redhat.com --- dlm_controld/Makefile | 20 +------ dlm_controld/dlm.in | 121 ------------------------------------------- dlm_controld/dlm.service.in | 11 ---- init/dlm.init | 121 +++++++++++++++++++++++++++++++++++++++++++ init/dlm.service | 12 ++++ 5 files changed, 135 insertions(+), 150 deletions(-)
diff --git a/dlm_controld/Makefile b/dlm_controld/Makefile index 715351d..a648ab1 100644 --- a/dlm_controld/Makefile +++ b/dlm_controld/Makefile @@ -5,14 +5,10 @@ BINDIR=$(PREFIX)/sbin LIBDIR=$(PREFIX)/$(LIBNUM) HDRDIR=$(PREFIX)/include MANDIR=$(PREFIX)/share/man -INITDIR=/etc/rc.d/init.d -UNITDIR=/lib/systemd/system
BIN_TARGET = dlm_controld MAN_TARGET = dlm_controld.8 HDR_TARGET = libdlmcontrol.h -INIT_TARGET = dlm -UNIT_TARGET = dlm.service
LIB_NAME = libdlmcontrol LIB_MAJOR = 3 @@ -32,8 +28,6 @@ BIN_SOURCE = action.c \ logging.c \ rbtree.c LIB_SOURCE = lib.c -INIT_SOURCE = dlm.in -UNIT_SOURCE = dlm.service.in
BIN_CFLAGS += -D_GNU_SOURCE -g \ -Wall \ @@ -68,7 +62,7 @@ BIN_LDFLAGS += -lpthread -lrt -lcpg -lcmap -lcfg -lquorum LIB_CFLAGS += $(BIN_CFLAGS) LIB_LDFLAGS += -Wl,-z,relro -pie
-all: $(LIB_TARGET) $(BIN_TARGET) $(INIT_TARGET) $(UNIT_TARGET) +all: $(LIB_TARGET) $(BIN_TARGET)
$(BIN_TARGET): $(BIN_SOURCE) $(CC) $(BIN_CFLAGS) $(BIN_LDFLAGS) $(BIN_SOURCE) -o $@ -L. @@ -78,14 +72,8 @@ $(LIB_TARGET): $(LIB_SOURCE) ln -sf $(LIB_TARGET) $(LIB_SO) ln -sf $(LIB_TARGET) $(LIB_SMAJOR)
-$(INIT_TARGET): $(INIT_SOURCE) - cp $(INIT_SOURCE) $(INIT_TARGET) - -$(UNIT_TARGET): $(UNIT_SOURCE) - cp $(UNIT_SOURCE) $(UNIT_TARGET) - clean: - rm -f *.o *.so *.so.* $(BIN_TARGET) $(LIB_TARGET) $(INIT_TARGET) $(UNIT_TARGET) + rm -f *.o *.so *.so.* $(BIN_TARGET) $(LIB_TARGET)
INSTALL=$(shell which install) @@ -95,15 +83,11 @@ install: all $(INSTALL) -d $(DESTDIR)/$(BINDIR) $(INSTALL) -d $(DESTDIR)/$(LIBDIR) $(INSTALL) -d $(DESTDIR)/$(HDRDIR) - $(INSTALL) -d $(DESTDIR)/$(INITDIR) - $(INSTALL) -d $(DESTDIR)/$(UNITDIR) $(INSTALL) -d $(DESTDIR)/$(MANDIR)/man8 $(INSTALL) -c -m 755 $(BIN_TARGET) $(DESTDIR)/$(BINDIR) $(INSTALL) -c -m 755 $(LIB_TARGET) $(DESTDIR)/$(LIBDIR) cp -a $(LIB_SO) $(DESTDIR)/$(LIBDIR) cp -a $(LIB_SMAJOR) $(DESTDIR)/$(LIBDIR) $(INSTALL) -c -m 644 $(HDR_TARGET) $(DESTDIR)/$(HDRDIR) - $(INSTALL) -m 755 $(INIT_TARGET) $(DESTDIR)/$(INITDIR) - $(INSTALL) -m 755 $(UNIT_TARGET) $(DESTDIR)/$(UNITDIR) $(INSTALL) -m 644 $(MAN_TARGET) $(DESTDIR)/$(MANDIR)/man8/
diff --git a/dlm_controld/dlm.in b/dlm_controld/dlm.in deleted file mode 100644 index db8f17f..0000000 --- a/dlm_controld/dlm.in +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -# -# dlm_controld -# -# chkconfig: 21 79 -# description: starts and stops dlm_controld -# - - -### BEGIN INIT INFO -# Provides: dlm_controld -# Required-Start: $network $time $syslog corosync -# Required-Stop: $syslog -# Should-Start: -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: starts and stops dlm_controld -# Description: starts and stops dlm_controld -### END INIT INFO - -. /etc/rc.d/init.d/functions - -prog="dlm_controld" -progdir="cluster" -lockfile="/var/run/$progdir/$prog.pid" -exec="/usr/sbin/$prog" - -[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog - -setup() { - modprobe dlm > /dev/null 2>&1 - mount -t configfs none /sys/kernel/config > /dev/null 2>&1 -} - -start() { - breakpoint="$1" - - [ -x $exec ] || exit 5 - - if [ ! -d /var/run/$progdir ]; then - mkdir -p /var/run/$progdir - [ -x /usr/sbin/restorecon ] && restorecon /var/run/$progdir - fi - - setup - - [ "$breakpoint" = "setup" ] && exit 0 - - echo -n $"Starting $prog: " - daemon $prog $DLM_CONTROLD_OPTS - retval=$? - echo - [ $retval -eq 0 ] - return $retval -} - -stop() { - echo -n $"Stopping $prog: " - killproc -p $lockfile $prog -TERM - retval=$? - echo - [ $retval -eq 0 ] -} - -wait_for_stop() { - while [ -e $lockfile ]; do - sleep .5 - done -} - -restart() { - stop - wait_for_stop - start -} - -reload() { - restart -} - -rh_status() { - status $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -case "$1" in - start) - rh_status_q && exit 0 - $1 "$2" - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac -exit $? - diff --git a/dlm_controld/dlm.service.in b/dlm_controld/dlm.service.in deleted file mode 100644 index e275843..0000000 --- a/dlm_controld/dlm.service.in +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=dlm control daemon -After=syslog.target network.target corosync.service - -[Service] -Type=forking -ExecStart=/usr/sbin/dlm_controld $OPTIONS - -[Install] -WantedBy=multi-user.target - diff --git a/init/dlm.init b/init/dlm.init new file mode 100644 index 0000000..db8f17f --- /dev/null +++ b/init/dlm.init @@ -0,0 +1,121 @@ +#!/bin/sh +# +# dlm_controld +# +# chkconfig: 21 79 +# description: starts and stops dlm_controld +# + + +### BEGIN INIT INFO +# Provides: dlm_controld +# Required-Start: $network $time $syslog corosync +# Required-Stop: $syslog +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts and stops dlm_controld +# Description: starts and stops dlm_controld +### END INIT INFO + +. /etc/rc.d/init.d/functions + +prog="dlm_controld" +progdir="cluster" +lockfile="/var/run/$progdir/$prog.pid" +exec="/usr/sbin/$prog" + +[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +setup() { + modprobe dlm > /dev/null 2>&1 + mount -t configfs none /sys/kernel/config > /dev/null 2>&1 +} + +start() { + breakpoint="$1" + + [ -x $exec ] || exit 5 + + if [ ! -d /var/run/$progdir ]; then + mkdir -p /var/run/$progdir + [ -x /usr/sbin/restorecon ] && restorecon /var/run/$progdir + fi + + setup + + [ "$breakpoint" = "setup" ] && exit 0 + + echo -n $"Starting $prog: " + daemon $prog $DLM_CONTROLD_OPTS + retval=$? + echo + [ $retval -eq 0 ] + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + killproc -p $lockfile $prog -TERM + retval=$? + echo + [ $retval -eq 0 ] +} + +wait_for_stop() { + while [ -e $lockfile ]; do + sleep .5 + done +} + +restart() { + stop + wait_for_stop + start +} + +reload() { + restart +} + +rh_status() { + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 "$2" + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac +exit $? + diff --git a/init/dlm.service b/init/dlm.service new file mode 100644 index 0000000..d962e7b --- /dev/null +++ b/init/dlm.service @@ -0,0 +1,12 @@ +[Unit] +Description=dlm control daemon +After=syslog.target network.target corosync.service + +[Service] +Type=forking +ExecStart=/lib/systemd/systemd-dlm start +ExecStop=/lib/systemd/systemd-dlm stop + +[Install] +WantedBy=multi-user.target +