Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/debian/changelog
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/debian/changelog	(revision 117)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/debian/changelog	(revision 121)
@@ -1,2 +1,10 @@
+sipb-xen-remctl-auto (1.0.2) unstable; urgency=low
+
+  * Added web interface support code.
+  * Move things from /etc/remctl/sipb-xen-auto/bin to /usr/sbin
+  * Quoted lots of variables
+
+ -- Tim Abbott <tabbott@sipb-xen-dev.mit.edu>  Sun,  7 Oct 2007 17:23:40 -0400
+
 sipb-xen-remctl-auto (1.0.1) unstable; urgency=low
 
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/cron.d/sipb-xen-remctl-auto
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/cron.d/sipb-xen-remctl-auto	(revision 117)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/cron.d/sipb-xen-remctl-auto	(revision 121)
@@ -3,7 +3,8 @@
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 MAILTO=root
+UPDATE=/usr/sbin/remctl-update.sh
 
-@reboot         root    if [ -x /etc/remctl/sipb-xen-auto/remctl-update.sh ]; then nice -n10 /etc/remctl/sipb-xen-auto/remctl-update.sh all; fi
-* * * * */15       root    if [ -x /etc/remctl/sipb-xen-auto/remctl-update.sh ]; then nice -n10 /etc/remctl/sipb-xen-auto/remctl-update.sh all; fi
+@reboot         root    if [ -x "$UPDATE" ]; then nice -n10 "$UPDATE" all; fi
+* * * * */15       root    if [ -x "$UPDATE" ]; then nice -n10 "$UPDATE" all; fi
 
 # EOF
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-auto
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-auto	(revision 117)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-auto	(revision 121)
@@ -1,2 +1,1 @@
 include /etc/remctl/sipb-xen-auto/machine.d
-remctl-auto-update all /etc/remctl/sipb-xen-auto/remctl-update.sh ANYUSER
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-web
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-web	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/conf.d/sipb-xen-web	(revision 121)
@@ -0,0 +1,5 @@
+web lvcreate /usr/sbin/sipb-xen-lvcreate /etc/remctl/acl/web
+web vmboot /usr/sbin/sipb-xen-boot /etc/remctl/acl/web
+web register /usr/sbin/remctl-update.sh /etc/remctl/acl/web
+web remctl-moira-update all /usr/sbin/remctl-update.sh /etc/remctl/acl/web
+
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/README
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/README	(revision 117)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/README	(revision 121)
@@ -2,5 +2,5 @@
 configuration.
 
-/etc/remctl/sipb-xen-auto/remctl-update.sh is the magic script.  Run
+/usr/sbin/remctl-update.sh is the magic script.  Run
 it with "all" as an argument, and it will update everything.
 
@@ -19,5 +19,5 @@
 and then run
 
-/etc/remctl/sipb-xen-auto/remctl-update.sh all
+/usr/sbin/remctl-update.sh all
 
 Everything else is autogenerated from that information.
@@ -42,10 +42,10 @@
 This package also includes a crontab to run
 
-/etc/remctl/sipb-xen-auto/remctl-update.sh all
+/usr/sbin/remctl-update.sh all
 
 every 15 minutes or so to keep our Moira mapping up to date.  One can
 request an update of our Moira mapping for group X by running
 
-/etc/remctl/sipb-xen-auto/remctl-update.sh moiragroup X
+/usr/sbin/remctl-update.sh moiragroup X
 
 The web interface should probably run this when it adds a group.  We
@@ -55,5 +55,5 @@
 the command:
 
-/etc/remctl/sipb-xen-auto/remctl-update.sh all
+/usr/sbin/remctl-update.sh all
 
 using the following command from your favorite machine with remctl:
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/conf.template
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/conf.template	(revision 117)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/conf.template	(revision 121)
@@ -3,4 +3,6 @@
 destroy #MACHINENAME# #BINDIR#/dispatch.destroy.sh /etc/remctl/sipb-xen-auto/acl/#MACHINENAME#
 list #MACHINENAME# #BINDIR#/dispatch.list.sh /etc/remctl/sipb-xen-auto/acl/#MACHINENAME#
+list-long #MACHINENAME# #BINDIR#/dispatch.list-long.sh /etc/remctl/sipb-xen-auto/acl/#MACHINENAME#
 vcpu-list #MACHINENAME# #BINDIR#/dispatch.vcpu-list.sh /etc/remctl/sipb-xen-auto/acl/#MACHINENAME#
 uptime #MACHINENAME# #BINDIR#/dispatch.uptime.sh /etc/remctl/sipb-xen-auto/acl/#MACHINENAME#
