El Viernes 16/06/2017 a las 13:20, Bill Pye escribió:
> ----- Original Message -----
>
> > From: "Ricardo J. Barberis" <[email protected]>
> > To: "kea-users" <[email protected]>
> > Sent: Friday, 16 June, 2017 17:23:26
> > Subject: Re: [Kea-users] Build spec file for CentOS7/RHEL
> >
> > El Viernes 16/06/2017 a las 09:37, Bill Pye escribió:
> >> Hi Everyone
> >>
> >> I've been using kea-1.1.0 from the epel repository for a few months now
> >> (and enjoying the experience) but I can't find any rpm builds for
> >> centos7/rhel I'm not good at producing or modifying spec files, does
> >> anyone know if a build of kea-1.2 will be available soon or possibly
> >> have a working spec file they could share?
> >
> > Here's the spec I made for 1.2.0, based on EPEL's spec for kea 1.1.0.
> >
> > I've been using it for a couple of weeks already, I can't make DHCPv6
> > work (see my other thread if you have any tips) but I couldn't make it
> > work with 1.1.0 either.
> >
> > Cheers!
>
> Hi Ricardo
>
> Thanks you for that file, it's very kind of you. Unfortunately I didn't
> have any success with it, it seems to be a problem with the patch:
>
> Patch #0 (kea-systemd.patch):
> + /usr/bin/patch --no-backup-if-mismatch -p1 -b --suffix .systemd --fuzz=0
> patching file configure.ac
> Hunk #1 succeeded at 1529 (offset 162 lines).
> patching file src/bin/keactrl/Makefile.am
> Hunk #1 FAILED at 32.
> Hunk #2 succeeded at 46 (offset 4 lines).
>
> This is where I got stuck before. This is on a centos7 server I think I've
> installed everything necessary, do you have any idea what the problem might
> be or where I should look?
>
> Regards
>
>
> bill

Sorry, here's the modified patch I used.

I knew I should have just attached the .src.rpm instead :)

Cheers,
-- 
Ricardo J. Barberis
Usuario Linux Nº 250625: http://counter.li.org/
Usuario LFS Nº 5121: http://www.linuxfromscratch.org/
Senior SysAdmin / IT Architect - www.DonWeb.com
From 683028b4f5dcf7fb443c85f331e319123f0027a5 Mon Sep 17 00:00:00 2001
From: Jiri Popelka <[email protected]>
Date: Wed, 1 Apr 2015 13:14:57 +0200
Subject: [PATCH] Systemd service unit files.

As of August 2014, all Linux distributions include systemd and most of
them enable it by default.
https://en.wikipedia.org/wiki/Systemd#Adoption

There are many systemd HOWTOs, like:
https://wiki.archlinux.org/index.php/systemd
https://coreos.com/docs/launching-containers/launching/getting-started-with-systemd/
https://fedoraproject.org/wiki/Packaging:Systemd

For description of options in the service files, see:
http://www.freedesktop.org/software/systemd/man/systemd.unit.html
http://www.freedesktop.org/software/systemd/man/systemd.service.html

Installation of these files is turned on with --enable-systemd
configure option. They are installed into
PREFIX/lib/systemd/system/ by default. One can also
use --with-systemd-unitdir to specify another directory.

For now the template files reside in src/bin/keactrl/
as I haven't figured out a better place.
---
 configure.ac                             | 12 ++++++++++
 src/bin/keactrl/Makefile.am              | 39 ++++++++++++++++++++++++++++++--
 src/bin/keactrl/kea-dhcp-ddns.service.in | 12 ++++++++++
 src/bin/keactrl/kea-dhcp4.service.in     | 12 ++++++++++
 src/bin/keactrl/kea-dhcp6.service.in     | 12 ++++++++++
 tools/path_replacer.sh.in                |  4 +++-
 6 files changed, 88 insertions(+), 3 deletions(-)
 create mode 100644 src/bin/keactrl/kea-dhcp-ddns.service.in
 create mode 100644 src/bin/keactrl/kea-dhcp4.service.in
 create mode 100644 src/bin/keactrl/kea-dhcp6.service.in

diff --git a/configure.ac b/configure.ac
index a2b0daf..aa614c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1367,6 +1367,18 @@ if test "x$VALGRIND" != "xno"; then
    found_valgrind="found"
 fi
 
+AC_ARG_ENABLE([systemd],
+       AS_HELP_STRING([--enable-systemd], [enable systemd support]),
+       [use_systemd=$enableval], [use_systemd=no])
+AM_CONDITIONAL(USE_SYSTEMD, test "x$use_systemd" != "xno")
+AC_SUBST(USE_SYSTEMD)
+
+AC_ARG_WITH([systemd-unitdir],
+       AS_HELP_STRING([--with-systemd-unitdir=PATH],
+                      [specify exact directory for systemd service files, defaults to PREFIX/lib/systemd/system/]),
+       [SYSTEMD_UNITDIR=$withval], [SYSTEMD_UNITDIR="${prefix}/lib/systemd/system"])
+AC_SUBST(SYSTEMD_UNITDIR)
+
 # Check for optreset in unistd.h. On BSD systems the optreset is
 # used to reset the state of getopt() function. Resetting its state
 # is required if command line arguments are parsed multiple times
