pcp
[Top] [All Lists]

[PATCH] respect configured prefix instead of hardcoded /etc

To: pcp@xxxxxxxxxxx
Subject: [PATCH] respect configured prefix instead of hardcoded /etc
From: James Peach <jamespeach@xxxxxxx>
Date: Thu, 3 Apr 2008 13:26:32 -0700
Sender: pcp-bounce@xxxxxxxxxxx
commit f3d97e64f2774ea4414c0556e17d7fdd83e30df6
Author: James Peach <jpeach@xxxxxxxxx>
Date:   Thu Apr 3 13:22:11 2008 -0700

    Use the prefix-relative etc directory instead of harcoding /etc.

diff --git a/GNUmakefile b/GNUmakefile
index a945efd..077f105 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -104,6 +104,7 @@ endif
        $(INSTALL) -m 755 -d $(PCP_SHARE_DIR)/lib
        $(INSTALL) -m 755 -d $(PCP_SHARE_DIR)/examples
        $(INSTALL) -m 755 -d $(PCP_INC_DIR)
+       $(INSTALL) -m 755 -d $(PCP_ETC_DIR)
        $(INSTALL) -m 755 -d $(PCP_VAR_DIR)
        $(INSTALL) -m 755 -d $(PCP_VAR_DIR)/config
        $(INSTALL) -m 755 -d $(PCP_VAR_DIR)/config/pmchart
diff --git a/configure.in b/configure.in
index 5587a11..d75647a 100644
--- a/configure.in
+++ b/configure.in
@@ -1151,15 +1151,7 @@ if test ! -z "$PCP_ETC_DIR"
 then
     pcp_etc_dir=$PCP_ETC_DIR
 else
-    if test -d /etc
-    then
-       pcp_etc_dir=/etc
-    else
-       echo "FATAL ERROR: could not find /etc directory."
-       echo "You need to set \$PCP_ETC_DIR in the environment"
-       echo "as the path to the directory containing \"pcp.conf\"."
-       exit 1
-    fi
+    pcp_etc_dir=`eval echo $sysconfdir`
 fi
 AC_SUBST(pcp_etc_dir)

@@ -1240,12 +1232,12 @@ then
     pcp_pmloggercontrol_path=$pcp_var_dir/config/pmlogger/control
 elif test $target_os = darwin -o $target_distro = debian
 then
-    pcp_pmcdconf_path=/etc/pmcd/pmcd.conf
-    pcp_pmcdrclocal_path=/etc/pmcd/rc.local
-    pcp_pmcdoptions_path=/etc/pmcd/pmcd.options
-    pcp_pmproxyoptions_path=/etc/pmproxy/pmproxy.options
-    pcp_pmiecontrol_path=/etc/pmie/control
-    pcp_pmloggercontrol_path=/etc/pmlogger/control
+    pcp_pmcdconf_path=$pcp_etc_dir/pmcd/pmcd.conf
+    pcp_pmcdrclocal_path=$pcp_etc_dir/pmcd/rc.local
+    pcp_pmcdoptions_path=$pcp_etc_dir/pmcd/pmcd.options
+    pcp_pmproxyoptions_path=$pcp_etc_dir/pmproxy/pmproxy.options
+    pcp_pmiecontrol_path=$pcp_etc_dir/pmie/control
+    pcp_pmloggercontrol_path=$pcp_etc_dir/pmlogger/control
 else
     pcp_pmcdconf_path=$pcp_var_dir/config/pmcd/pmcd.conf
     pcp_pmcdrclocal_path=$pcp_var_dir/config/pmcd/rc.local
diff --git a/src/include/GNUmakefile b/src/include/GNUmakefile
index 49309e4..3e1f163 100644
--- a/src/include/GNUmakefile
+++ b/src/include/GNUmakefile
@@ -43,8 +43,8 @@ include $(BUILDRULES)
 install :: default_pcp install_pcp

install_pcp : default_pcp
- $(INSTALL) -m 644 pcp.conf /etc/pcp.conf
- $(INSTALL) -m 644 pcp.env /etc/pcp.env
+ $(INSTALL) -m 644 pcp.conf $(PCP_ETC_DIR)/pcp.conf
+ $(INSTALL) -m 644 pcp.env $(PCP_ETC_DIR)/pcp.env
$(INSTALL) -m 644 $(HFILES) $(GENERATED_HFILES) buildrules $ (PCP_INC_DIR)
$(INSTALL) -m 644 builddefs.install $(PCP_INC_DIR)/builddefs


diff --git a/src/include/pcp.conf.in b/src/include/pcp.conf.in
index d028f53..93ec70f 100644
--- a/src/include/pcp.conf.in
+++ b/src/include/pcp.conf.in
@@ -39,6 +39,10 @@
 # default on the platform on which this file is installed.
 #

+# directory for config files
+# Standard path: /etc
+PCP_ETC_DIR=@pcp_etc_dir@
+
 # directory for rc/startup scripts
 # Standard path: /etc/init.d
 PCP_RC_DIR=@pcp_rc_dir@


<Prev in Thread] Current Thread [Next in Thread>