Index: /package_tags/xvm-iscsi-config/0.0.2/debian/changelog
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/changelog	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/changelog	(revision 1529)
@@ -0,0 +1,11 @@
+xvm-iscsi-config (0.0.2) unstable; urgency=low
+
+  * Use bash for init script
+
+ -- Evan Broder <broder@mit.edu>  Tue, 04 Nov 2008 04:22:56 -0500
+
+xvm-iscsi-config (0.0.1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Evan Broder <broder@mit.edu>  Thu, 23 Oct 2008 22:16:55 -0400
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/compat
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/compat	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/compat	(revision 1529)
@@ -0,0 +1,1 @@
+5
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/control
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/control	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/control	(revision 1529)
@@ -0,0 +1,14 @@
+Source: xvm-iscsi-config
+Section: servers
+Priority: extra
+Maintainer: SIPB XVM Project <xvm@mit.edu>
+Build-Depends: cdbs, debhelper (>= 5), config-package-dev, open-iscsi
+Standards-Version: 3.8.0
+
+Package: xvm-iscsi-config
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, invirt-base, open-iscsi
+Provides: invirt-storage-config
+Description: iSCSI configuration for SIPB's XVM project
+ This package should be installed on all XVM host machines to
+ configure the iSCSI shared storage array.
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/copyright
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/copyright	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/copyright	(revision 1529)
@@ -0,0 +1,16 @@
+This software was written as part of the Invirt project <invirt@mit.edu>.
+
+Copyright :
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in the file /usr/share/common-licenses/GPL.
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/rules
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/rules	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/rules	(revision 1529)
@@ -0,0 +1,20 @@
+#!/usr/bin/make -f
+
+DEB_DIVERT_EXTENSION = .xvm
+
+DEB_DIVERT_FILES_xvm-iscsi-config += \
+	/etc/iscsi/iscsid.conf.xvm
+
+DEB_DH_INSTALLINIT_ARGS += --no-start
+DEB_UPDATE_RCD_PARAMS_xvm-iscsi-config += defaults 20 80
+
+include /usr/share/cdbs/1/rules/config-package.mk
+include /usr/share/cdbs/1/rules/debhelper.mk
+
+common-build-indep:: debian/iscsid.conf.xvm.mako
+
+binary-post-install/xvm-iscsi-config::
+	touch $(DEB_DESTDIR)/etc/iscsi/iscsid.conf.xvm
+
+debian/iscsid.conf.xvm.mako: $(call debian_check_files,/etc/iscsi/iscsid.conf)
+	debian/transform_iscsid.conf.xvm.mako < $< > $@
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/transform_iscsid.conf.xvm.mako
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/transform_iscsid.conf.xvm.mako	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/transform_iscsid.conf.xvm.mako	(revision 1529)
@@ -0,0 +1,28 @@
+#!/usr/bin/perl -n
+BEGIN {
+  print <<'EOF';
+<%
+from invirt.config import structs as cfg
+%>
+EOF
+}
+
+s/^node.startup = manual/node.startup = automatic/m;
+# mako just generally doesn't deal well with lines that start with
+# hashes, so we'll strip them
+#
+# And empty lines too, just for cleanliness
+s/^#.*$//m;
+print unless /^$/;
+
+END {
+  print <<'EOF';
+node.session.auth.authmethod = CHAP
+node.session.auth.username = ${cfg.iscsi.username}
+node.session.auth.password = ${cfg.iscsi.password}
+
+discovery.sendtargets.auth.authmethod = CHAP
+discovery.sendtargets.auth.username = ${cfg.iscsi.username}
+discovery.sendtargets.auth.password = ${cfg.iscsi.password}
+EOF
+}
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.config
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.config	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.config	(revision 1529)
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+# Source debconf library
+. /usr/share/debconf/confmodule
+
+# Get IP address
+db_input high xvm-iscsi-config/address || true
+db_go || true
+# Get username
+db_input high xvm-iscsi-config/username || true
+db_go || true
+# Get password
+db_input high xvm-iscsi-config/password || true
+db_go || true
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.init
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.init	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.init	(revision 1529)
@@ -0,0 +1,24 @@
+#! /bin/bash
+### BEGIN INIT INFO
+# Provides:          xvm-iscsi-config
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: XVM iSCSI config
+# Description:       Re-generate the iSCSI config for XVM's shared storage
+### END INIT INFO
+
+# Author: SIPB XVM Project <xvm@mit.edu>
+
+NAME=xvm-iscsi-config
+DESC="Re-generate the iSCSI config"
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+GEN_FILES=/etc/iscsi/iscsid.conf.xvm
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+. /lib/init/config-init.sh
+
+config_init "$1"
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.install
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.install	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.install	(revision 1529)
@@ -0,0 +1,1 @@
+debian/iscsid.conf.xvm.mako etc/iscsi
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.postinst
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.postinst	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.postinst	(revision 1529)
@@ -0,0 +1,58 @@
+#!/bin/sh
+# postinst script for xvm-iscsi-config
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# Source debconf library
+. /usr/share/debconf/confmodule
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+case "$1" in
+    configure)
+        db_get xvm-iscsi-config/address
+        ADDRESS="$RET"
+        db_get xvm-iscsi-config/username
+        USERNAME="$RET"
+        db_get xvm-iscsi-config/password
+        PASSWORD="$RET"
+        db_stop
+        
+        cat >/etc/invirt/conf.d/iscsi <<EOF
+iscsi:
+ address: $ADDRESS
+ username: $USERNAME
+ password: $PASSWORD
+EOF
+        invoke-rc.d xvm-iscsi-config restart
+        invoke-rc.d open-iscsi restart
+        iscsiadm -m discovery -t st -p $(invirt-getconf iscsi.address):3260
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+exit 0
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.prerm
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.prerm	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.prerm	(revision 1529)
@@ -0,0 +1,41 @@
+#!/bin/sh
+# prerm script for xvm-iscsi-config
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|upgrade|deconfigure)
+        rm /etc/invirt/conf.d/iscsi
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Index: /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.templates
===================================================================
--- /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.templates	(revision 1529)
+++ /package_tags/xvm-iscsi-config/0.0.2/debian/xvm-iscsi-config.templates	(revision 1529)
@@ -0,0 +1,14 @@
+Template: xvm-iscsi-config/address
+Type: string
+Description: iSCSI IP Address
+ What is the IP address of the iSCSI shared storage array?
+
+Template: xvm-iscsi-config/username
+Type: string
+Description: iSCSI username
+ What is the username for the iSCSI shared storage array?
+
+Template: xvm-iscsi-config/password
+Type: password
+Description: iSCSI password
+ What is the password for the iSCSI shared storage array?
