From 48d30ac7da99251c10c89de8b49e801f0a7522dd Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Mon, 20 Aug 2018 11:54:23 +0200 Subject: [PATCH] Don't overwrite existing opensc.conf fixes https://github.com/OpenSC/OpenSC/issues/1449 partially reverts c003f3825e5217cd3ef8272f4e8ebe47270a7847 --- etc/Makefile.am | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/etc/Makefile.am b/etc/Makefile.am index 3add83b2..cc368b6c 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -7,9 +7,8 @@ EXTRA_DIST = $(CV_CERTS) Makefile.mak SUFFIXES = .in -dist_noinst_DATA = opensc.conf.example.in +dist_noinst_DATA = opensc.conf opensc.conf.example.in nodist_noinst_DATA = opensc.conf.example -dist_sysconf_DATA = opensc.conf # Make sure we build this every time # as there is no dependency for this. @@ -32,10 +31,17 @@ opensc.conf.example: opensc.conf.example.in force < $< > $@ install-exec-hook: opensc.conf.example + $(MKDIR_P) "$(DESTDIR)$(sysconfdir)" + if [ -f "$(DESTDIR)$(sysconfdir)/opensc.conf" ]; then \ + $(INSTALL_DATA) $(srcdir)/opensc.conf "$(DESTDIR)$(sysconfdir)/opensc.conf.new"; \ + else \ + $(INSTALL_DATA) $(srcdir)/opensc.conf "$(DESTDIR)$(sysconfdir)/opensc.conf"; \ + fi $(MKDIR_P) "$(DESTDIR)$(docdir)" $(INSTALL_DATA) opensc.conf.example "$(DESTDIR)$(docdir)/opensc.conf"; uninstall-hook: opensc.conf.example + rm -f "$(DESTDIR)$(sysconfdir)/opensc.conf.new" "$(DESTDIR)$(sysconfdir)/opensc.conf" rm -f "$(DESTDIR)$(docdir)/opensc.conf" if ENABLE_OPENPACE