build: Install some more files to their eventual locations.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 19 Apr 2010 21:01:00 +0000 (22:01 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 19 Apr 2010 21:43:19 +0000 (22:43 +0100)
Install the base peers.in file as ${configdir}/peers.d/10base as a
convenience to users.  It's correct to clobber the user's old file,
since there's a fierce warning at the top of the file.  (Make the
warning more fierce.)

Install the startup script configuration file (but not the script
itself), only if there isn't one already.  This prevents us from
overwriting a user's customized configuration.

To prevent distcheck from failing, change the default of `initconfig' to
be ${sysconfdir}/tripe.conf; this is probably the right thing anyway.

configure.ac
init/Makefile.am
peerdb/Makefile.am
peerdb/peers.in

index ac12dbe..3ad53dc 100644 (file)
@@ -89,8 +89,9 @@ TRIPE_DEFINE_PATH(
   [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid])
 
 TRIPE_DEFINE_PATH(
-  [initconfig], [FILE], [configuration for init script [[/etc/tripe.conf]]],
-  [/etc/tripe.conf])
+  [initconfig], [FILE],
+  [configuration for init script [[SYSCONFDIR/tripe.conf]]],
+  ['${sysconfdir}/tripe.conf'])
 
 TRIPE_DEFINE_PATH(
   [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
index 50583a8..e8d662d 100644 (file)
@@ -42,9 +42,17 @@ tripe-init: tripe-init.in Makefile
 
 ## Configuration file for the script.
 EXTRA_DIST             += tripe.conf
+install-data-local:: tripe.conf
+       initconfig=$(initconfig) && dir=$${initconfig%/*} && \
+               $(MKDIR_P) $(DESTDIR)$$dir
+       test -f $(DESTDIR)$(initconfig) || \
+               $(INSTALL_SCRIPT) $(srcdir)/tripe.conf \
+                       $(DESTDIR)$(initconfig)
+uninstall-local::
+       rm -f $(DESTDIR)$(initconfig)
 
 ## Necessary directories.
-install-data-hook:
+install-data-hook::
        for i in "$(configdir)" "$(socketdir)"; do \
          case "$$i" in /*) $(MKDIR_P) $(DESTDIR)$$i ;; esac; \
        done
index 55477f4..c606474 100644 (file)
@@ -34,7 +34,6 @@ man_MANS               =
 sbin_SCRIPTS           += tripe-newpeers
 CLEANFILES             += tripe-newpeers
 EXTRA_DIST             += tripe-newpeers.in
-EXTRA_DIST             += peers.in
 
 tripe-newpeers: tripe-newpeers.in Makefile
        $(confsubst) $(srcdir)/tripe-newpeers.in >$@.new \
@@ -54,4 +53,14 @@ man_MANS             += tripe-newpeers.8
 CLEANFILES             += tripe-newpeers.8
 EXTRA_DIST             += tripe-newpeers.8.in
 
+## Install peer database sources.
+EXTRA_DIST             += peers.in
+
+install-data-local:: peers.in
+       $(MKDIR_P) $(DESTDIR)$(configdir)/peers.d
+       $(INSTALL_DATA) $(srcdir)/peers.in \
+               $(DESTDIR)$(configdir)/peers.d/10base
+uninstall-local::
+       rm -f $(DESTDIR)$(configdir)/peers.d/10base
+
 ###----- That's all, folks --------------------------------------------------
index 16acbc8..0143902 100644 (file)
@@ -2,8 +2,9 @@
 ;;;
 ;;; Peers description file
 ;;;
-;;; You're best off not editing this file at all; instead, drop a file
-;;; containing your overriden settings alongside.
+;;; New installations will clobber this file.  Therefore you're best off not
+;;; editing this file directly; instead, drop a file containing your
+;;; overridden settings alongside.
 
 ;;;--------------------------------------------------------------------------
 ;;; Global defaults.