Bug 1385249

Summary: /etc/sysconfig is redhat specific and does not exist in debian or arch
Product: [Community] GlusterFS Reporter: Joe Julian <joe>
Component: buildAssignee: Kaleb KEITHLEY <kkeithle>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: mainlineCC: bugs, kkeithle
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-12 12:45:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joe Julian 2016-10-15 16:05:57 UTC
I propose a solution like this but there are several other places /etc/sysconfig are used that are either not processed by configure or probably doesn't really matter.

diff --git a/configure.ac b/configure.ac
index 8aa07ff..7bd00de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,19 @@ AM_INIT_AUTOMAKE(tar-pax)
 #but libglusterfs fails to build with contrib (Then are not set up that way?)
 #AM_INIT_AUTOMAKE([subdir-objects])
 
+AC_ARG_VAR(initconfdir, [directory for initscripts configuration, if enabled])
+
+# Try to detect the appropriate conf dir. Several systems have both /etc/default
+# and /etc/sysconfig but latter is always primary.
+if test "x$do_initscripts" = xyes; then
+if test "x$initconfdir" = x; then
+AC_CHECK_FILE(/etc/conf.d, [initconfdir='$(sysconfdir)/conf.d}'], [# Gentoo/Arch
+AC_CHECK_FILE(/etc/sysconfig, [initconfdir='$(sysconfdir)/sysconfig'], [# RedHat/Fedora/Slax/Mandriva/S
+AC_CHECK_FILE(/etc/default, [initconfdir='$(sysconfdir)/default'], [# Debian/Ubuntu
+AC_MSG_ERROR([could not determine system initscripts config dir; please set initconfdir manually.])])])
+fi
+fi
+
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
 
 if make --help 2>&1 | grep -q no-print-directory; then
diff --git a/extras/systemd/glusterd.service.in b/extras/systemd/glusterd.service.in
index 26694cf..40a2928 100644
--- a/extras/systemd/glusterd.service.in
+++ b/extras/systemd/glusterd.service.in
@@ -9,7 +9,7 @@ Type=forking
 PIDFile=@localstatedir@/run/glusterd.pid
 LimitNOFILE=65536
 Environment="LOG_LEVEL=INFO"
-EnvironmentFile=-@sysconfdir@/sysconfig/glusterd
+EnvironmentFile=-@initconfdir@/glusterd
 ExecStart=@prefix@/sbin/glusterd -p @localstatedir@/run/glusterd.pid  --log-level $LOG_LEVEL $GLUSTERD_
 KillMode=process

Comment 1 Amar Tumballi 2019-06-17 04:57:51 UTC
I see that sysconfig dir is now used only in glusterfs.spec file. Should this issue be closed?

Comment 2 Kaleb KEITHLEY 2019-06-17 11:31:21 UTC
(In reply to Amar Tumballi from comment #1)
> I see that sysconfig dir is now used only in glusterfs.spec file. Should
> this issue be closed?

It's still wrong in the glusterd.service(.in) file, so probably not. 

the glusterd.service(.in) on debian/ubuntu/arch is modified during .deb package building. (E.g. line 31 of https://github.com/gluster/glusterfs-debian/blob/bionic-glusterfs-6/debian/rules)


That's fine for people that install from .deb packages.

But anyone who just builds+installs from source will have a broken glusterd.service file.

It would be better to really fix it (in autoconf/configure) and then the package build edit step can be removed.

Comment 3 Worker Ant 2020-03-12 12:45:35 UTC
This bug is moved to https://github.com/gluster/glusterfs/issues/940, and will be tracked there from now on. Visit GitHub issues URL for further details