From f547d0f2c4ab2b898803b9f336c3f0748f85a2cf Mon Sep 17 00:00:00 2001
From: Greg Price <price@mit.edu>
Date: Mon, 4 Aug 2008 00:49:36 -0400
Subject: [PATCH 1/1] finish setup for signing packages

svn path=/trunk/packages/sipb-xen-dev/; revision=853
---
 README                                             |    7 ++++++
 debian/changelog                                   |    4 ++--
 debian/sipb-xen-dev.init                           |   25 ++++++++++++++++++++
 .../{distributions => distributions.in}            |    5 +++-
 repository-config/invirt-uploaders.in              |    1 +
 reprepro-env                                       |    2 +-
 6 files changed, 40 insertions(+), 4 deletions(-)
 create mode 100644 README
 create mode 100755 debian/sipb-xen-dev.init
 rename repository-config/{distributions => distributions.in} (72%)
 create mode 100644 repository-config/invirt-uploaders.in

diff --git a/README b/README
new file mode 100644
index 0000000..3339738
--- /dev/null
+++ b/README
@@ -0,0 +1,7 @@
+Installation:
+
+ - The secret of the gpg key identified in invirt.config.apt.keyid
+   must be in the keyring of the repository user.
+
+   The public key should then be in the apt keyring of systems using
+   the packages.
diff --git a/debian/changelog b/debian/changelog
index 7a9dc42..57671d2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,8 @@
 sipb-xen-dev (18) unstable; urgency=low
 
-  * sign the packages
+  * sign the packages, getting keyid from invirt.config
 
- -- Greg Price <price@mit.edu>  Sat,  2 Aug 2008 21:57:58 -0400
+ -- Greg Price <price@mit.edu>  Mon,  4 Aug 2008 00:43:58 -0400
 
 sipb-xen-dev (17) unstable; urgency=low
 
diff --git a/debian/sipb-xen-dev.init b/debian/sipb-xen-dev.init
new file mode 100755
index 0000000..c2e7336
--- /dev/null
+++ b/debian/sipb-xen-dev.init
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+PACKAGE=sipb-xen-dev
+
+. /lib/lsb/init-functions
+
+gen_config () {
+    local keyid="$(invirt-getconf apt.keyid)"
+    for f in /srv/repository/conf/{distributions,invirt-uploaders}; do
+	perl -pe "s/@apt.keyid@/$keyid/g" <"$f".in >"$f"
+    done
+}
+
+case "$1" in
+  start|reload|force-reload|restart)
+    log_begin_msg "Reloading config for $PACKAGE"
+    gen_config
+    log_end_msg $?
+    ;;
+  stop)
+    ;;
+  *)
+    log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"
+    ;;
+esac
diff --git a/repository-config/distributions b/repository-config/distributions.in
similarity index 72%
rename from repository-config/distributions
rename to repository-config/distributions.in
index 2544a80..1a4fbf4 100644
--- a/repository-config/distributions
+++ b/repository-config/distributions.in
@@ -1,6 +1,7 @@
 CodeName: unstable
 Components: main
-Uploaders: unsigned
+Uploaders: invirt-uploaders
+SignWith: @apt.keyid@
 Architectures: amd64 source
 Origin: sipb
 Notautomatic: yes
@@ -9,6 +10,8 @@ Description: Unreleased sipb-xen software
 
 Codename: stable
 Components: main
+Uploaders: invirt-uploaders
+SignWith: @apt.keyid@
 Architectures: amd64 source 
 Origin: sipb
 Description: Released sipb-xen  code
diff --git a/repository-config/invirt-uploaders.in b/repository-config/invirt-uploaders.in
new file mode 100644
index 0000000..0564e0d
--- /dev/null
+++ b/repository-config/invirt-uploaders.in
@@ -0,0 +1 @@
+allow * by key @apt.keyid@
diff --git a/reprepro-env b/reprepro-env
index 71335a0..25e17b1 100755
--- a/reprepro-env
+++ b/reprepro-env
@@ -1,5 +1,5 @@
 #!/bin/sh
 set -e
 export HOME=/home/repository
-exec sudo -u repository  /usr/bin/reprepro -b /srv/repository "$@"
+exec sudo -H -u repository  /usr/bin/reprepro -b /srv/repository "$@"
 
-- 
1.7.9.5