--- install.php.orig	2009-08-23 19:09:50.000000000 +0200
+++ install.php	2009-08-23 19:04:57.000000000 +0200
@@ -40,6 +40,14 @@
   drupal_load('module', 'system');
   drupal_load('module', 'filter');
 
+  // Install profile chosen, set the global immediatly
+  //
+  // this needs to be done before the theme cache gets initialized in
+  // drupal_maintenance_theme()
+  if (!empty($_GET['profile'])) {
+    $profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
+  }
+
   // Set up theme system for the maintenance page.
   drupal_maintenance_theme();
 
@@ -74,15 +82,14 @@
     $task = NULL;
   }
 
-  // Decide which profile to use.
-  if (!empty($_GET['profile'])) {
-    $profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
-  }
-  elseif ($profile = install_select_profile()) {
-    install_goto("install.php?profile=$profile");
-  }
-  else {
-    install_no_profile_error();
+  // No profile was passed in GET, ask the user.
+  if (empty($_GET['profile'])) {
+    if ($profile = install_select_profile()) {
+      install_goto("install.php?profile=$profile");
+    }
+    else {
+      install_no_profile_error();
+    }
   }
 
   // Load the profile.
