]> granicus.if.org Git - sysstat/commitdiff
Add option --enable-copy-only to configure script
authorSebastien GODARD <sysstat@orange.fr.fake>
Wed, 15 Jan 2014 21:31:33 +0000 (22:31 +0100)
committerSebastien GODARD <sysstat@orange.fr.fake>
Wed, 15 Jan 2014 21:31:33 +0000 (22:31 +0100)
Add a new option (--enable-configure-only) to configure script. This
option makes sure that files are only copied when installing sysstat and
that nothing else (like activating a service for distro using systemd)
is done. This may be useful when creating sysstat package.

Signed-off-by: Sebastien GODARD <sysstat@orange.fr.fake>
Makefile.in
build/copy-only [new file with mode: 0644]
configure
configure.in
iconfig

index d43d1cf56327b8f46f801130e3e664efcb7e6a4a..29b8603f11b4dbfbfcc23010fc313b4283f2aeb8 100644 (file)
@@ -121,6 +121,9 @@ endif
 ifndef INSTALL_DOC
 INSTALL_DOC = @INSTALL_DOC@
 endif
+ifndef COPY_ONLY
+COPY_ONLY = @COPY_ONLY@
+endif
 
 # Systemd
 SYSTEMCTL = @SYSTEMCTL@
@@ -375,9 +378,8 @@ install_all: install_base cron/crontab sysstat \
           echo "USER'S PREVIOUS CRONTAB SAVED IN CURRENT DIRECTORY (USING .save SUFFIX)."; \
           su $(CRON_OWNER) -c "crontab cron/crontab"; \
        fi
