]> granicus.if.org Git - vnstat/commitdiff
update configuration file during make install if it already exists instead of overwri...
authorTeemu Toivola <git@humdi.net>
Thu, 22 Oct 2015 16:13:08 +0000 (19:13 +0300)
committerTeemu Toivola <git@humdi.net>
Thu, 22 Oct 2015 16:13:08 +0000 (19:13 +0300)
Makefile.am
Makefile.in
configure
configure.ac

index bb11ab6b4bafdebce76e0a42710286dfaf435961..3f32b33aaadcf07af769edf70e904f63b85934e7 100644 (file)
@@ -1,10 +1,8 @@
 SUBDIRS = .
 
-vnstatconfdir = $(sysconfdir)
-dist_vnstatconf_DATA = cfg/vnstat.conf
 dist_man_MANS = man/vnstat.1 man/vnstat.conf.5 man/vnstatd.1 man/vnstati.1
 
-EXTRA_DIST = examples UPGRADE CHANGES FAQ INSTALL_BSD INSTALL_OSX
+EXTRA_DIST = cfg examples UPGRADE CHANGES FAQ INSTALL_BSD INSTALL_OSX
 
 bin_PROGRAMS = vnstat vnstatd
 if HAVE_LIBGD
@@ -87,5 +85,14 @@ profile:
 
 myclean: maintainer-clean
 
