chiark / gitweb /
Makefile: Install configuration files.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 23 Feb 2012 02:49:15 +0000 (02:49 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 23 Feb 2012 03:17:16 +0000 (03:17 +0000)
Configuration files are installed only if there are no files at the
destination already.  This means that you get at least a skeleton
installation from the source distribution, even if it requires some
light hacking.

This also requires:

  * moving some files from the Debian packaging into the main
    distribution;

  * allowing the user to configure a `userv' installation directory; and

  * adjusting the Debian installation runes.

Makefile.am
admin.groups [moved from debian/admin.groups with 100% similarity]
admin.users [moved from debian/admin.users with 100% similarity]
configure.ac
debian/distorted-keys-base.install
debian/distorted-keys.install

index 2f90bbe..1bf380f 100644 (file)
@@ -30,10 +30,12 @@ bin_SCRIPTS          =
 sbin_SCRIPTS            =
 dist_pkglib_SCRIPTS     =
 dist_pkglib_DATA        =
-noinst_DATA             =
 pkglib_DATA             =
-noinst_SCRIPTS          =
 dist_profile_DATA       =
+noinst_DATA             =
+USERV_CONFIG            =
+KEYS_CONFIG             =
+TOPLEVEL_CONFIG                 =
 
 EXTRA_DIST              =
 CLEANFILES              =
@@ -112,6 +114,17 @@ dist_pkglib_SCRIPTS        += keys.recover
 dist_pkglib_SCRIPTS    += keys.reveal
 dist_pkglib_SCRIPTS    += keys.stash
 
+## Common profiles.
+dist_profile_DATA      += profile.d/00base
+dist_profile_DATA      += profile.d/02infra
+
+## Other configuration.
+KEYS_CONFIG            += keys.conf
+EXTRA_DIST             += keys.conf
+
+KEYS_CONFIG            += admin.users admin.groups
+EXTRA_DIST             += admin.users admin.groups
+
 ###--------------------------------------------------------------------------
 ### Crypto operations.
 
@@ -144,7 +157,7 @@ dist_pkglib_SCRIPTS += cryptop.sign
 dist_pkglib_SCRIPTS    += cryptop.verify
 
 ## Userv services configuration.
-noinst_DATA            += userv/distorted-keys
+USERV_CONFIG           += userv/distorted-keys
 EXTRA_DIST             += userv/distorted-keys.in
 CLEANFILES             += userv/distorted-keys
 userv/distorted-keys: userv/distorted-keys.in Makefile
@@ -171,7 +184,7 @@ sbin_SCRIPTS                += mount-ephemeral
 EXTRA_DIST             += mount-ephemeral
 
 ## Directory claiming service.
-noinst_DATA            += userv/claim-dir
+USERV_CONFIG           += userv/claim-dir
 EXTRA_DIST             += userv/claim-dir.in
 CLEANFILES             += userv/claim-dir
 userv/claim-dir: userv/claim-dir.in Makefile
@@ -181,15 +194,65 @@ userv/claim-dir: userv/claim-dir.in Makefile
                mv userv/claim-dir.new userv/claim-dir
 
 ## Configuration file.
+TOPLEVEL_CONFIG                += claim-dir.tab
 EXTRA_DIST             += claim-dir.tab
 
 ###--------------------------------------------------------------------------
-### Configuration snippets.
-
-dist_profile_DATA      += profile.d/00base
-dist_profile_DATA      += profile.d/02infra
-
-EXTRA_DIST             += keys.conf
+### Installing configuration.
+
+## Install userv configuration.
+noinst_DATA            += $(USERV_CONFIG)
+install-data-local::
+       $(MKDIR_P) $(DESTDIR)$(uservconfdir)
+       @for i in $(USERV_CONFIG); do \
+         b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
+         if [ -f $(DESTDIR)$(uservconfdir)/$$b ]; then continue; fi; \
+         if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
+         echo $(INSTALL_DATA) $$s $(DESTDIR)$(uservconfdir); \
+         $(INSTALL_DATA) $$s $(DESTDIR)$(uservconfdir) || exit 1; \
+       done
+uninstall-local::
+       @for i in $(USERV_CONFIG); do \
+         b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
+         echo rm -f $(DESTDIR)$(uservconfdir)/$$b; \
+         rm -f $(DESTDIR)$(uservconfdir)/$$b; \
+       done
+
+## Install keys configuration.
+noinst_DATA            += $(KEYS_CONFIG)
+install-data-local::
+       $(MKDIR_P) $(DESTDIR)$(pkgconfdir)
+       @for i in $(KEYS_CONFIG); do \
+         b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
+         if [ -f $(DESTDIR)$(pkgconfdir)/$$b ]; then continue; fi; \
+         if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
+         echo $(INSTALL_DATA) $$s $(DESTDIR)$(pkgconfdir); \
+         $(INSTALL_DATA) $$s $(DESTDIR)$(pkgconfdir) || exit 1; \
+       done
+uninstall-local::
+       @for i in $(KEYS_CONFIG); do \
+         b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
+         echo rm -f $(DESTDIR)$(pkgconfdir)/$$b; \
+         rm -f $(DESTDIR)$(pkgconfdir)/$$b; \
+       done
+
+## Install toplevel configuration.
+noinst_DATA            += $(TOPLEVEL_CONFIG)
+install-data-local::
+       $(MKDIR_P) $(DESTDIR)$(sysconfdir)
+       @for i in $(TOPLEVEL_CONFIG); do \
+         b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
+         if [ -f $(DESTDIR)$(sysconfdir)/$$b ]; then continue; fi; \
+         if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
+         echo $(INSTALL_DATA) $$s $(DESTDIR)$(sysconfdir); \
+         $(INSTALL_DATA) $$s $(DESTDIR)$(sysconfdir) || exit 1; \
+       done
+uninstall-local::
+       @for i in $(TOPLEVEL_CONFIG); do \
+         b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
+         echo rm -f $(DESTDIR)$(sysconfdir)/$$b; \
+         rm -f $(DESTDIR)$(sysconfdir)/$$b; \
+       done
 
 ###--------------------------------------------------------------------------
 ### Release setup.
@@ -212,6 +275,4 @@ EXTRA_DIST          += debian/distorted-keys.postinst
 
 EXTRA_DIST             += debian/claim-dir.install
 
-EXTRA_DIST             += debian/admin.users debian/admin.groups
-
 ###----- That's all, folks --------------------------------------------------
similarity index 100%
rename from debian/admin.groups
rename to admin.groups
similarity index 100%
rename from debian/admin.users
rename to admin.users
index 59378e6..ffe62b2 100644 (file)
@@ -42,6 +42,13 @@ AC_ARG_WITH([user],
   [user=keys])
 AC_SUBST([user])
 
+AC_ARG_WITH([userv-conf-dir],
+  AS_HELP_STRING([--with-userv-conf-dir],
+                [where to install userv configuration]),
+  [uservconfdir=$withval],
+  [uservconfdir='${sysconfdir}/userv/default.d'])
+AC_SUBST([uservconfdir])
+
 dnl--------------------------------------------------------------------------
 dnl Python programming environment.
 
index a211378..94dc89c 100644 (file)
@@ -1,5 +1,4 @@
 usr/bin/pubkeyop
 usr/lib/distorted-keys/keyfunc.sh
 usr/lib/distorted-keys/ktype.*
-
-keys.conf                              /etc/distorted-keys
+etc/distorted-keys/keys.conf
index 67dab71..3098aa4 100644 (file)
@@ -4,8 +4,6 @@ usr/bin/shamir
 usr/sbin/keys
 usr/lib/distorted-keys/keys.*
 usr/lib/distorted-keys/cryptop.*
+etc/userv/default.d/distorted-keys
+etc/distorted-keys/admin.*
 etc/distorted-keys/profile.d
-
-debian/build/userv/distorted-keys      /etc/userv/default.d
-debian/admin.users                     /etc/distorted-keys
-debian/admin.groups                    /etc/distorted-keys