-       if [ -x $(SYSTEMCTL) -a -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \
+       if [ -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \
            $(INSTALL_DATA) sysstat.service $(DESTDIR)$(SYSTEMD_UNIT_DIR); \
-           $(SYSTEMCTL) enable sysstat.service; \
        elif [ -d $(DESTDIR)$(INIT_DIR) ]; then \
           $(INSTALL_BIN) sysstat $(DESTDIR)$(INIT_DIR)/sysstat; \
           if [ -x $(CHKCONFIG) ]; then \
@@ -400,6 +402,11 @@ install_all: install_base cron/crontab sysstat \
              cd $(DESTDIR)$(RC5_DIR) && $(LN_S) -f ../rc.sysstat S01sysstat; \
           fi \
        fi
+ifeq ($(COPY_ONLY),n)
+       if [ -x $(SYSTEMCTL) ]; then \
+           $(SYSTEMCTL) enable sysstat.service; \
+       fi
+endif
 
 uninstall_man:
 ifeq ($(INSTALL_DOC),y)
@@ -478,8 +485,12 @@ uninstall_all: uninstall_base
        -$(CP) -a /tmp/crontab-$(CRON_OWNER).old ./crontab-$(CRON_OWNER).`date '+%Y%m%d.%H%M%S'`.old
        @echo "USER CRONTAB SAVED IN CURRENT DIRECTORY (WITH .old SUFFIX)."
        -su $(CRON_OWNER) -c "crontab -r"
-       if [ -x $(SYSTEMCTL) -a -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \
+ifeq ($(COPY_ONLY),n)
+       if [ -x $(SYSTEMCTL) ]; then \
            $(SYSTEMCTL) disable sysstat.service; \
+       fi
+endif
+       if [ -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \
            rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysstat.service; \
        fi
 
diff --git a/build/copy-only b/build/copy-only
new file mode 100644 (file)
index 0000000..cc7ad35
--- /dev/null
@@ -0,0 +1,15 @@
+
+Answer y to make sure that installing sysstat on your machine
+only results on files being copied to destinations directories
+and nothing else (like activating a service) is done.
+This option is interesting for those creating a sysstat package
+for example. Indeed some distributions want to install files
+into $DESTDIR before actually installing them into the root
+directory. If the distribution uses systemd (a system management
+daemon written for Linux), the sysstat service should not be
+activated in this case before files are actually copied into
+the root directory.
+But for most of you wanting sysstat to be properly installed
+when you enter "make install", just answer n here (this is the
+default answer).
+
index 9518bb755fc23aa7a3255f4f827eeb3f79ef71c0..556bb89139d0d78e0cecb27ab57c2a1b016c618a 100755 (executable)
--- a/configure
+++ b/configure
@@ -633,6 +633,7 @@ CRON_INTERVAL_SEC
 CRON_INTERVAL
 SU_C_OWNER
 CRON_OWNER
+COPY_ONLY
 cron_interval
 cron_owner
 INSTALL_CRON
@@ -741,6 +742,7 @@ enable_install_isag
 enable_clean_sa_dir
 enable_install_cron
 enable_collect_all
+enable_copy_only
 enable_documentation
 enable_debuginfo
 enable_stripping
@@ -1383,6 +1385,7 @@ Optional Features:
   --enable-clean-sa-dir   clean system activity directory
   --enable-install-cron   install a crontab to start sar
   --enable-collect-all    collect all possible activities
+  --enable-copy-only      only copy files when installing
   --disable-documentation do not install documentation
   --enable-debuginfo      enable debug output (--debuginfo option)
   --disable-stripping     do not strip object files
@@ -4856,6 +4859,7 @@ echo .
 #  --disable-documentation do not install documentation (man pages...)
 #  --disable-sensors      do not link against libsensors even if available
 #  --disable-stripping     do not strip object files
+#  --enablle-copy-only     only copy files when installing sysstat
 #
 # Some influential environment variables:
 #  rcdir        directory where startup scripts are installed
@@ -5272,6 +5276,26 @@ fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AUX_COLL" >&5
 $as_echo "$AUX_COLL" >&6; }
 
+# Check whether files should only be copied
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether files should only be copied" >&5
+$as_echo_n "checking whether files should only be copied... " >&6; }
+   # Check whether --enable-copy-only was given.
+if test "${enable_copy_only+set}" = set; then :
+  enableval=$enable_copy_only; OCOPY=$enableval
+else
+  OCOPY=no
+fi
+
+   if test $OCOPY != "yes"; then
+      COPY_ONLY=n
+      OCOPY=no
+   else
+      COPY_ONLY=y
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCOPY" >&5
+$as_echo "$OCOPY" >&6; }
+
+
 else
    CRON_OWNER="root"
    SU_C_OWNER=""
index ce9be59cd529a25ca4275a28361637e57344bf53..50d8a6b0e45d7a4c02e2f6652206b42e9cf2b269 100644 (file)
@@ -139,6 +139,7 @@ echo .
 #  --disable-documentation do not install documentation (man pages...)
 #  --disable-sensors      do not link against libsensors even if available
 #  --disable-stripping     do not strip object files
+#  --enablle-copy-only     only copy files when installing sysstat
 #
 # Some influential environment variables:
 #  rcdir        directory where startup scripts are installed
@@ -490,6 +491,21 @@ if test $INSTALL_CRON = "y"; then
    fi
    AC_MSG_RESULT($AUX_COLL)
 
+# Check whether files should only be copied
+   AC_MSG_CHECKING(whether files should only be copied)
+   AC_ARG_ENABLE(copy-only,
+                AC_HELP_STRING([--enable-copy-only],
+                               [only copy files when installing]),
+                               OCOPY=$enableval,OCOPY=no)
+   if test $OCOPY != "yes"; then
+      COPY_ONLY=n
+      OCOPY=no
+   else
+      COPY_ONLY=y
+   fi
+   AC_MSG_RESULT($OCOPY)
+   AC_SUBST(COPY_ONLY)
+
 else
    CRON_OWNER="root"
    SU_C_OWNER=""
diff --git a/iconfig b/iconfig
index 1d092c88d69570d09082504c51b59d2185eecaed..48010c3cd83da8276387843f3403502874d2ffc4 100755 (executable)
--- a/iconfig
+++ b/iconfig
@@ -153,6 +153,18 @@ then
        fi
 fi
 
+if [ "${CRON}" != "" ];
+then
+       # Only copy files
+       COPY_ONLY=`${ASK} 'Only copy files when installing sysstat? (y/n)' "--enable-copy-only" "copy-only"`
+       if [ "${COPY_ONLY}" = "y" ]; then
+               COPY_ONLY="--enable-copy-only "
+       else
+               COPY_ONLY=""
+               echo "Parameter --enable-copy-only is NOT set"
+       fi
+fi
+
 # Compress manual pages
 COMPRESSMANPG=`${ASK} 'Compress manual pages? (y/n)' "--enable-compress-manpg" "compress-manpg"`
 if [ "${COMPRESSMANPG}" = "y" ]; then
@@ -201,10 +213,10 @@ fi
 echo
 echo "./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${CLEAN_SA_DIR}${NLS} \
 ${YESTERDAY}${HISTORY}${COMPRESSAFTER}${PREALLOC_ANSWER}${MAN}${IGNORE_MAN}${CRON}${RCDIR} \
-${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${INSTALL_ISAG}${SENSORS}${STRIP}"
+${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${INSTALL_ISAG}${SENSORS}${STRIP}${COPY_ONLY}"
 echo
 
 ./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${CLEAN_SA_DIR}${NLS} \
 ${YESTERDAY}${HISTORY}${COMPRESSAFTER}${PREALLOC_ANSWER}${MAN}${IGNORE_MAN}${CRON}${RCDIR} \
-${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${INSTALL_ISAG}${SENSORS}${STRIP}
+${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${INSTALL_ISAG}${SENSORS}${STRIP}${COPY_ONLY}