Diff
Not logged in

Differences From:

File src/clone.c part of check-in [6b0b57a924] - Add logic to do a configuration push. Add logic to synchronize the CONCEALED table containing hidden email addresses (assuming appropriate permissions). Additional testng is needed; this check-in is to transfer the work to another machine. by drh on 2008-10-25 17:51:37. [view]

To:

File src/clone.c part of check-in [0c6ea0d93f] - When creating a new repository or cloning a repository, print the initial administrator password on standard output. This is intended to help new users figure out how to log in. Ticket ca08d51f19 by drh on 2008-11-20 01:07:10. [view]

@@ -37,8 +37,9 @@
 ** Make a clone of a repository specified by URL in the local
 ** file named FILENAME.
 */
 void clone_cmd(void){
+  char *zPassword;
   url_proxy_options();
   if( g.argc!=4 ){
     usage("FILE-OR-URL NEW-REPOSITORY");
   }
@@ -56,8 +57,12 @@
     db_multi_exec(
       "REPLACE INTO config(name,value)"
       " VALUES('server-code', lower(hex(randomblob(20))));"
     );
+    g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'");
+    if( g.zLogin==0 ){
+      db_create_default_users(1);
+    }
     printf("Repository cloned into %s\n", g.argv[3]);
   }else{
     db_create_repository(g.argv[3]);
     db_open_repository(g.argv[3]);
@@ -83,6 +88,10 @@
   }
   db_begin_transaction();
   printf("Rebuilding repository meta-data...\n");
   rebuild_db(0, 1);
+  printf("project-id: %s\n", db_get("project-code", 0));
+  printf("server-id:  %s\n", db_get("server-code", 0));
+  zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
+  printf("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
   db_end_transaction(0);
 }