+vnc_get_port_auth #MACHINENAME# #BINDIR#/get_port /etc/remctl/acl/vnc
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/remctl-update.sh
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/remctl-update.sh	(revision 117)
+++ 	(revision )
@@ -1,83 +1,0 @@
-#!/bin/sh
-DIR=/etc/remctl/sipb-xen-auto
-TEMPLATE=$DIR/conf.template
-MACHINEDIR=$DIR/machine.d
-MOIRADIR=$DIR/moira-acl
-MOIRATMP=$DIR/moira-tmp
-MACHINETMP=$DIR/machine-list-tmp
-AUTOMACHINELIST=$DIR/auto-machine-list
-AUTOMOIRALIST=$DIR/auto-moira-list
-BINDIR=$DIR/bin
-ACLDIR=$DIR/acl
-
-update_machine()
-{
-    machine=$1
-    sed "s/#MACHINENAME#/$machine/g" "$TEMPLATE" | \
-	sed "s,#BINDIR#,$BINDIR,g" >| "$MACHINETMP"
-    if ! cmp -s "$MACHINEDIR/$machine" "$MACHINETMP"; then
-	mv "$MACHINETMP" "$MACHINEDIR/$machine"
-    else
-	rm -f "$MACHINETMP"
-    fi
-}
-
-update_moiragroup()
-{
-    group=$1
-    # Should perhaps replace with LDAP, but fine for now.
-
-    # We should do more careful error checking so we don't take away
-    # all bits and delete the moira-acl files whenever there's an AFS
-    # outage.
-    pts membership -nameorid "system:$group" -noauth | tail -n+2 | \
-	sed 's/\./\//; s/^  //; s/$/@ATHENA.MIT.EDU/g' >| "$MOIRATMP"
-    if test -s "$MOIRATMP"; then
-	if ! cmp -s "$MOIRADIR/$group" "$MOIRATMP"; then
-	    mv "$MOIRATMP" "$MOIRADIR/$group"
-	fi
-    else
-	if test -e "$MOIRADIR/$group"; then
-	    rm "$MOIRADIR/$group"
-	fi
-    fi
-    rm -f "$MOIRATMP"
-}
-
-case "$1" in
-    moiragroup)
-	update_moiragroup "$2"
-	;;
-
-    all_machines)
-        # update the remctl.conf definitions
-	for machine in `cat "$AUTOMACHINELIST"`; do
-	    update_machine "$machine"
-	done
-	;;
-    all_moira)
-        # update our moira ACL lists
-	for group in `cat "$AUTOMOIRALIST"`; do
-	    update_moiragroup "$group"
-	done
-	;;
-    auto_machine_list)
-        # update the list of maintained machines
-	/bin/ls "$ACLDIR" >| "$AUTOMACHINELIST"
-	;;
-    auto_moira_list)
-        # update the moira list-of-lists
-        # /bin/ls "$MOIRADIR" >| "$AUTOMOIRALIST" # BAD IDEA in case of outage
-
-	# This extracts the list of all moira lists we care about, and updates those.
-	grep -R moira "$ACLDIR/" /etc/remctl/acl/ | perl -pe 's/.*moira-acl\/(.*)/$1/g' >| "$AUTOMOIRALIST"
-	;;
-    all)
-    	"$0" auto_machine_list
-	"$0" all_machines
-	"$0" auto_moira_list
-	"$0" all_moira
-	;;
-esac
-
-exit 0
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.create.sh
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.create.sh	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.create.sh	(revision 121)
@@ -0,0 +1,1 @@
+link dispatch.sh
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.destroy.sh
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.destroy.sh	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.destroy.sh	(revision 121)
@@ -0,0 +1,1 @@
+link dispatch.sh
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.list-long.sh
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.list-long.sh	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.list-long.sh	(revision 121)
@@ -0,0 +1,1 @@
+link dispatch.sh
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.list.sh
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.list.sh	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.list.sh	(revision 121)
@@ -0,0 +1,1 @@
+link dispatch.sh
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.reboot.sh
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.reboot.sh	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.reboot.sh	(revision 121)
@@ -0,0 +1,1 @@
+link dispatch.sh
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.sh
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.sh	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.sh	(revision 121)
@@ -0,0 +1,28 @@
+#!/bin/sh
+# dispatch-ACTION.sh MACHINE
+#
+# remctl should have already verified that the user is authorized to
+# control the machine.  So, we just need to execute the action requested.
+#
+# $0 and $1 come from the trusted remctl source.
+#
+# $2 and so on are user-provided, and thus sketchy.  I don't think we
+# need them for this script.
+
+ACTION=$(echo "$0" | awk -F'.' '{print $2}')
+MACHINE="$1"
+echo "$ACTION"
+
+case "$ACTION" in
+    reboot|list|vcpu-list|destroy|create|uptime)
+        xm "$ACTION" "$MACHINE"
+        exit 0
+	;;
+    list-long)
+	xm list --long "$MACHINE"
+	;;
+    *)
+        echo "ERROR: Invalid Command"
+        exit 1
+        ;;
+esac
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.uptime.sh
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.uptime.sh	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.uptime.sh	(revision 121)
@@ -0,0 +1,1 @@
+link dispatch.sh
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.vcpu-list.sh
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.vcpu-list.sh	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/dispatch.vcpu-list.sh	(revision 121)
@@ -0,0 +1,1 @@
+link dispatch.sh
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/remctl-update.sh
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/remctl-update.sh	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/remctl-update.sh	(revision 121)
@@ -0,0 +1,83 @@
+#!/bin/sh
+DIR=/etc/remctl/sipb-xen-auto
+TEMPLATE=$DIR/conf.template
+MACHINEDIR=$DIR/machine.d
+MOIRADIR=$DIR/moira-acl
+MOIRATMP=$DIR/moira-tmp
+MACHINETMP=$DIR/machine-list-tmp
+AUTOMACHINELIST=$DIR/auto-machine-list
+AUTOMOIRALIST=$DIR/auto-moira-list
+BINDIR=/usr/sbin
+ACLDIR=$DIR/acl
+
+update_machine()
+{
+    machine=$1
+    sed "s/#MACHINENAME#/$machine/g" "$TEMPLATE" | \
+	sed "s,#BINDIR#,$BINDIR,g" >| "$MACHINETMP"
+    if ! cmp -s "$MACHINEDIR/$machine" "$MACHINETMP"; then
+	mv "$MACHINETMP" "$MACHINEDIR/$machine"
+    else
+	rm -f "$MACHINETMP"
+    fi
+}
+
+update_moiragroup()
+{
+    group=$1
+    # Should perhaps replace with LDAP, but fine for now.
+
+    # We should do more careful error checking so we don't take away
+    # all bits and delete the moira-acl files whenever there's an AFS
+    # outage.
+    pts membership -nameorid "system:$group" -noauth | tail -n+2 | \
+	sed 's/\./\//; s/^  //; s/$/@ATHENA.MIT.EDU/g' >| "$MOIRATMP"
+    if test -s "$MOIRATMP"; then
+	if ! cmp -s "$MOIRADIR/$group" "$MOIRATMP"; then
+	    mv "$MOIRATMP" "$MOIRADIR/$group"
+	fi
+    else
+	if test -e "$MOIRADIR/$group"; then
+	    rm "$MOIRADIR/$group"
+	fi
+    fi
+    rm -f "$MOIRATMP"
+}
+
+case "$1" in
+    moiragroup)
+	update_moiragroup "$2"
+	;;
+
+    all_machines)
+        # update the remctl.conf definitions
+	for machine in `cat "$AUTOMACHINELIST"`; do
+	    update_machine "$machine"
+	done
+	;;
+    all_moira)
+        # update our moira ACL lists
+	for group in `cat "$AUTOMOIRALIST"`; do
+	    update_moiragroup "$group"
+	done
+	;;
+    auto_machine_list)
+        # update the list of maintained machines
+	/bin/ls "$ACLDIR" >| "$AUTOMACHINELIST"
+	;;
+    auto_moira_list)
+        # update the moira list-of-lists
+        # /bin/ls "$MOIRADIR" >| "$AUTOMOIRALIST" # BAD IDEA in case of outage
+
+	# This extracts the list of all moira lists we care about, and updates those.
+	grep -R moira "$ACLDIR/" /etc/remctl/acl/ | perl -pe 's/.*moira-acl\/(.*)/$1/g' >| "$AUTOMOIRALIST"
+	;;
+    all)
+    	"$0" auto_machine_list
+	"$0" all_machines
+	"$0" auto_moira_list
+	"$0" all_moira
+	;;
+esac
+
+exit 0
Index: trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-boot
===================================================================
--- trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-boot	(revision 121)
+++ trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-boot	(revision 121)
@@ -0,0 +1,9 @@
+#!/bin/sh
+machine=$2
+cdrom=$3
+
+if [ -n "$cdrom" ]; then
+        xm create sipb-database machine_id="$machine" cdrom_image="$cdrom"
+else
+        xm create sipb-database machine_id="$machine"
+fi
