[SSSD] [PATCH] init script: source /etc/sysconfig/sssd

Jakub Hrozek jhrozek at redhat.com
Thu Aug 8 15:20:49 UTC 2013


On Tue, Jun 25, 2013 at 05:07:41PM +0200, Jakub Hrozek wrote:
> On Tue, Jun 25, 2013 at 03:31:03PM +0200, Jakub Hrozek wrote:
> > On Tue, Jun 25, 2013 at 09:09:42AM -0400, Stephen Gallagher wrote:
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > > 
> > > On 06/25/2013 05:40 AM, Pavel Březina wrote:
> > > > On 06/24/2013 03:37 PM, Jakub Hrozek wrote:
> > > >> On Mon, Jun 24, 2013 at 03:34:19PM +0200, Pavel Březina wrote:
> > > >>> https://fedorahosted.org/sssd/ticket/1959
> > > >>> 
> > > >>> Is there anyway how to achieve this in systemd?
> > > >> 
> > > >> Yes, see EnvironmentFile
> > > >> 
> > > >>> Do we want the path configurable?
> > > >> 
> > > >> Yes, we do.
> > > > 
> > > > Thanks, new patch is attached.
> > > > 
> > > 
> > > Looks correct to me. Pavel informed me off-list that the "-" in the
> > > unit file indicates "use it if it exists".
> > > 
> > > Ack.
> > 
> > I tested both sysv and init script (just the default configure value,
> > though) and they seem to be working fine:
> > 
> > # cat /etc/sysconfig/sssd 
> > FOO=BAR
> > # cat /proc/$(pidof sssd)/environ
> > BOOT_IMAGE=/vmlinuz-3.9.5-301.fc19.x86_64SYSFONT=TrueKEYTABLE=usLANG=en_US.UTF-8PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/binFOO=BAR
> 
> Pushed to master

Hi,

attached is a 1.9 backport for review. Cherry picking the patch didn't
go cleanly, so I'd like to get a quick review before pushing the patch.
-------------- next part --------------
>From bc3472a58868057b62edf40f22c5338689eda31c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina at redhat.com>
Date: Mon, 24 Jun 2013 15:30:04 +0200
Subject: [PATCH] init script: source /etc/sysconfig/sssd

https://fedorahosted.org/sssd/ticket/1959
---
 configure.ac                     |  1 +
 src/conf_macros.m4               | 13 +++++++++++++
 src/sysv/sssd                    |  4 ++++
 src/sysv/systemd/sssd.service.in |  1 +
 4 files changed, 19 insertions(+)

diff --git a/configure.ac b/configure.ac
index 70671ae7c7d51ca26285c9012800c4ca2642cee8..563aab303a81cf4b173758fb26919f31820f31d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,7 @@ WITH_PIPE_PATH
 WITH_MCACHE_PATH
 WITH_DEFAULT_CCACHE_DIR
 WITH_DEFAULT_CCNAME_TEMPLATE
+WITH_ENVIRONMENT_FILE
 WITH_INIT_DIR
 WITH_TEST_DIR
 WITH_MANPAGES
diff --git a/src/conf_macros.m4 b/src/conf_macros.m4
index 65f4d6ce9abf3f20d93f08cb9f18cd4f077dfa77..4766930eac325443ac3df8088300538461ede449 100644
--- a/src/conf_macros.m4
+++ b/src/conf_macros.m4
@@ -152,6 +152,19 @@ AC_DEFUN([WITH_INITSCRIPT],
   AC_MSG_NOTICE([Will use init script type: $initscript])
   ])
 
+AC_DEFUN([WITH_ENVIRONMENT_FILE],
+  [ AC_ARG_WITH([environment_file],
+                [AC_HELP_STRING([--with-environment-file=PATH], [Path to environment file [/etc/sysconfig/sssd]])
+                ]
+               )
+
+    ENVIRONMENT_FILE_PATH="${sysconfdir}/sysconfig/sssd"
+    if test x"$with_environment_file" != x; then
+        ENVIRONMENT_FILE_PATH=$with_environment_file
+    fi
+    AC_SUBST(environment_file, [$ENVIRONMENT_FILE_PATH])
+  ])
+
 AC_DEFUN([WITH_INIT_DIR],
   [ AC_ARG_WITH([init-dir],
                 [AC_HELP_STRING([--with-init-dir=DIR],
diff --git a/src/sysv/sssd b/src/sysv/sssd
index ca929e9ec62d179fc35d22b915d5ca965d515edd..e9930dd463ae5edcb8f13c7dc47c8e9cac147259 100644
--- a/src/sysv/sssd
+++ b/src/sysv/sssd
@@ -31,6 +31,10 @@ prog="sssd"
 # Source function library.
 . /etc/init.d/functions
 
+if [ -f @environment_file@ ]; then
+    . @environment_file@
+fi
+
 SSSD=/usr/sbin/sssd
 
 LOCK_FILE=/var/lock/subsys/sssd
diff --git a/src/sysv/systemd/sssd.service.in b/src/sysv/systemd/sssd.service.in
index 30592afe2ebd184b1802468467540c73a11de438..3c1410972b9232859dcb963c23b5472ebc781309 100644
--- a/src/sysv/systemd/sssd.service.in
+++ b/src/sysv/systemd/sssd.service.in
@@ -4,6 +4,7 @@ Description=System Security Services Daemon
 After=syslog.target
 
 [Service]
+EnvironmentFile=- at environment_file@
 ExecStart=@sbindir@/sssd -D -f
 # These two should be used with traditional UNIX forking daemons
 # consult systemd.service(5) for more details
-- 
1.8.3.1



More information about the sssd-devel mailing list