Skip to contentSkip to conversation

cyrus-sasl: fix bug and add systemd supported

PATCH New Bian Naimeng 1 participant 3 messages Feb 15, 2015

lore
Share & tools
lore
#0 lore raw

cover cyrus-sasl: fix bug and add systemd supported

Bian Naimeng (2):
cyrus-sasl: fix bug
cyrus-sasl: add systemd supported for saslauthd

 .../cyrus-sasl/cyrus-sasl/saslauthd.conf           | 11 ++++++++
 .../cyrus-sasl/cyrus-sasl/saslauthd.service        | 12 ++++++++
 .../cyrus-sasl/cyrus-sasl_2.1.26.bb                | 33 ++++++++++++++++++++--
 3 files changed, 53 insertions(+), 3 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl/saslauthd.conf
 create mode 100644 meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl/saslauthd.service
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 cyrus-sasl: fix bug

fix the following building error.

... snip ...

  install-exec-local: $(INSTALLOSX)
        @if test "$(plugindir)" != "$(prefix)/lib/sasl2"; then \
          echo "********************************************************"; \
          echo "* WARNING:"; \
          echo "* Plugins are being installed into $(prefix)/lib/sasl2,"; \
          echo "* but the library will look for them in $(plugindir)."; \
          echo "* You need to make sure that the plugins will eventually"; \
          echo "* be in $(plugindir) -- the easiest way is to make a"; \
          echo "* symbolic link from $(plugindir) to $(prefix)/lib/sasl2,"; \
          echo "* but this may not be appropriate for your site, so this"; \
          echo "* installation procedure won't do it for you."; \
          echo "*"; \
          echo "* If you don't want to do this for some reason, you can"; \
          echo "* set the location where the library will look for plugins"; \
          echo "* by setting the environment variable SASL_PATH to the path"; \
          echo "* the library should use."; \
          echo "********************************************************"; \
        fi
---
 meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +1 -1
index ea9cd1c..491ecdb 100644
@@ -18,7 +18,7 @@ EXTRA_OECONF += "--with-dblib=berkeley \
                  --with-bdb-libdir=${STAGING_LIBDIR} \
                  --with-bdb-incdir=${STAGING_INCDIR} \
                  --with-bdb=db-5.3 \
-                 --with-plugindir="${libdir}/sasl2/" \
+                 --with-plugindir="${libdir}/sasl2" \
                  andrew_cv_runpath_switch=none"
 
 PACKAGECONFIG ??= "ntlm \
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 cyrus-sasl: add systemd supported for saslauthd

In reply to Bian Naimeng
---
 .../cyrus-sasl/cyrus-sasl/saslauthd.conf           | 11 ++++++++
 .../cyrus-sasl/cyrus-sasl/saslauthd.service        | 12 +++++++++
 .../cyrus-sasl/cyrus-sasl_2.1.26.bb                | 31 ++++++++++++++++++++--
 3 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl/saslauthd.conf
 create mode 100644 meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl/saslauthd.service
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl/saslauthd.conf new file +11 -0
new file mode 100644
index 0000000..a91a9d3
@@ -0,0 +1,11 @@
+# Directory in which to place saslauthd's listening socket, pid file, and so
+# on.  This directory must already exist.
+SOCKETDIR=@LOCALSTATEDIR@/run/saslauthd
+
+# Mechanism to use when checking passwords.  Run "saslauthd -v" to get a list
+# of which mechanism your installation was compiled with the ablity to use.
+MECH=pam
+
+# Additional flags to pass to saslauthd on the command line.  See saslauthd(8)
+# for the list of accepted flags.
+FLAGS=
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl/saslauthd.service new file +12 -0
new file mode 100644
index 0000000..f20ef6e
@@ -0,0 +1,12 @@
+[Unit]
+Description=SASL authentication daemon.
+After=syslog.target 
+
+[Service]
+Type=forking
+PIDFile=@LOCALSTATEDIR@/run/saslauthd/saslauthd.pid
+EnvironmentFile=@SYSCONFDIR@/default/saslauthd
+ExecStart=@SBINDIR@/saslauthd -m $SOCKETDIR -a $MECH $FLAGS
+
+[Install]
+WantedBy=multi-user.target
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +29 -2
index 491ecdb..c235a1b 100644
@@ -10,9 +10,11 @@ SRC_URI = "ftp://ftp.cyrusimap.org/cyrus-sasl/cyrus-sasl-${PV}.tar.gz \
 	   file://debian_patches_0009_sasldb_al.diff \
 	   file://debian_patches_0014_avoid_pic_overwrite.diff \
 	   file://sasl.h-include-stddef.h-for-size_t-on-NetBSD.patch \
+	   file://saslauthd.service \
+	   file://saslauthd.conf \
 	   "
 
-inherit autotools-brokensep pkgconfig useradd
+inherit autotools-brokensep pkgconfig useradd systemd
 
 EXTRA_OECONF += "--with-dblib=berkeley \
                  --with-bdb-libdir=${STAGING_LIBDIR} \
@@ -51,17 +53,42 @@ do_compile_prepend () {
     cd ..
 }
 
+do_install_append() {
+    if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        install -d ${D}${systemd_unitdir}/system
+        install -m 0644 ${WORKDIR}/saslauthd.service ${D}${systemd_unitdir}/system
+
+        sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/saslauthd.service
+        sed -i -e 's#@LOCALSTATEDIR@#${localstatedir}#g' ${D}${systemd_unitdir}/system/saslauthd.service
+        sed -i -e 's#@SYSCONFDIR@#${sysconfdir}#g' ${D}${systemd_unitdir}/system/saslauthd.service
+
+        install -d ${D}${sysconfdir}/tmpfiles.d
+        echo "d /run/saslauthd/ - - - -" > ${D}${sysconfdir}/tmpfiles.d/saslauthd.conf
+
+        install -d ${D}${sysconfdir}/default/
+        install -m 0644 ${WORKDIR}/saslauthd.conf ${D}${sysconfdir}/default/saslauthd
+        sed -i -e 's#@LOCALSTATEDIR@#${localstatedir}#g' ${D}${sysconfdir}/default/saslauthd
+    fi
+}
+
 USERADD_PACKAGES = "${PN}-bin"
 GROUPADD_PARAM_${PN}-bin = "--system mail"
 USERADD_PARAM_${PN}-bin = "--system --home=/var/spool/mail -g mail cyrus"
 
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "saslauthd.service"
+SYSTEMD_AUTO_ENABLE = "disable"
+
 SRC_URI[md5sum] = "a7f4e5e559a0e37b3ffc438c9456e425"
 SRC_URI[sha256sum] = "8fbc5136512b59bb793657f36fadda6359cae3b08f01fd16b3d406f1345b7bc3"
 
 PACKAGES =+ "${PN}-bin"
 
 FILES_${PN}           += "${libdir}/sasl2/*.so*"
-FILES_${PN}-bin       += "${bindir}"
+FILES_${PN}-bin       += "${bindir} \
+                          ${sysconfdir}/default/saslauthd \
+                          ${systemd_unitdir}/system/saslauthd.service \
+                          ${sysconfdir}/tmpfiles.d/saslauthd.conf"
 FILES_${PN}-dev       += "${libdir}/sasl2/*.la"
 FILES_${PN}-dbg       += "${libdir}/sasl2/.debug"
 FILES_${PN}-staticdev += "${libdir}/sasl2/*.a"
Signature · 1 line
1.9.1