+install-data-hook:
+       $(DESTDIR)$(bindir)/vnstat$(EXEEXT) --showconfig >vnstat.conf && \
+         $(MKDIR_P) $(DESTDIR)$(sysconfdir) && \
+         mv -f vnstat.conf $(DESTDIR)$(sysconfdir)/vnstat.conf
+
+uninstall-hook:
+       -rm -f $(DESTDIR)$(sysconfdir)/vnstat.conf
+       -rmdir $(DESTDIR)$(sysconfdir)
+
 clean-local:
        -rm -fr coverage *.lcov *.gz test*.log test*.xml src/*.gc* tests/*.gc*
index 6523e18e7fd72050bb4f2100ce1c5a7ed994997c..ddae2ca54b6c18a1eefe9d5df904b47a75910641 100644 (file)
@@ -15,7 +15,6 @@
 
 @SET_MAKE@
 
-
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -39,10 +38,9 @@ bin_PROGRAMS = vnstat$(EXEEXT) vnstatd$(EXEEXT) $(am__EXEEXT_1)
 @HAVE_CHECK_TRUE@check_PROGRAMS = check_vnstat$(EXEEXT)
 subdir = .
 DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
-       $(dist_vnstatconf_DATA) $(srcdir)/Makefile.am \
-       $(srcdir)/Makefile.in $(top_srcdir)/configure \
-       $(top_srcdir)/src/config.h.in COPYING INSTALL compile depcomp \
-       install-sh missing
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/configure $(top_srcdir)/src/config.h.in COPYING \
+       INSTALL compile depcomp install-sh missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -55,7 +53,7 @@ CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 @HAVE_LIBGD_TRUE@am__EXEEXT_1 = vnstati$(EXEEXT)
 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \
-       "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(vnstatconfdir)"
+       "$(DESTDIR)$(man5dir)"
 PROGRAMS = $(bin_PROGRAMS)
 am__check_vnstat_SOURCES_DIST = tests/vnstat_tests.c \
        tests/vnstat_tests.h tests/common_tests.c tests/common_tests.h \
@@ -164,7 +162,6 @@ man1dir = $(mandir)/man1
 man5dir = $(mandir)/man5
 NROFF = nroff
 MANS = $(dist_man_MANS)
-DATA = $(dist_vnstatconf_DATA)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
   distclean-recursive maintainer-clean-recursive
 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -308,10 +305,8 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 SUBDIRS = .
-vnstatconfdir = $(sysconfdir)
-dist_vnstatconf_DATA = cfg/vnstat.conf
 dist_man_MANS = man/vnstat.1 man/vnstat.conf.5 man/vnstatd.1 man/vnstati.1
-EXTRA_DIST = examples UPGRADE CHANGES FAQ INSTALL_BSD INSTALL_OSX
+EXTRA_DIST = cfg examples UPGRADE CHANGES FAQ INSTALL_BSD INSTALL_OSX
 vnstati_LDADD = $(IMAGELIBS)
 vnstat_SOURCES = src/vnstat.c src/vnstat.h \
   src/ifinfo.c src/ifinfo.h \
@@ -1018,24 +1013,6 @@ uninstall-man5:
        } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
              -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
        dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
-install-dist_vnstatconfDATA: $(dist_vnstatconf_DATA)
-       @$(NORMAL_INSTALL)
-       test -z "$(vnstatconfdir)" || $(MKDIR_P) "$(DESTDIR)$(vnstatconfdir)"
-       @list='$(dist_vnstatconf_DATA)'; test -n "$(vnstatconfdir)" || list=; \
-       for p in $$list; do \
-         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         echo "$$d$$p"; \
-       done | $(am__base_list) | \
-       while read files; do \
-         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(vnstatconfdir)'"; \
-         $(INSTALL_DATA) $$files "$(DESTDIR)$(vnstatconfdir)" || exit $$?; \
-       done
-
-uninstall-dist_vnstatconfDATA:
-       @$(NORMAL_UNINSTALL)
-       @list='$(dist_vnstatconf_DATA)'; test -n "$(vnstatconfdir)" || list=; \
-       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       dir='$(DESTDIR)$(vnstatconfdir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -1472,10 +1449,10 @@ check-am: all-am
        $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
        $(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-recursive
-all-am: Makefile $(PROGRAMS) $(MANS) $(DATA)
+all-am: Makefile $(PROGRAMS) $(MANS)
 installdirs: installdirs-recursive
 installdirs-am:
-       for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(vnstatconfdir)"; do \
+       for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-recursive
@@ -1536,8 +1513,9 @@ info: info-recursive
 
 info-am:
 
-install-data-am: install-dist_vnstatconfDATA install-man
-
+install-data-am: install-man
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-data-hook
 install-dvi: install-dvi-recursive
 
 install-dvi-am:
@@ -1583,13 +1561,14 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS uninstall-dist_vnstatconfDATA \
-       uninstall-man
-
+uninstall-am: uninstall-binPROGRAMS uninstall-man
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
 uninstall-man: uninstall-man1 uninstall-man5
 
 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
-       ctags-recursive install-am install-strip tags-recursive
+       ctags-recursive install-am install-data-am install-strip \
+       tags-recursive uninstall-am
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
        all all-am am--refresh check check-TESTS check-am clean \
@@ -1600,17 +1579,17 @@ uninstall-man: uninstall-man1 uninstall-man5
        distclean-generic distclean-hdr distclean-tags distcleancheck \
        distdir distuninstallcheck dvi dvi-am html html-am info \
        info-am install install-am install-binPROGRAMS install-data \
-       install-data-am install-dist_vnstatconfDATA install-dvi \
-       install-dvi-am install-exec install-exec-am install-html \
-       install-html-am install-info install-info-am install-man \
-       install-man1 install-man5 install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip installcheck \
-       installcheck-am installcheck-binPROGRAMS installdirs \
-       installdirs-am maintainer-clean maintainer-clean-generic \
-       mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
-       ps ps-am tags tags-recursive uninstall uninstall-am \
-       uninstall-binPROGRAMS uninstall-dist_vnstatconfDATA \
-       uninstall-man uninstall-man1 uninstall-man5
+       install-data-am install-data-hook install-dvi install-dvi-am \
+       install-exec install-exec-am install-html install-html-am \
+       install-info install-info-am install-man install-man1 \
+       install-man5 install-pdf install-pdf-am install-ps \
+       install-ps-am install-strip installcheck installcheck-am \
+       installcheck-binPROGRAMS installdirs installdirs-am \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+       tags tags-recursive uninstall uninstall-am \
+       uninstall-binPROGRAMS uninstall-hook uninstall-man \
+       uninstall-man1 uninstall-man5
 
 
 setdebug:
@@ -1624,6 +1603,15 @@ profile:
 
 myclean: maintainer-clean
 
+install-data-hook:
+       $(DESTDIR)$(bindir)/vnstat$(EXEEXT) --showconfig >vnstat.conf && \
+         $(MKDIR_P) $(DESTDIR)$(sysconfdir) && \
+         mv -f vnstat.conf $(DESTDIR)$(sysconfdir)/vnstat.conf
+
+uninstall-hook:
+       -rm -f $(DESTDIR)$(sysconfdir)/vnstat.conf
+       -rmdir $(DESTDIR)$(sysconfdir)
+
 clean-local:
        -rm -fr coverage *.lcov *.gz test*.log test*.xml src/*.gc* tests/*.gc*
 
index 991a2c6af6c805e3fd8a0daa5ac2939def868c37..6d98886380a585ef7bfadc8719dd488c8de39e8d 100755 (executable)
--- a/configure
+++ b/configure
@@ -3973,6 +3973,7 @@ $as_echo "no" >&6; }
 fi
 
 
+
 # Checks for libraries.
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5
index 4c6ad3a5fbabc243ad7707cbe421d83df6f4e5fe..22f24f0b5d10477bec2bd98733e939c000a62e13 100644 (file)
@@ -9,6 +9,7 @@ AC_CONFIG_HEADERS([src/config.h])
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_MAKE_SET
+AC_PROG_MKDIR_P
 
 # Checks for libraries.
 AC_CHECK_LIB([m], [pow])