diff --git a/src/bin/keactrl/Makefile.am b/src/bin/keactrl/Makefile.am
index ac2c894..9bd8ed0 100644
--- a/src/bin/keactrl/Makefile.am
+++ b/src/bin/keactrl/Makefile.am
@@ -35,10 +35,36 @@ kea.conf: kea.conf.pre
 kea-ca.conf: kea-ca.conf.pre
 	$(top_builddir)/tools/path_replacer.sh $(top_srcdir)/src/bin/keactrl/kea-ca.conf.pre $@
 
+INSTALL_TARGETS = install-empty
 
 if INSTALL_CONFIGURATIONS
 
-install-data-local:
+INSTALL_TARGETS += install-config-files
+
+endif
+
+if USE_SYSTEMD
+
+EXTRA_DIST += kea-dhcp4.service.in kea-dhcp6.service.in kea-dhcp-ddns.service.in
+DISTCLEANFILES += kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service
+BUILT_SOURCES += kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service
+INSTALL_TARGETS += install-systemd-files
+
+endif
+
+kea-dhcp4.service: kea-dhcp4.service.in
+	$(top_builddir)/tools/path_replacer.sh $< $@
+
+kea-dhcp6.service: kea-dhcp6.service.in
+	$(top_builddir)/tools/path_replacer.sh $< $@
+
+kea-dhcp-ddns.service: kea-dhcp-ddns.service.in
+	$(top_builddir)/tools/path_replacer.sh $< $@
+
+install-empty:
+	:
+
+install-config-files:
 	$(mkinstalldirs) $(DESTDIR)/@sysconfdir@/@PACKAGE@
 	for f in $(CONFIGFILES) ; do	\
 	  if test ! -f $(DESTDIR)$(sysconfdir)/@PACKAGE@/$$f; then	\
@@ -46,4 +72,12 @@ install-data-local:
 	  fi ;	\
 	done
 
-endif
+install-systemd-files:
+	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNITDIR)
+	$(INSTALL_DATA) kea-dhcp4.service $(DESTDIR)$(SYSTEMD_UNITDIR)/kea-dhcp4.service
+	$(INSTALL_DATA) kea-dhcp6.service $(DESTDIR)$(SYSTEMD_UNITDIR)/kea-dhcp6.service
+	$(INSTALL_DATA) kea-dhcp-ddns.service $(DESTDIR)$(SYSTEMD_UNITDIR)/kea-dhcp-ddns.service
+
+install-data-local: $(INSTALL_TARGETS)
+
+uninstall-local: $(UNINSTALL_TARGETS)
diff --git a/src/bin/keactrl/kea-dhcp-ddns.service.in b/src/bin/keactrl/kea-dhcp-ddns.service.in
new file mode 100644
index 0000000..d1e0526
--- /dev/null
+++ b/src/bin/keactrl/kea-dhcp-ddns.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Kea DHCP-DDNS Server
+Documentation=man:kea-dhcp-ddns(8)
+Wants=network-online.target
+After=network-online.target
+After=time-sync.target
+
+[Service]
+ExecStart=@sbindir@/kea-dhcp-ddns -c @sysconfdir@/kea/kea.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/src/bin/keactrl/kea-dhcp4.service.in b/src/bin/keactrl/kea-dhcp4.service.in
new file mode 100644
index 0000000..80977d6
--- /dev/null
+++ b/src/bin/keactrl/kea-dhcp4.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Kea DHCPv4 Server
+Documentation=man:kea-dhcp4(8)
+Wants=network-online.target
+After=network-online.target
+After=time-sync.target
+
+[Service]
+ExecStart=@sbindir@/kea-dhcp4 -c @sysconfdir@/kea/kea.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/src/bin/keactrl/kea-dhcp6.service.in b/src/bin/keactrl/kea-dhcp6.service.in
new file mode 100644
index 0000000..c24f584
--- /dev/null
+++ b/src/bin/keactrl/kea-dhcp6.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Kea DHCPv6 Server
+Documentation=man:kea-dhcp6(8)
+Wants=network-online.target
+After=network-online.target
+After=time-sync.target
+
+[Service]
+ExecStart=@sbindir@/kea-dhcp6 -c @sysconfdir@/kea/kea.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/path_replacer.sh.in b/tools/path_replacer.sh.in
index 43d7bff..82625ca 100644
--- a/tools/path_replacer.sh.in
+++ b/tools/path_replacer.sh.in
@@ -27,12 +27,14 @@
 prefix=@prefix@
 sysconfdir=@sysconfdir@
 localstatedir=@localstatedir@
+sbindir=@sbindir@
 
 echo "Replacing \@prefix\@ with ${prefix}"
 echo "Replacing \@sysconfdir\@ with ${sysconfdir}"
 echo "Replacing \@localstatedir\@ with ${localstatedir}"
+echo "Replacing \@sbindir\@ with ${sbindir}"
 
 echo "Input file: $1"
 echo "Output file: $2"
 
-sed -e "s@SEP@\@localstatedir\@@SEP@${localstatedir}@SEP@g; s@SEP@\@prefix\@@SEP@${prefix}@SEP@g; s@SEP@\@sysconfdir\@@SEP@${sysconfdir}@SEP@g" $1 > $2
+sed -e "s@SEP@\@localstatedir\@@SEP@${localstatedir}@SEP@g; s@SEP@\@prefix\@@SEP@${prefix}@SEP@g; s@SEP@\@sysconfdir\@@SEP@${sysconfdir}@SEP@g; s@SEP@\@sbindir\@@SEP@${sbindir}@SEP@g" $1 > $2
-- 
2.3.4

_______________________________________________
Kea-users mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/kea-users

Reply via email to