]> granicus.if.org Git - sysstat/commitdiff
configure: Add new conf_file variable
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 27 Sep 2019 15:44:19 +0000 (17:44 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 27 Sep 2019 16:17:06 +0000 (18:17 +0200)
This variable contains the name of sysstat main configuration file
(this file is named sysstat by default and is normally located in the
/etc/sysconfig directory)

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
Makefile.in
build/conf_file [new file with mode: 0644]
configure
configure.in
iconfig
sa1.in
sa2.in

index 300a83e9d38c73e45550d4b8736685a14a04bc6a..55c40be637e69e7497b2d18128387541bd040794 100644 (file)
@@ -75,6 +75,7 @@ endif
 
 NLS_DIR = $(PREFIX)/share/locale
 SYSCONFIG_DIR = @SYSCONFIG_DIR@
+SYSCONFIG_FILE = @SYSCONFIG_FILE@
 
 # Compiler flags
 CFLAGS = @CFLAGS@ -Wall -Wstrict-prototypes -pipe -O2
@@ -422,7 +423,7 @@ endif
        $(INSTALL_BIN) pidstat $(DESTDIR)$(BIN_DIR)
        $(INSTALL_BIN) cifsiostat $(DESTDIR)$(BIN_DIR)
        $(INSTALL_DATA) sysstat.ioconf $(DESTDIR)$(SYSCONFIG_DIR)
-       $(INSTALL_DATA) sysstat.sysconfig $(DESTDIR)$(SYSCONFIG_DIR)/sysstat
+       $(INSTALL_DATA) sysstat.sysconfig $(DESTDIR)$(SYSCONFIG_DIR)/$(SYSCONFIG_FILE)
 ifeq ($(INSTALL_DOC),y)
        $(INSTALL_DATA) CHANGES $(DESTDIR)$(DOC_DIR)
        $(INSTALL_DATA) COPYING $(DESTDIR)$(DOC_DIR)
@@ -555,7 +556,7 @@ uninstall_base: uninstall_man uninstall_nls
 #              the binaries have been deleted.
        rm -f $(DESTDIR)$(INIT_DIR)/sysstat
        rm -f $(DESTDIR)$(RC_DIR)/rc.sysstat
-       rm -f $(DESTDIR)$(SYSCONFIG_DIR)/sysstat
+       rm -f $(DESTDIR)$(SYSCONFIG_DIR)/$(SYSCONFIG_FILE)
        rm -f $(DESTDIR)$(SYSCONFIG_DIR)/sysstat.ioconf
        rm -f $(DESTDIR)$(RC2_DIR)/S??sysstat
        rm -f $(DESTDIR)$(RC2_DIR)/S??rc.sysstat
diff --git a/build/conf_file b/build/conf_file
new file mode 100644 (file)
index 0000000..9af6cd3
--- /dev/null
@@ -0,0 +1,5 @@
+
+This is the name of the main sysstat configuration file which
+contains the values of various environment variables.
+Default configuration file name is "sysstat".
+
index 9c75a787aa563b114b910d3cfd401de5f2bfb46a..d894b3c4630c48b684eae3295f26b570ec88eaac 100755 (executable)
--- a/configure
+++ b/configure
@@ -649,6 +649,8 @@ compressafter
 HISTORY
 history
 NLS
+SYSCONFIG_FILE
+conf_file
 SYSCONFIG_DIR
 conf_dir
 SA_DIR
@@ -764,6 +766,7 @@ rcdir
 sa_lib_dir
 sa_dir
 conf_dir
+conf_file
 history
 compressafter
 man_group
@@ -1412,6 +1415,7 @@ Some influential environment variables:
   sa_lib_dir  sadc directory
   sa_dir      system activity directory
   conf_dir    sysstat configuration directory
+  conf_file   sysstat configuration file
   history     number of daily data files to keep (default value is 7)
   compressafter
               number of days after which data files are compressed (default
@@ -5054,6 +5058,7 @@ echo .
 #  sa_lib_dir    sadc, sa1 and sa2 directory
 #  sa_dir        system activity daily datafiles directory
 #  conf_dir      sysstat configuration directory (default is /etc/sysconfig)
+#  conf_file     sysstat configuration file (default is sysstat)
 #  history       number of daily datafiles to keep (default value is 7)
 #  compressafter number of days after which datafiles are compressed
 #  man_group     group for man pages
@@ -5196,6 +5201,19 @@ if test ! -d $SYSCONFIG_DIR; then
 fi
 
 
+# Set configuration directory
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sysstat configuration file" >&5
+$as_echo_n "checking sysstat configuration file... " >&6; }
+
+if test x$conf_file != x""; then
+   SYSCONFIG_FILE=$conf_file
+else
+   SYSCONFIG_FILE=sysstat
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSCONFIG_FILE" >&5
+$as_echo "$SYSCONFIG_FILE" >&6; }
+
+
 # National Language Support
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking National Language Support" >&5
 $as_echo_n "checking National Language Support... " >&6; }
@@ -6800,7 +6818,7 @@ echo "
    rc directory:               ${RC_DIR}
    Init directory:             ${INIT_DIR}
    Systemd unit dir:           ${with_systemdsystemunitdir}
-   Configuration directory:    ${SYSCONFIG_DIR}
+   Configuration file:         ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
    Man pages directory:                $mandir
    Compiler:                   $CC
    Compiler flags:             $CFLAGS
index 928c069ce59d537fe05f24dd5bdf9c7abf2bf013..267a6bce50458eb7099bda836b41ca62c1e8cec0 100644 (file)
@@ -185,6 +185,7 @@ echo .
 #  sa_lib_dir    sadc, sa1 and sa2 directory
 #  sa_dir        system activity daily datafiles directory
 #  conf_dir      sysstat configuration directory (default is /etc/sysconfig)
