From 4c13f6d393db0aa5ff5b327cb5e842ee21522236 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 18 Oct 2012 13:09:58 -0400 Subject: [PATCH 31/32] Make "install_systemd" and "install_sysvinit" separate targets Signed-off-by: Peter Jones --- Makefile | 6 ++++ src/Makefile | 16 +++++++---- src/pesign.sysvinit | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 src/pesign.sysvinit diff --git a/Makefile b/Makefile index 5e9bd31..12e0dbb 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,12 @@ install : $(INSTALL) -d -m 755 $(INSTALLROOT)$(PREFIX)$(DOCDIR)/pesign-$(VERSION)/ $(INSTALL) -m 644 COPYING $(INSTALLROOT)$(PREFIX)$(DOCDIR)/pesign-$(VERSION)/ +install_systemd: + @for x in $(SUBDIRS) ; do $(MAKE) -C $${x} TOPDIR=$(TOPDIR) SRCDIR=$(TOPDIR)/$@/ ARCH=$(ARCH) $@ ; done + +install_sysvinit: + @for x in $(SUBDIRS) ; do $(MAKE) -C $${x} TOPDIR=$(TOPDIR) SRCDIR=$(TOPDIR)/$@/ ARCH=$(ARCH) $@ ; done + .PHONY: $(SUBDIRS) clean install include $(TOPDIR)/Make.rules diff --git a/src/Makefile b/src/Makefile index cb74c12..7e611c8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -42,7 +42,7 @@ client : $(client_OBJECTS) $(STATIC_LIBS) fuzzsocket_SOURCES = fuzzsocket.c fuzzsocket_OBJECTS = $(foreach source,$(fuzzsocket_SOURCES),$(patsubst %.c,%,$(source)).o) fuzzsocket_DEPS = $(foreach source,$(fuzzsocket_SOURCES),.$(patsubst %.c,%,$(source)).P) -fuzzsocket : $(fuzzsocket_OBJECTS) +fuzzsocket : $(fuzzsocket_OBJECTS) -lrt DEPS = $(generic_DEPS)$(authvar_DEPS) $(pesign_DEPS) $(client_DEPS) \ $(peverify_DEPS) @@ -57,6 +57,16 @@ depclean : clean : depclean @rm -rfv *.o *.a *.so $(TARGETS) +install_systemd: + $(INSTALL) -d -m 755 $(INSTALLROOT)/usr/lib/tmpfiles.d/ + $(INSTALL) -m 644 tmpfiles.conf $(INSTALLROOT)/usr/lib/tmpfiles.d/pesign.conf + $(INSTALL) -d -m 755 $(INSTALLROOT)/usr/lib/systemd/system/ + $(INSTALL) -m 644 pesign.service $(INSTALLROOT)/usr/lib/systemd/system/ + +install_sysvinit: + $(INSTALL) -d -m 755 $(INSTALLROOT)/etc/rc.d/init.d/ + $(INSTALL) -m 755 pesign.sysvinit $(INSTALLROOT)/etc/rc.d/init.d/pesign + install : $(INSTALL) -d -m 700 $(INSTALLROOT)/etc/pki/pesign/ $(INSTALL) -d -m 770 $(INSTALLROOT)/var/run/pesign/ @@ -72,10 +82,6 @@ install : #$(INSTALL) -m 644 peverify.1 $(INSTALLROOT)/usr/share/man/man1/ $(INSTALL) -d -m 755 $(INSTALLROOT)/etc/rpm/ $(INSTALL) -m 644 macros.pesign $(INSTALLROOT)/etc/rpm/ - $(INSTALL) -d -m 755 $(INSTALLROOT)/usr/lib/tmpfiles.d/ - $(INSTALL) -m 644 tmpfiles.conf $(INSTALLROOT)/usr/lib/tmpfiles.d/pesign.conf - $(INSTALL) -d -m 755 $(INSTALLROOT)/usr/lib/systemd/system/ - $(INSTALL) -m 644 pesign.service $(INSTALLROOT)/usr/lib/systemd/system/ .PHONY: all deps clean install diff --git a/src/pesign.sysvinit b/src/pesign.sysvinit new file mode 100644 index 0000000..f955e01 --- /dev/null +++ b/src/pesign.sysvinit @@ -0,0 +1,82 @@ +#! /bin/sh +# +# pesign This starts the pesign PE signing daemon +# +# chkconfig: - 50 50 +# processname: /usr/bin/pesign +# pidfile: /var/run/pesign.pid +### BEGIN INIT INFO +# Provides: pesign +# Default-Start: +# Default-Stop: +# Short-Description: The pesign PE signing daemon +# Description: The pesign PE signing daemon +### END INIT INFO + +. /etc/init.d/functions +[ -f /usr/bin/pesign ] || exit 1 + +RETVAL=0 + +start(){ + echo -n "Starting pesign: " + daemon /usr/bin/pesign --daemonize + RETVAL=$? + echo + touch /var/lock/subsys/pesign +} + +stop(){ + echo -n "Stopping pesign: " + killproc -p /var/run/pesign.pid pesignd + RETVAL=$? + echo + rm -f /var/lock/subsys/pesign +} + +restart(){ + stop + start +} + +reload(){ + stop + start +} + +condrestart(){ + [ -e /var/lock/subsys/pesign ] && restart +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status /usr/bin/pesign + ;; + restart) + restart + ;; + reload) + reload + ;; + force-reload) + reload + ;; + condrestart) + condrestart + ;; + try-restart) + condrestart + ;; + *) + echo "Usage: pesign {start|stop|status|restart|condrestart|reload}" + RETVAL=1 +esac + +exit $RETVAL -- 1.7.12.1