chiark / gitweb /
distorted-keys.userv: Add userv configuration snippet.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 26 Dec 2011 00:03:18 +0000 (00:03 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 26 Dec 2011 00:08:44 +0000 (00:08 +0000)
Needs a configured user name, and sbindir.

Makefile.am
configure.ac
distorted-keys.userv.in [new file with mode: 0644]

index 4364761708d6536d46eb358961378c94122248cf..3566e3a692c17d09d3fd1a09f594d3080e5470af 100644 (file)
@@ -27,6 +27,7 @@ bin_SCRIPTS            =
 sbin_SCRIPTS            =
 dist_pkglib_SCRIPTS     =
 dist_pkglib_DATA        =
+noinst_DATA             =
 pkglib_DATA             =
 noinst_SCRIPTS          =
 
@@ -43,10 +44,11 @@ EXTRA_DIST          += config/confsubst
 SUBSTVARS = \
         PACKAGE="$(PACKAGE)" VERSION="$(VERSION)" \
        PYTHON="$(PYTHON)" \
-       bindir="$(bindir)" \
+       bindir="$(bindir)" sbindir="$(sbindir)" \
        pkgconfdir="$(sysconfdir)/$(PACKAGE)" \
        pkgstatedir="$(localstatedir)/$(PACKAGE)" \
-       pkglibdir="$(pkglibdir)"
+       pkglibdir="$(pkglibdir)" \
+       user="$(user)"
 
 SUBST = $(AM_V_GEN)$(confsubst)
 
@@ -125,4 +127,13 @@ dist_pkglib_SCRIPTS        += cryptop.decrypt
 dist_pkglib_SCRIPTS    += cryptop.sign
 dist_pkglib_SCRIPTS    += cryptop.verify
 
+## Userv services configuration.
+noinst_DATA            += distorted-keys.userv
+EXTRA_DIST             += distorted-keys.userv.in
+CLEANFILES             += distorted-keys.userv
+distorted-keys.userv: distorted-keys.userv.in Makefile
+       $(SUBST) $(srcdir)/distorted-keys.userv.in $(SUBSTVARS) \
+                       >distorted-keys.userv.new && \
+               mv distorted-keys.userv.new distorted-keys.userv
+
 ###----- That's all, folks --------------------------------------------------
index 44cdbd2ab37fbb26b676323d34d9a85d5d1e48bb..59378e64af8038b25480915f8006c3f62d317bbd 100644 (file)
@@ -33,6 +33,15 @@ AC_CONFIG_AUX_DIR([config])
 AM_INIT_AUTOMAKE([foreign])
 mdw_SILENT_RULES
 
+dnl--------------------------------------------------------------------------
+dnl Other random configuration.
+
+AC_ARG_WITH([user],
+  AS_HELP_STRING([--with-user], [which user should own the archive]),
+  [user=$withval],
+  [user=keys])
+AC_SUBST([user])
+
 dnl--------------------------------------------------------------------------
 dnl Python programming environment.
 
diff --git a/distorted-keys.userv.in b/distorted-keys.userv.in
new file mode 100644 (file)
index 0000000..4882d5c
--- /dev/null
@@ -0,0 +1,45 @@
+### -*-conf-*-
+###
+### userv services configuration for distorted-keys
+
+###--------------------------------------------------------------------------
+### User crypto operations.
+
+if ( glob service cryptop
+   & glob service-user @user@
+   & grep calling-user-shell /etc/shells
+   )
+       no-suppress-args
+       require-fd 0 read
+       require-fd 1-2 write
+       ignore-fd 3-
+       no-set-environment
+       execute @sbindir@/cryptop
+fi
+
+###--------------------------------------------------------------------------
+### User profile access.
+
+if ( glob service cryptop-profile
+   & grep service-user-shell /etc/shells
+   & glob calling-user @user@
+   )
+       no-suppress-args
+       null-fd 0
+       require-fd 1-2 write
+       ignore-fd 3-
+       no-set-environment
+       execute sh -c "case $# in \
+         1) \
+           exec @bindir@/extract-profile \"$1\" \
+               @pkgconfdir@/profile.d/ \
+               .userv/cryptop-profile \
+           ;; \
+         *) \
+           echo >&2 \"usage: cryptop-profile PROFILE\"; \
+           exit 1 \
+           ;; \
+       esac" _
+fi
+
+###----- That's all, folks --------------------------------------------------