+#  conf_file     sysstat configuration file (default is sysstat)
 #  history       number of daily datafiles to keep (default value is 7)
 #  compressafter number of days after which datafiles are compressed
 #  man_group     group for man pages
@@ -319,6 +320,17 @@ if test ! -d $SYSCONFIG_DIR; then
 fi
 AC_SUBST(SYSCONFIG_DIR)
 
+# Set configuration directory
+AC_MSG_CHECKING(sysstat configuration file)
+AC_ARG_VAR([conf_file],[sysstat configuration file])
+if test x$conf_file != x""; then
+   SYSCONFIG_FILE=$conf_file
+else
+   SYSCONFIG_FILE=sysstat
+fi
+AC_MSG_RESULT($SYSCONFIG_FILE)
+AC_SUBST(SYSCONFIG_FILE)
+
 # National Language Support
 AC_MSG_CHECKING(National Language Support)
 AC_ARG_ENABLE(nls,
@@ -645,7 +657,7 @@ echo "
    rc directory:               ${RC_DIR}
    Init directory:             ${INIT_DIR}
    Systemd unit dir:           ${with_systemdsystemunitdir}
-   Configuration directory:    ${SYSCONFIG_DIR}
+   Configuration file:         ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
    Man pages directory:                $mandir
    Compiler:                   $CC
    Compiler flags:             $CFLAGS
diff --git a/iconfig b/iconfig
index 0e7d40241564164ded9a701414963c8c2c671275..fffea5fe00814dd75996cb4a9047231e5486e859 100755 (executable)
--- a/iconfig
+++ b/iconfig
@@ -40,6 +40,12 @@ if [ "${SYSCONFIG_DIR}" != "" ]; then
        SYSCONFIG_DIR="conf_dir=${SYSCONFIG_DIR} "
 fi
 
+# sysstat configuration file
+SYSCONFIG_FILE=`${ASK} 'sysstat configuration file:' "conf_file" "conf_file"`
+if [ "${SYSCONFIG_FILE}" != "" ]; then
+       SYSCONFIG_FILE="conf_file=${SYSCONFIG_FILE} "
+fi
+
 # Clean sa directory
 CLEAN_SA_DIR=`${ASK} 'Clean system activity directory? (y/n)' "--enable-clean-sa-dir" "clean-sa-dir"`
 if [ "${CLEAN_SA_DIR}" = "y" ]; then
@@ -204,8 +210,8 @@ else
 fi
 
 echo
-echo -n "./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${CLEAN_SA_DIR}${NLS} \
-${HISTORY}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${RCDIR}"
+echo -n "./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${SYSCONFIG_FILE} \
+${CLEAN_SA_DIR}${NLS}${HISTORY}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${RCDIR}"
 if [ "${SADC_OPT}" != "" ];
 then
        echo -n "sadc_options=\"${SADC_OPT}\""
@@ -213,7 +219,8 @@ fi
 echo "${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS}${PCP}${STRIP}${COPY_ONLY}"
 echo
 
-./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${CLEAN_SA_DIR}${NLS} \
+./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${SYSCONFIG_FILE} \
+${CLEAN_SA_DIR}${NLS} \
 ${HISTORY}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${RCDIR} \
 sadc_options="${SADC_OPT}" ${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS} \
 ${PCP}${STRIP}${COPY_ONLY}
diff --git a/sa1.in b/sa1.in
index 79ed60c6f574e83d8a73f9611c06df7622f860d2..e908ad330a4029657e2d6520808e011b3e77f1be 100644 (file)
--- a/sa1.in
+++ b/sa1.in
@@ -7,14 +7,15 @@
 #
 
 # Set default value for some variables.
-# Used only if ${SYSCONFIG_DIR}/sysstat doesn't exist!
+# Used only if ${SYSCONFIG_DIR}/${SYSCONFIG_FILE} doesn't exist!
 HISTORY=0
 SADC_OPTIONS=""
 SA_DIR=@SA_DIR@
 SYSCONFIG_DIR=@SYSCONFIG_DIR@
+SYSCONFIG_FILE=@SYSCONFIG_FILE@
 UMASK=0022
 
-[ -r ${SYSCONFIG_DIR}/sysstat ] && . ${SYSCONFIG_DIR}/sysstat
+[ -r ${SYSCONFIG_DIR}/${SYSCONFIG_FILE} ] && . ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
 
 umask ${UMASK}
 
diff --git a/sa2.in b/sa2.in
index cd4f71f00911e04e04f7be475384f1a91f9308e7..38b05b464d41455d47b5f5ae0891c613135615c2 100644 (file)
--- a/sa2.in
+++ b/sa2.in
@@ -10,13 +10,14 @@ prefix=@prefix@
 exec_prefix=@exec_prefix@
 SA_DIR=@SA_DIR@
 SYSCONFIG_DIR=@SYSCONFIG_DIR@
+SYSCONFIG_FILE=@SYSCONFIG_FILE@
 HISTORY=@HISTORY@
 COMPRESSAFTER=@COMPRESSAFTER@
 ZIP="@ZIP@"
 UMASK=0022
 
 # Read configuration file, overriding variables set above
-[ -r ${SYSCONFIG_DIR}/sysstat ] && . ${SYSCONFIG_DIR}/sysstat
+[ -r ${SYSCONFIG_DIR}/${SYSCONFIG_FILE} ] && . ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
 
 umask ${UMASK}