Index: package_tags/sipb-xen-console-server/2.04/debian/changelog
===================================================================
--- package_tags/sipb-xen-console-server/2.04/debian/changelog	(revision 711)
+++ package_tags/sipb-xen-console-server/2.04/debian/changelog	(revision 711)
@@ -0,0 +1,52 @@
+sipb-xen-console-server (2.04) unstable; urgency=low
+
+  * Get Kerberos realm from config rather than hardcoding.
+  * Don't hardcode host's hostname in conserver.cf.
+  * Update for current config-package-dev.
+
+ -- Greg Price <price@mit.edu>  Tue, 22 Jul 2008 01:32:04 -0400
+
+sipb-xen-console-server (2.03) unstable; urgency=low
+
+  * Multiplex consoles on multiple hosts.
+
+ -- Greg Price <price@mit.edu>  Sun, 13 Jul 2008 08:35:17 -0400
+
+sipb-xen-console-server (2.02) unstable; urgency=low
+
+  * And...xm isn't in the path, so give a full path
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 04:48:53 -0400
+
+sipb-xen-console-server (2.01) unstable; urgency=low
+
+  * update-conserver script should reload, not restart
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 04:43:12 -0400
+
+sipb-xen-console-server (2) unstable; urgency=low
+
+  * Use a python based update-conserver script that gets the list of
+    consoles from xm list
+  * Run the update-conserver script every 5 minutes to catch VMs that
+    are not started or stopped through the remctl interface
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 04:32:58 -0400
+
+sipb-xen-console-server (1.0.2) unstable; urgency=low
+
+  * Also...make this package actually do something
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 01:41:32 -0400
+
+sipb-xen-console-server (1.0.1) unstable; urgency=low
+
+  * Misnamed a file
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 01:36:29 -0400
+
+sipb-xen-console-server (1) unstable; urgency=low
+
+  * Initial release.
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Wed,  2 Apr 2008 00:27:12 -0400
Index: package_tags/sipb-xen-console-server/2.04/debian/compat
===================================================================
--- package_tags/sipb-xen-console-server/2.04/debian/compat	(revision 711)
+++ package_tags/sipb-xen-console-server/2.04/debian/compat	(revision 711)
@@ -0,0 +1,1 @@
+5
Index: package_tags/sipb-xen-console-server/2.04/debian/control
===================================================================
--- package_tags/sipb-xen-console-server/2.04/debian/control	(revision 711)
+++ package_tags/sipb-xen-console-server/2.04/debian/control	(revision 711)
@@ -0,0 +1,14 @@
+Source: sipb-xen-console-server
+Section: servers
+Priority: important
+Maintainer: sipb-xen@mit.edu
+Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 5), config-package-dev (>= 4.5~)
+Standards-Version: 3.7.2
+
+Package: sipb-xen-console-server
+Architecture: all
+Provides: ${diverted-files}
+Conflicts: ${diverted-files}
+Depends: ${shlibs:Depends}, ${misc:Depends}, conserver-server, remctl-client
+Description: SIPB Xen serial console server server
+  This configures the VMM for the server-side of the console server
Index: package_tags/sipb-xen-console-server/2.04/debian/control.in
===================================================================
--- package_tags/sipb-xen-console-server/2.04/debian/control.in	(revision 711)
+++ package_tags/sipb-xen-console-server/2.04/debian/control.in	(revision 711)
@@ -0,0 +1,14 @@
+Source: sipb-xen-console-server
+Section: servers
+Priority: important
+Maintainer: sipb-xen@mit.edu
+Build-Depends: @cdbs@
+Standards-Version: 3.7.2
+
+Package: sipb-xen-console-server
+Architecture: all
+Provides: ${diverted-files}
+Conflicts: ${diverted-files}
+Depends: ${shlibs:Depends}, ${misc:Depends}, conserver-server, remctl-client
+Description: SIPB Xen serial console server server
+  This configures the VMM for the server-side of the console server
Index: package_tags/sipb-xen-console-server/2.04/debian/copyright
===================================================================
--- package_tags/sipb-xen-console-server/2.04/debian/copyright	(revision 711)
+++ package_tags/sipb-xen-console-server/2.04/debian/copyright	(revision 711)
@@ -0,0 +1,3 @@
+This package was created for internal use of the SIPB Xen Project of
+the MIT Student Information Processing Board.  Ask sipb-xen@mit.edu if
+you have questions about redistribution.
Index: package_tags/sipb-xen-console-server/2.04/debian/rules
===================================================================
--- package_tags/sipb-xen-console-server/2.04/debian/rules	(revision 711)
+++ package_tags/sipb-xen-console-server/2.04/debian/rules	(revision 711)
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+
+DEB_AUTO_UPDATE_DEBIAN_CONTROL = 1
+DEB_DIVERT_EXTENSION = .sipb-xen
+DEB_DIVERT_FILES_sipb-xen-console += \
+	/etc/conserver/conserver.cf
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/config-package.mk
Index: package_tags/sipb-xen-console-server/2.04/debian/sipb-xen-console-server.cron.d
===================================================================
--- package_tags/sipb-xen-console-server/2.04/debian/sipb-xen-console-server.cron.d	(revision 711)
+++ package_tags/sipb-xen-console-server/2.04/debian/sipb-xen-console-server.cron.d	(revision 711)
@@ -0,0 +1,8 @@
+#
+# cron-jobs for sipb-xen-console-server
+# Refresh the list of active VM consoles
+#
+
+MAILTO=root
+
+*/5 * * * * root python /usr/sbin/sipb-xen-update-conserver
Index: package_tags/sipb-xen-console-server/2.04/debian/sipb-xen-console-server.install
===================================================================
--- package_tags/sipb-xen-console-server/2.04/debian/sipb-xen-console-server.install	(revision 711)
+++ package_tags/sipb-xen-console-server/2.04/debian/sipb-xen-console-server.install	(revision 711)
@@ -0,0 +1,1 @@
+files/* .
Index: package_tags/sipb-xen-console-server/2.04/files/etc/conserver/conserver.cf.sipb-xen
===================================================================
--- package_tags/sipb-xen-console-server/2.04/files/etc/conserver/conserver.cf.sipb-xen	(revision 711)
+++ package_tags/sipb-xen-console-server/2.04/files/etc/conserver/conserver.cf.sipb-xen	(revision 711)
@@ -0,0 +1,24 @@
+config * {
+	sslrequired yes;
+}
+default * {
+	logfile /var/log/conserver/&.log;
+	timestamp "1lab";
+	rw *;
+	type exec;
+	exec xm console d_f;
+	execsubst f=cs;
+}
+
+access * {
+	trusted 127.0.0.1;
+	trusted 18.181.0.134;
+	limited *;
+}
+
+console s_sipb-xen-dev {
+	type exec;
+	exec xm console s_sipb-xen-dev;
+}
+
+#include /etc/conserver/sipb-xen-consoles.cf
Index: package_tags/sipb-xen-console-server/2.04/files/usr/sbin/sipb-xen-update-conserver
===================================================================
--- package_tags/sipb-xen-console-server/2.04/files/usr/sbin/sipb-xen-update-conserver	(revision 711)
+++ package_tags/sipb-xen-console-server/2.04/files/usr/sbin/sipb-xen-update-conserver	(revision 711)
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+
+import sipb_xen_database
+import subprocess
+import os
+import socket
+
+sipb_xen_database.connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen')
+
+def live_vms():
+    p = subprocess.Popen(['/usr/sbin/xm', 'list'], stdout=subprocess.PIPE)
+    p.wait()
+    output = p.stdout.read()
+    vms = [x.split()[0][2:] for x in output.splitlines() if x.startswith('d_')]
+    return vms
+
+def reload_conserver():
+    p = subprocess.Popen(['/etc/init.d/conserver-server', 'reload'], stdout=subprocess.PIPE)
+    p.wait()
+
+if __name__ == '__main__':
+    hostname = socket.getfqdn().lower()
+    realm = file('/etc/invirt/realm').read().strip()
+    principal = 'host/'+hostname+'@'+realm
+    config = '\n'.join('console %s { master %s; }' % (vm, hostname)
+                       for vm in live_vms())
+    f = open('/etc/conserver/sipb-xen-consoles.cf', 'w')
+    f.write(config)
+    f.close()
+    reload_conserver()
+    subprocess.call(['/usr/bin/kinit', '-k', '-t', '/etc/krb5.keytab',
+                     principal])
+    subprocess.call(['/usr/bin/remctl', 'sipb-xen-console.mit.edu',
+                     'console', 'update', config])
