diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2019-04-28 09:54:45 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2019-04-28 09:54:45 +0100 |
commit | b7ebc951da8800f711142f69d9d958bde67a112d (patch) | |
tree | e318514216845acb8f2e49fff7a5cba4027e9d91 /mail-filter/opendkim/files | |
parent | dc7cbdfa65fd814b3b9aa3c56257da201109e807 (diff) |
gentoo resync : 28.04.2019
Diffstat (limited to 'mail-filter/opendkim/files')
-rw-r--r-- | mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch | 295 | ||||
-rw-r--r-- | mail-filter/opendkim/files/opendkim-2.10.3-openssl-1.1.1.patch.r2 | 170 | ||||
-rw-r--r-- | mail-filter/opendkim/files/opendkim-r1.service | 15 | ||||
-rw-r--r-- | mail-filter/opendkim/files/opendkim.init.r3 | 55 |
4 files changed, 465 insertions, 70 deletions
diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch b/mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch new file mode 100644 index 000000000000..9b645ba0f0ce --- /dev/null +++ b/mail-filter/opendkim/files/opendkim-2.10.3-openrc.patch @@ -0,0 +1,295 @@ +diff --git a/Makefile.am b/Makefile.am +index ee2d21ab..b085b988 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -39,6 +39,52 @@ DISTCLEANFILES = opendkim-@VERSION@.tar.gz + # though. + DISTCHECK_CONFIGURE_FLAGS=--enable-vbr --with-lua --enable-stats --with-odbx --with-db --with-openssl=/usr/local --enable-atps --enable-replace_rules + ++ ++# ++# Handle some scripts and configuration files that need @VARIABLE@ ++# replacements here, so that we can share the rules (which are ++# identical) between all of the targets. ++# ++ ++# We want to *build and install* these on the target machine. ++nodist_doc_DATA = contrib/OpenRC/opendkim.openrc \ ++ contrib/systemd/opendkim.service \ ++ contrib/systemd/opendkim.tmpfiles \ ++ opendkim/opendkim.conf.simple \ ++ opendkim/opendkim.conf.simple-verify ++ ++# Custom variable to keep the rule below as sane as possible. ++doc_DATA_intermediate = contrib/OpenRC/opendkim.openrc.in ++ ++# We want to *ship* these. ++EXTRA_DIST = contrib/OpenRC/opendkim.openrc.in.in \ ++ contrib/systemd/opendkim.service.in \ ++ contrib/systemd/opendkim.tmpfiles.in \ ++ opendkim/opendkim.conf.simple.in \ ++ opendkim/opendkim.conf.simple-verify.in ++ ++# The next rule allow us to replace bindir, libdir, etc. within ++# files. The example is taken from the autoconf documentation and can ++# be found in the "Installation Directory Variables" section. ++edit = sed -e 's|@DOMAIN[@]|$(DOMAIN)|g' \ ++ -e 's|@RUNSTATEDIR[@]|$(runstatedir)|g' \ ++ -e 's|@SBINDIR[@]|$(sbindir)|g' \ ++ -e 's|@SYSCONFDIR[@]|$(sysconfdir)|g' ++ ++# This rule includes EVERY source/intermediate file as a dependency of ++# EVERY output file, which is clearly wrong, but it may be the best we ++# can do without duplication. At least it's the right kind of wrong, ++# and rebuilds too often rather than not often enough. ++$(nodist_doc_DATA): $(doc_DATA_intermediate) $(EXTRA_DIST) Makefile ++ rm -f $@ $@.tmp ++ srcdir=''; \ ++ test -f ./$@.in || srcdir=$(srcdir)/; \ ++ $(edit) $${srcdir}$@.in > $@.tmp ++ mv $@.tmp $@ ++ ++ ++ ++ + $(DIST_ARCHIVES): distcheck + + $(DIST_ARCHIVES).md5: $(DIST_ARCHIVES) +diff --git a/configure.ac b/configure.ac +index 76914fd9..a478bb83 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -65,6 +65,9 @@ AC_PROG_CC_C99 + AM_PROG_CC_C_O + AC_PROG_LIBTOOL + ++# Used by the OpenRC service script, at least. ++AC_PROG_GREP ++ + PKG_PROG_PKG_CONFIG + + # +@@ -2628,6 +2631,11 @@ AC_SUBST(SPECCONFIGURE) + AC_SUBST(SPECREQUIRES) + AC_SUBST(SPECBUILDREQUIRES) + ++# Autoconf 2.70 will support this, and many distros patch it in, ++# but Autoconf 2.70 hasn't actually been released yet. ++AS_IF([test -z "${runstatedir}"], [runstatedir='${localstatedir}/run']) ++AC_SUBST([runstatedir]) ++ + # + # Finish up + # +@@ -2639,6 +2647,7 @@ AC_OUTPUT([ Makefile + contrib/docs/Makefile + contrib/init/Makefile + contrib/init/generic/Makefile ++ contrib/OpenRC/opendkim.openrc.in + contrib/init/redhat/Makefile + contrib/init/redhat/opendkim + contrib/init/redhat/opendkim-default-keygen +@@ -2650,8 +2659,6 @@ AC_OUTPUT([ Makefile + contrib/spec/Makefile + contrib/spec/opendkim.spec + contrib/stats/Makefile +- contrib/systemd/Makefile +- contrib/systemd/opendkim.service + libopendkim/opendkim.pc libopendkim/Makefile + libopendkim/docs/Makefile + libopendkim/tests/Makefile +@@ -2664,8 +2671,6 @@ AC_OUTPUT([ Makefile + opendkim/opendkim-lua.3 + opendkim/opendkim-testkey.8 opendkim/opendkim-stats.8 + opendkim/opendkim-testmsg.8 opendkim/opendkim.conf.5 +- opendkim/opendkim.conf.simple +- opendkim/opendkim.conf.simple-verify + opendkim/opendkim-atpszone.8 opendkim/opendkim-spam.1 + opendkim/tests/Makefile + stats/Makefile stats/opendkim-importstats.8 +diff --git a/contrib/Makefile.am b/contrib/Makefile.am +index 76df01cd..401130bb 100644 +--- a/contrib/Makefile.am ++++ b/contrib/Makefile.am +@@ -3,6 +3,6 @@ + + #AUTOMAKE_OPTIONS = foreign + +-SUBDIRS = convert docs init ldap lua patches repute spec stats systemd ++SUBDIRS = convert docs init ldap lua patches repute spec stats + + dist_doc_DATA = README +diff --git a/contrib/OpenRC/opendkim.openrc.in.in b/contrib/OpenRC/opendkim.openrc.in.in +new file mode 100644 +index 00000000..4b783615 +--- /dev/null ++++ b/contrib/OpenRC/opendkim.openrc.in.in +@@ -0,0 +1,54 @@ ++#!/sbin/openrc-run ++# Copyright 1999-2019 Gentoo Authors ++# Distributed under the terms of the GNU General Public License v2 ++ ++CONFFILE="@SYSCONFDIR@/${RC_SVCNAME}.conf" ++required_files="${CONFFILE}" ++ ++command="@SBINDIR@/opendkim" ++pidfile="@RUNSTATEDIR@/${RC_SVCNAME}.pid" ++command_args="-P ${pidfile} -x ${CONFFILE}" ++extra_commands="checkconfig" ++ ++depend() { ++ use dns logger net ++ before mta ++} ++ ++checkconfig() { ++ # ++ # The opendkim.conf man page says, ++ # ++ # For parameters that are Boolean in nature, only the first byte ++ # of the value is processed... For negative values, the following ++ # are accepted: "F", "f", "N", "n", "0".' ++ # ++ if @GREP@ '^[[:space:]]*Background[[:space:]]\+[FfNn0]' "${CONFFILE}" \ ++ >/dev/null 2>&1; then ++ eend 1 "${RC_SVCNAME} cannot run in the foreground!" ++ fi ++ if ! "${command}" -n "${command_args}"; then ++ eend 1 "${RC_SVCNAME} configuration check failed" ++ fi ++} ++ ++start_pre() { ++ # If this isn't a restart, make sure that the user's config isn't ++ # busted before we try to start the daemon (this will produce ++ # better error messages than if we just try to start it blindly). ++ # ++ # If, on the other hand, this *is* a restart, then the stop_pre ++ # action will have ensured that the config is usable and we don't ++ # need to do that again. ++ if [ "${RC_CMD}" != "restart" ]; then ++ checkconfig || return $? ++ fi ++} ++ ++stop_pre() { ++ # If this is a restart, check to make sure the user's config ++ # isn't busted before we stop the running daemon. ++ if [ "${RC_CMD}" = "restart" ]; then ++ checkconfig || return $? ++ fi ++} +diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am +deleted file mode 100644 +index 2ffc88cc..00000000 +--- a/contrib/systemd/Makefile.am ++++ /dev/null +@@ -1,3 +0,0 @@ +-# Copyright (c) 2013, The Trusted Domain Project. All rights reserved. +- +-dist_doc_DATA = opendkim.service +diff --git a/contrib/systemd/opendkim.service.in b/contrib/systemd/opendkim.service.in +index f7665f43..236f8a06 100644 +--- a/contrib/systemd/opendkim.service.in ++++ b/contrib/systemd/opendkim.service.in +@@ -1,20 +1,28 @@ +-# If you are using OpenDKIM with SQL datasets it might be necessary to start OpenDKIM after the database servers. +-# For example, if using both MariaDB and PostgreSQL, change "After=" in the "[Unit]" section to: +-# After=network.target nss-lookup.target syslog.target mariadb.service postgresql.service ++# If you are using OpenDKIM with SQL datasets, you should start ++# OpenDKIM after your database server. For example, when using ++# PostgreSQL, you should create a supplementary ".conf" file in the ++# appropriate directory containing, ++# ++# [Unit] ++# After=postgresql.service ++# + + [Unit] + Description=DomainKeys Identified Mail (DKIM) Milter +-Documentation=man:opendkim(8) man:opendkim.conf(5) man:opendkim-genkey(8) man:opendkim-genzone(8) man:opendkim-testadsp(8) man:opendkim-testkey http://www.opendkim.org/docs.html ++Documentation=man:opendkim(8) \ ++ man:opendkim.conf(5) \ ++ man:opendkim-genkey(8) \ ++ man:opendkim-genzone(8) \ ++ man:opendkim-testkey(8) \ ++ http://www.opendkim.org/docs.html + After=network.target nss-lookup.target syslog.target + + [Service] + Type=forking +-PIDFile=@localstatedir@/run/opendkim/opendkim.pid +-EnvironmentFile=-@sysconfdir@/sysconfig/opendkim +-ExecStart=@sbindir@/opendkim $OPTIONS ++ExecStart=@SBINDIR@/opendkim -P @RUNSTATEDIR@/opendkim.pid ++ExecStartPre=@SBINDIR@/opendkim -P @RUNSTATEDIR@/opendkim.pid -n -f + ExecReload=/bin/kill -USR1 $MAINPID +-User=opendkim +-Group=opendkim ++PIDFile=@RUNSTATEDIR@/opendkim.pid + + [Install] + WantedBy=multi-user.target +diff --git a/contrib/systemd/opendkim.tmpfiles.in b/contrib/systemd/opendkim.tmpfiles.in +new file mode 100644 +index 00000000..a9118974 +--- /dev/null ++++ b/contrib/systemd/opendkim.tmpfiles.in +@@ -0,0 +1,5 @@ ++# We allow everyone to read/traverse this directory because if it ++# contains a local socket, then (for example) your MTA will want to ++# look in there. Permissions on the socket itself are controlled ++# by the "UserID" and "UMask" directives in the daemon's configuration. ++d @RUNSTATEDIR@/opendkim 0755 opendkim opendkim +diff --git a/opendkim/Makefile.am b/opendkim/Makefile.am +index 4aa615c1..7d514771 100644 +--- a/opendkim/Makefile.am ++++ b/opendkim/Makefile.am +@@ -16,9 +16,11 @@ endif + sbin_PROGRAMS += opendkim-stats + endif + ++ + dist_sbin_SCRIPTS = opendkim-genkey +-dist_doc_DATA = opendkim.conf.sample opendkim.conf.simple \ +- opendkim.conf.simple-verify README.SQL ++ ++dist_doc_DATA = opendkim.conf.sample README.SQL ++ + + if BUILD_FILTER + sbin_PROGRAMS += opendkim +diff --git a/opendkim/opendkim.conf.simple-verify.in b/opendkim/opendkim.conf.simple-verify.in +index 2224b64f..463048ab 100644 +--- a/opendkim/opendkim.conf.simple-verify.in ++++ b/opendkim/opendkim.conf.simple-verify.in +@@ -17,5 +17,5 @@ Mode v + + # ADSPDiscard no + +-# PidFile /var/run/opendkim/opendkim.pid ++# PidFile @RUNSTATEDIR@/opendkim.pid + +diff --git a/opendkim/opendkim.conf.simple.in b/opendkim/opendkim.conf.simple.in +index 735b924b..b70bfb46 100644 +--- a/opendkim/opendkim.conf.simple.in ++++ b/opendkim/opendkim.conf.simple.in +@@ -12,6 +12,12 @@ KeyFile /var/db/dkim/@DOMAIN@.private + + Socket inet:8891@localhost + ++# To use a local socket instead, specify a path here. The "standard" ++# location is under @runstatedir@/opendkim, and it's best to agree ++# on that directory so that various init systems can configure its ++# permissions and ownership automatically. ++#Socket local:@RUNSTATEDIR@/opendkim/opendkim.sock ++ + ReportAddress postmaster@@DOMAIN@ + SendReports yes + +@@ -25,4 +31,4 @@ SendReports yes + # + # PeerList X.X.X.X + +-# PidFile /var/run/opendkim/opendkim.pid ++# PidFile @RUNSTATEDIR@/opendkim.pid diff --git a/mail-filter/opendkim/files/opendkim-2.10.3-openssl-1.1.1.patch.r2 b/mail-filter/opendkim/files/opendkim-2.10.3-openssl-1.1.1.patch.r2 new file mode 100644 index 000000000000..cc8f48bae2db --- /dev/null +++ b/mail-filter/opendkim/files/opendkim-2.10.3-openssl-1.1.1.patch.r2 @@ -0,0 +1,170 @@ +From FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223568 +--- a/configure.ac 2015-05-12 18:43:09 UTC ++++ b/configure.ac +@@ -860,26 +860,28 @@ then + AC_SEARCH_LIBS([ERR_peek_error], [crypto], , + AC_MSG_ERROR([libcrypto not found])) + +- AC_SEARCH_LIBS([SSL_library_init], [ssl], , +- [ +- if test x"$enable_shared" = x"yes" +- then +- AC_MSG_ERROR([Cannot build shared opendkim +- against static openssl libraries. +- Configure with --disable-shared +- to get this working or obtain a +- shared libssl library for +- opendkim to use.]) +- fi + +- # avoid caching issue - last result of SSL_library_init +- # shouldn't be cached for this next check +- unset ac_cv_search_SSL_library_init +- LIBCRYPTO_LIBS="$LIBCRYPTO_LIBS -ldl" +- AC_SEARCH_LIBS([SSL_library_init], [ssl], , +- AC_MSG_ERROR([libssl not found]), [-ldl]) +- ] +- ) ++ AC_LINK_IFELSE( ++ [AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], ++ [[SSL_library_init();]])], ++ [od_have_ossl="yes";], ++ [od_have_ossl="no";]) ++ if test x"$od_have_ossl" = x"no" ++ then ++ if test x"$enable_shared" = x"yes" ++ then ++ AC_MSG_ERROR([Cannot build shared opendkim ++ against static openssl libraries. ++ Configure with --disable-shared ++ to get this working or obtain a ++ shared libssl library for ++ opendkim to use.]) ++ fi ++ ++ LIBCRYPTO_LIBS="$LIBCRYPTO_LIBS -ldl" ++ AC_SEARCH_LIBS([SSL_library_init], [ssl], , ++ AC_MSG_ERROR([libssl not found]), [-ldl]) ++ fi + + AC_CHECK_DECL([SHA256_DIGEST_LENGTH], + AC_DEFINE([HAVE_SHA256], 1, +--- a/libopendkim/tests/Makefile.in 2015-05-12 18:43:48 UTC ++++ b/libopendkim/tests/Makefile.in +@@ -1108,8 +1108,10 @@ am__nobase_list = $(am__nobase_strip_setup); \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' + am__base_list = \ +- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ +- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' ++ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\ ++/ /g' | \ ++ sed '$$!N;$$!N;$$!N;$$!N;s/\ ++/ /g' + am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ +@@ -4131,16 +4133,19 @@ uninstall-am: uninstall-dist_docDATA + @LCOV_TRUE@description.txt: $(check_PROGRAMS) $(check_SCRIPTS) + @LCOV_TRUE@ rm -f $@ + @LCOV_TRUE@ for i in $(check_PROGRAMS); do \ +-@LCOV_TRUE@ testname=$${i/t-}; \ +-@LCOV_TRUE@ testname=$${testname//-/_}; \ ++@LCOV_TRUE@ testname=$${i#t-}; \ ++@LCOV_TRUE@ testname=$$(echo $${testname} | sed -e 's/-/_/g'); \ + @LCOV_TRUE@ fgrep '***' $$i.c | tail -n 1 | \ +-@LCOV_TRUE@ (echo $${testname} ; sed -e 's/[^*]*\*\*\*\(.*\)\\n.*/\t\1\n/g' ) >> $@; \ ++@LCOV_TRUE@ (echo $${testname} ; sed -e 's/[^*]*\*\*\*\(.*\)\\ ++@LCOV_TRUE@.*/ \1\ ++@LCOV_TRUE@/g' ) >> $@; \ + @LCOV_TRUE@ done + @LCOV_TRUE@ for i in $(check_SCRIPTS); do \ +-@LCOV_TRUE@ testname=$${i/t-}; \ +-@LCOV_TRUE@ testname=$${testname//-/_}; \ ++@LCOV_TRUE@ testname=$${i#t-}; \ ++@LCOV_TRUE@ testname=$$(echo $${testname} | sed -e 's/-/_/g'); \ + @LCOV_TRUE@ grep '^#' $$i | tail -n 1 | \ +-@LCOV_TRUE@ (echo $${testname} ; sed -e 's/^# \(.*\)/\t\1\n/g' ) >> $@; \ ++@LCOV_TRUE@ (echo $${testname} ; sed -e 's/^# \(.*\)/ \1\ ++@LCOV_TRUE@/g' ) >> $@; \ + @LCOV_TRUE@ done + + @LCOV_TRUE@description.html: description.txt +--- a/libopendkim/dkim-canon.c 2015-05-11 03:56:13 UTC ++++ b/libopendkim/dkim-canon.c +@@ -388,7 +388,7 @@ dkim_canon_header_string(struct dkim_dstring *dstr, dk + } + + /* skip all spaces before first word */ +- while (*p != '\0' && DKIM_ISWSP(*p)) ++ while (*p != '\0' && DKIM_ISLWSP(*p)) + p++; + + space = FALSE; /* just saw a space */ +--- a/opendkim/tests/Makefile.in 2015-05-12 18:43:49 UTC ++++ b/opendkim/tests/Makefile.in +@@ -139,8 +139,10 @@ am__nobase_list = $(am__nobase_strip_setup); \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' + am__base_list = \ +- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ +- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' ++ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\ ++/ /g' | \ ++ sed '$$!N;$$!N;$$!N;$$!N;s/\ ++/ /g' + am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ +@@ -1298,14 +1300,16 @@ uninstall-am: uninstall-dist_docDATA + @LCOV_TRUE@description.txt: $(check_SCRIPTS) + @LCOV_TRUE@ rm -f $@ + @LCOV_TRUE@ for test in $? ; do \ +-@LCOV_TRUE@ testname=$${test/t-}; \ +-@LCOV_TRUE@ testname=$${testname//-/_}; \ ++@LCOV_TRUE@ testname=$${test#t-}; \ ++@LCOV_TRUE@ testname=$$(echo $${testname} | sed -e 's/-/_/g'); \ + @LCOV_TRUE@ grep ^# $$test | tail -n 1 | \ +-@LCOV_TRUE@ sed -e "s/^#\(.*\)/$${testname}\n\t\1\n/g" >> $@; \ ++@LCOV_TRUE@ sed -e "s/^#\(.*\)/$${testname}\ ++@LCOV_TRUE@ \1\ ++@LCOV_TRUE@/g" >> $@; \ + @LCOV_TRUE@ done + + @LCOV_TRUE@description.html: description.txt +-@LCOV_TRUE@ gendesc --output $@ $< ++@LCOV_TRUE@ gendesc --output $@ $? + + @LCOV_TRUE@maintainer-clean-local: + @LCOV_TRUE@ -rm -rf lcov/[^C]* +--- a/opendkim/opendkim-crypto.c 2013-02-25 21:02:41 UTC ++++ b/opendkim/opendkim-crypto.c +@@ -222,7 +222,11 @@ dkimf_crypto_free_id(void *ptr) + { + assert(pthread_setspecific(id_key, ptr) == 0); + ++#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined (LIBRESSL_VERSION_NUMBER) ++ OPENSSL_thread_stop(); ++#else + ERR_remove_state(0); ++#endif + + free(ptr); + +@@ -392,11 +396,15 @@ dkimf_crypto_free(void) + { + if (crypto_init_done) + { ++#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined (LIBRESSL_VERSION_NUMBER) ++ OPENSSL_thread_stop(); ++#else + CRYPTO_cleanup_all_ex_data(); + CONF_modules_free(); + EVP_cleanup(); + ERR_free_strings(); + ERR_remove_state(0); ++#endif + + if (nmutexes > 0) + { + diff --git a/mail-filter/opendkim/files/opendkim-r1.service b/mail-filter/opendkim/files/opendkim-r1.service deleted file mode 100644 index f2e937a6bf16..000000000000 --- a/mail-filter/opendkim/files/opendkim-r1.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=DomainKeys Identified Mail (DKIM) Milter -Documentation=man:opendkim(8) man:opendkim.conf(5) man:opendkim-genkey(8) man:opendkim-genzone(8) man:opendkim-testadsp(8) man:opendkim-testkey http://www.opendkim.org/docs.html -After=network.target nss-lookup.target syslog.target - -[Service] -ExecStart=/usr/sbin/opendkim -f -x /etc/opendkim/opendkim.conf -ExecReload=/bin/kill -USR1 $MAINPID -RuntimeDirectory=opendkim -RuntimeDirectoryMode=0750 -User=milter -Group=milter - -[Install] -WantedBy=multi-user.target diff --git a/mail-filter/opendkim/files/opendkim.init.r3 b/mail-filter/opendkim/files/opendkim.init.r3 deleted file mode 100644 index bb8ac96f0570..000000000000 --- a/mail-filter/opendkim/files/opendkim.init.r3 +++ /dev/null @@ -1,55 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -CONFFILE=/etc/opendkim/${SVCNAME}.conf - -depend() { - use dns logger net - before mta -} - -check_cfg() { - - PIDFILE=$(sed -ne 's/^[[:space:]]*PidFile[[:space:]]\+//p' "${CONFFILE}") - local PIDDIR="${PIDFILE%/*}" - if [ ! -d "${PIDDIR}" ] ; then - checkpath -q -d -o milter:milter -m 0755 "${PIDDIR}" || return 1 - fi - if [ ! -f "${CONFFILE}" ] ; then - eerror "Configuration file ${CONFFILE} is missing" - return 1 - fi - if [ -z "${PIDFILE}" ] ; then - eerror "Configuration file needs PidFile setting - recommend adding 'PidFile /var/run/opendkim/${SVCNAME}.pid' to ${CONFFILE}" - return 1 - fi - - if egrep -q '^[[:space:]]*Background[[:space:]]+no' "${CONFFILE}" ; then - eerror "${SVCNAME} service cannot run with Background key set to yes!" - return 1 - fi -} - -start() { - check_cfg || return 1 - - # Remove stalled Unix socket if no other process is using it - local UNIX_SOCKET=$(sed -ne 's/^[[:space:]]*Socket[[:space:]]\+\(unix\|local\)://p' "${CONFFILE}") - - if [ -S "${UNIX_SOCKET}" ] && ! fuser -s "${UNIX_SOCKET}"; then - rm "${UNIX_SOCKET}" - fi - - ebegin "Starting OpenDKIM" - start-stop-daemon --start --pidfile "${PIDFILE}" \ - --exec /usr/sbin/opendkim -- -x "${CONFFILE}" - eend $? -} - -stop() { - check_cfg || return 1 - ebegin "Stopping OpenDKIM" - start-stop-daemon --stop --pidfile "${PIDFILE}" - eend $? -} |