Index: branches/fc17-dev/locker/deploy/bin/git
===================================================================
--- branches/fc17-dev/locker/deploy/bin/git	(revision 2081)
+++ branches/fc17-dev/locker/deploy/bin/git	(revision 2195)
@@ -77,4 +77,6 @@
 print "  $gitbase/$addrend.git/\n";
 print "To clone, run\n  git clone https://$USER.scripts.mit.edu/$addrend/$addrend.git\n\n";
+print "Note: Push over HTTP is a relatively new feature in Git, so if git push fails\n";
+print "try a newer version of Git, e.g. if you're on Athena, 'add -f git' and try again.\n\n";
 press_enter;
 
Index: branches/fc17-dev/locker/deploy/bin/rails
===================================================================
--- branches/fc17-dev/locker/deploy/bin/rails	(revision 2081)
+++ branches/fc17-dev/locker/deploy/bin/rails	(revision 2195)
@@ -5,4 +5,5 @@
 use onserver;
 use Tie::File;
+use Cwd;
 
 setup();
@@ -38,5 +39,9 @@
 my $prod_db = make_db("production");
 
-system qw{rails -D -d mysql .};
+my $cwd = getcwd;
+system("rails", "new", $cwd ,"-d", "mysql");
+my $appdir = `basename $cwd`;
+chomp $appdir;
+my $appclass = ucfirst $appdir;
 
 open PUBLIC_HTACCESS, ">public/.htaccess";
@@ -120,13 +125,37 @@
 untie @railsfcgi;
 open RAILSFCGI, ">>public/dispatch.fcgi";
+print RAILSFCGI "#!/usr/bin/ruby\n";
 print RAILSFCGI <<EOF;
+require File.join(File.dirname(__FILE__), '../config/environment')       
+require 'rack'
 
 ## Added by scripts.mit.edu autoinstaller to reload when app code changes
 Thread.abort_on_exception = true
 
+class Rack::PathInfoRewriter
+  def initialize(app)
+    \@app = app
+  end
+
+  def call(env)
+    env["SCRIPT_NAME"] = ""
+    parts = env['REQUEST_URI'].split('?')
+    env['PATH_INFO'] = parts[0]
+    env['QUERY_STRING'] = parts[1].to_s
+    \@app.call(env)
+  end
+end
+
+
 t1 = Thread.new do
-   RailsFCGIHandler.process!
+  dispatch_logger = Logger.new(File.join(Rails.root,'log/dispatcher.log'))
+
+  begin
+    Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(Rack::URLMap.new("/$appdir" => ${appclass}::Application))
+  rescue => e
+   dispatch_logger.error(e)
+   raise e
+  end
 end
-
 t2 = Thread.new do
    # List of directories to watch for changes before reload.
@@ -195,4 +224,10 @@
 ## End of scripts.mit.edu autoinstaller additions
 EOF
+chmod 0755,'public/dispatch.fcgi';
+
+# have to explicitly take a dependency on fcgi
+open GEMFILE, ">>Gemfile";
+print GEMFILE "gem 'fcgi'\n";
+close GEMFILE;
 
 print "Your application is located in:\n";
Index: branches/fc17-dev/locker/sbin/delete-user
===================================================================
--- branches/fc17-dev/locker/sbin/delete-user	(revision 2195)
+++ branches/fc17-dev/locker/sbin/delete-user	(revision 2195)
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+import ldap
+import ldap.filter
+import pwd
+import sys
+
+actuallyRun = False
+
+def delete_record(l, full_name):
+    if actuallyRun:
+        print "Deleting %s..." % (full_name,)
+        l.delete_s(full_name)
+    else:
+        print "Would have deleted %s" % (full_name,)
+
+def findUser(l, username):
+    # Try to delete the 
+    user_record, = ll.search_s(
+        "ou=People,dc=scripts,dc=mit,dc=edu",
+        ldap.SCOPE_SUBTREE,
+        ldap.filter.filter_format(
+            "(&(objectClass=posixAccount)" +
+            "(uid=%s))",
+            [username]))
+
+    return user_record
+
+def findGroup(l, username):
+    group_record, = ll.search_s(
+        "ou=Groups,dc=scripts,dc=mit,dc=edu",
+        ldap.SCOPE_SUBTREE,
+        ldap.filter.filter_format(
+            "(&(objectClass=posixGroup)" +
+            "(cn=%s))",
+            [username]))
+
+    return group_record
+
+def findApacheConfig(l, uid):
+    host_records = ll.search_s(
+        "ou=VirtualHosts,dc=scripts,dc=mit,dc=edu",
+        ldap.SCOPE_SUBTREE,
+        ldap.filter.filter_format(
+            "(&(objectClass=apacheConfig)" +
+            "(apacheSuexecUid=%s))",
+            [uid]))
+
+    return host_records
+
+def findVhost(l, full_name):
+    host_records = ll.search_s(
+        "ou=VirtualHosts,dc=scripts,dc=mit,dc=edu",
+        ldap.SCOPE_SUBTREE,
+        ldap.filter.filter_format(
+            "(&(objectClass=scriptsVhost)" +
+            "(scriptsVhostAccount=%s))",
+            [full_name]))
+
+    return host_records
+
+if __name__ == '__main__':
+    (self, user) = sys.argv
+
+    print "Binding to ldap..."
+
+    ll = ldap.initialize("ldapi://%2fvar%2frun%2fslapd-scripts.socket/")
+    ll.simple_bind_s("cn=Directory Manager", open('/etc/signup-ldap-pw').read())
+
+    print "Finding user '%s'..." % (user,)
+    user_record = findUser(ll, user)
+
+    print "Finding group '%s'..." % (user,)
+    group_record = findGroup(ll, user)
+
+    print "Searching for apache configurations..."
+    apache_configs = findApacheConfig(ll, user_record[1]['uidNumber'][0])
+
+    print "Searching for vhost configurations..."
+    vhost_configs = findVhost(ll, user_record[0])
+
+    print "Deleting..."
+    delete_record(ll, user_record[0])
+    delete_record(ll, group_record[0])
+
+    for config in apache_configs:
+        delete_record(ll, config[0])
+
+    for vhost in vhost_configs:
+        delete_record(ll, vhost[0])
Index: branches/fc17-dev/locker/sbin/scripts-createrepo
===================================================================
--- branches/fc17-dev/locker/sbin/scripts-createrepo	(revision 2195)
+++ branches/fc17-dev/locker/sbin/scripts-createrepo	(revision 2195)
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Runs createrepo on the primary scripts server and copies the resulting
+# metadata to the live yum repository.
+
+set -eux
+
+ssh='ssh -o GSSAPIAuthentication=yes -o GSSAPIDelegateCredentials=no'
+
+yum=/afs/athena.mit.edu/contrib/scripts/yum-repos/rpm-fc$($ssh root@scripts.mit.edu 'lsb_release -rs')
+[ -d "$yum" ]
+
+tmp=$($ssh root@scripts.mit.edu "\
+set -eux
+tmp=\$(mktemp -dt createrepo.XXXXXX)
+createrepo -d -o \"\$tmp\" -- '$yum' >&2
+printf '%s' \"\$tmp\"
+")
+[ "$tmp" ]
+
+new=$(mktemp -d -- "$yum/repodata.XXXXXX")
+rsync -avz -e "$ssh" -- "root@scripts.mit.edu:$tmp/repodata/" "$new"
+mv -b -T -- "$new" "$yum/repodata"
+rm -rf -- "$yum/repodata~"
+
+$ssh root@scripts.mit.edu "\
+set -eux
+rm -rf -- '$tmp'
+"
