From: Alex Rousskov Date: Fri, 27 Feb 2009 15:25:31 +0000 (-0700) Subject: Fixed "make distuninstallcheck" by removing installed configuration files X-Git-Tag: SQUID_3_2_0_1~1155 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e2b88defedc318aea245bb7844415507f0609b4e;p=thirdparty%2Fsquid.git Fixed "make distuninstallcheck" by removing installed configuration files iff they are identical to the installed default configuration files. Added scripts/remove-cfg.sh to do the safe removal because we need that functionality in many Makefiles. Made installed mime.conf removal safe. We were removing it without checking for modifications. Added commands to remove the following installed default configuration files: cachemgr.conf.default and msntauth.conf.default. --- diff --git a/errors/Makefile.am b/errors/Makefile.am index 55b5578a35..6c2a8a5008 100644 --- a/errors/Makefile.am +++ b/errors/Makefile.am @@ -93,7 +93,8 @@ uninstall-local: rm -f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l/`basename $$f`; \ done; \ fi \ - done; \ + done; + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_STYLESHEET) rm -f $(DESTDIR)$(DEFAULT_STYLESHEET).default # undocumented hack. You can use this target to create multi-lingual diff --git a/helpers/basic_auth/MSNT/Makefile.am b/helpers/basic_auth/MSNT/Makefile.am index 81cb45d7c2..1deb9b56ac 100644 --- a/helpers/basic_auth/MSNT/Makefile.am +++ b/helpers/basic_auth/MSNT/Makefile.am @@ -6,6 +6,7 @@ # Uncomment and customize the following to suit your needs: # +MSNTAUTH_CONF = $(sysconfdir)/msntauth.conf libexec_PROGRAMS = msnt_auth @@ -38,9 +39,14 @@ confload.o: confload.c $(COMPILE) -DSYSCONFDIR=\"$(sysconfdir)\" -c $(srcdir)/confload.c -o $@ install-data-local: - @if test -f $(DESTDIR)$(sysconfdir)/msntauth.conf ; then \ - echo "$@ will not overwrite existing $(DESTDIR)$(sysconfdir)/msntauth.conf" ; \ + @if test -f $(DESTDIR)$(MSNTAUTH_CONF) ; then \ + echo "$@ will not overwrite existing $(DESTDIR)$(MSNTAUTH_CONF)" ; \ else \ - echo "$(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(sysconfdir)/msntauth.conf" ; \ - $(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(sysconfdir)/msntauth.conf ; \ + echo "$(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(MSNTAUTH_CONF)" ; \ + $(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(MSNTAUTH_CONF) ; \ fi + +uninstall-local: + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(MSNTAUTH_CONF) + $(RM) -f $(DESTDIR)$(MSNTAUTH_CONF).default + diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 4cc88c9ebb..7947b82c41 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,11 +1,7 @@ -# -# This file is a Makefile for compiling and installing Cache Manager. -# Cache Manager is a manager program for Internet Object Cache. -# - - bin_SCRIPTS = RunCache RunAccel EXTRA_DIST = AnnounceCache.pl access-log-matrix.pl cache-compare.pl \ cachetrace.pl check_cache.pl convert.configure.to.os2 \ fileno-to-pathname.pl flag_truncs.pl icp-test.pl \ icpserver.pl tcp-banger.pl udp-banger.pl upgrade-1.0-store.pl + +dist_noinst_SCRIPTS = remove-cfg.sh diff --git a/scripts/remove-cfg.sh b/scripts/remove-cfg.sh new file mode 100644 index 0000000000..7b5905fd06 --- /dev/null +++ b/scripts/remove-cfg.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# Removes an configuration file if it is identical to the default file, +# preventing "make distcheck" failures due to configuration leftovers. +# Intended to be used for installed configuration files. + +remover=$1 # the program to remove a file +prime=$2 # the configuration file to be removed, including path +default=$3 # the default configuration filename, including path + +# by default, use .default default extension +if test -z "$default" +then + default="$prime.default" +fi + +# is the primary configuration file present? +if test -f $prime +then + # is the primary config identical to the default? + if diff -q $default $prime > /dev/null + then + echo " $remover -f $prime"; + $remover -f $prime; + fi +fi + +exit 0 diff --git a/src/Makefile.am b/src/Makefile.am index 6cf1644d1a..d257062124 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1118,16 +1118,8 @@ install-data-local: install-sysconfDATA install-dataDATA $(mkinstalldirs) $(DESTDIR)$(DEFAULT_LOG_PREFIX) uninstall-local: - @if test -f $(DESTDIR)$(DEFAULT_MIME_TABLE) ; then \ - echo "rm -f $(DESTDIR)$(DEFAULT_MIME_TABLE)"; \ - $(RM) -f $(DESTDIR)$(DEFAULT_MIME_TABLE); \ - fi - -# Don't automatically uninstall config files -# @if test -f $(DESTDIR)$(DEFAULT_CONFIG_FILE) ; then \ -# echo "rm -f $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ -# $(RM) -f $(DESTDIR)$(DEFAULT_CONFIG_FILE); \ -# fi + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_MIME_TABLE) + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_CONFIG_FILE) CLEANFILES = cf_gen_defines.h cf.data cf_parser.h squid.conf.default squid.conf.documented \ globals.cc string_arrays.c repl_modules.cc DiskIO/DiskIOModules_gen.cc \ diff --git a/tools/Makefile.am b/tools/Makefile.am index 45718d2d53..9b8dda7cd1 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -64,12 +64,8 @@ install-data-local: fi uninstall-local: - -# Don't automatically uninstall config files -# @if test -f $(DESTDIR)$(DEFAULT_CONFIG_FILE) ; then \ -# echo "rm -f $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ -# $(RM) -f $(DESTDIR)$(DEFAULT_CONFIG_FILE); \ -# fi + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_CACHEMGR_CONFIG) + $(RM) -f $(DESTDIR)$(DEFAULT_CACHEMGR_CONFIG).default DISTCLEANFILES =