diff -urp --strip-trailing-cr ../category/category.install ./category.install
--- ../category/category.install	2009-03-05 23:23:54.000000000 +0100
+++ ./category.install	2009-05-17 23:57:12.000000000 +0200
@@ -417,7 +417,7 @@ function category_update_6000() {
 
   db_add_field($ret, 'category_node', 'vid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
 
-  $result = db_query('UPDATE {category_node} SET vid = nid');
+  $ret[] = update_sql('UPDATE {category_node} SET vid = (SELECT vid FROM {node} n WHERE {category_node}.nid = n.nid)');
 
   db_add_primary_key($ret, 'category_node', array('cid, vid'));
   db_add_index($ret, 'category_node', 'vid', array('vid'));
@@ -441,8 +441,8 @@ function category_update_6000() {
   variable_set('category_behavior_category', 'category');
   variable_set('category_behavior_container', 'container');
   
-  db_query("UPDATE {node} SET type = 'category' WHERE type = 'category_cat'");
-  db_query("UPDATE {node} SET type = 'container' WHERE type = 'category_cont'");
+  $ret[] = update_sql("UPDATE {node} SET type = 'category' WHERE type = 'category_cat'");
+  $ret[] = update_sql("UPDATE {node} SET type = 'container' WHERE type = 'category_cont'");
 
   variable_del('category_allow_nodetypes');
   variable_del('category_base_nodetypes');
@@ -453,3 +453,28 @@ function category_update_6000() {
 
   return $ret;
 }
+
+/**
+ * Transfer settings from old content types. This was added after beta 2
+ * release, so avoid changes to new variables possibly already there.
+ */
+function category_update_6001() {
+  $ret = array();
+
+  $candidates = db_query("SELECT name FROM {variable} WHERE name LIKE '%%\_category\_cat%%' OR name LIKE '%%\_category\_cont%%'");
+  while ($old_name = db_fetch_array($candidates)) {
+    $old_name = $old_name['name'];
+    $new_name = str_replace(array('_category_cat', '_category_cont'), array('_category', '_container'), $old_name);
+    if ($old_name != $new_name) {
+      $old_value = variable_get($old_name, NULL);
+      $new_value = variable_get($new_name, NULL);
+      if (isset($old_value) && !isset($new_value)) {
+        variable_set($new_name, $old_value);
+        $ret[] = array('success' => TRUE, 'query' => "variable_set($new_name)");
+      }
+      variable_del($old_name);
+      $ret[] = array('success' => TRUE, 'query' => "variable_del($old_name)");
+    }
+  }
+  return $ret;
+}
