diff --git a/include/vere/vere.h b/include/vere/vere.h index 1e6feaddf..9819c5045 100644 --- a/include/vere/vere.h +++ b/include/vere/vere.h @@ -535,6 +535,7 @@ c3_c* who_c; // -T, begin with ticket c3_c* tic_c; // -T, ticket value c3_c* pil_c; // -B, bootstrap from + c3_c* arv_c; // -A, initial sync from c3_w kno_w; // -k, kernel version c3_w fuz_w; // -f, fuzz testing c3_s por_s; // -p, ames port diff --git a/vere/main.c b/vere/main.c index a72b3abb9..c8a61b1c1 100644 --- a/vere/main.c +++ b/vere/main.c @@ -82,7 +82,7 @@ _main_getopt(c3_i argc, c3_c** argv) u3_Host.ops_u.rep = c3n; u3_Host.ops_u.kno_w = DefaultKernel; - while ( (ch_i=getopt(argc, argv,"B:I:w:t:f:k:l:n:p:r:LabcdgqvxFMPDXR")) != -1 ) { + while ( (ch_i=getopt(argc, argv,"B:A:I:w:t:f:k:l:n:p:r:LabcdgqvxFMPDXR")) != -1 ) { switch ( ch_i ) { case 'M': { u3_Host.ops_u.mem = c3y; @@ -92,6 +92,10 @@ _main_getopt(c3_i argc, c3_c** argv) u3_Host.ops_u.pil_c = strdup(optarg); break; } + case 'A': { + u3_Host.ops_u.arv_c = strdup(optarg); + break; + } case 'I': { u3_Host.ops_u.imp_c = _main_presig(optarg); break; @@ -170,6 +174,20 @@ _main_getopt(c3_i argc, c3_c** argv) } } + if ( u3_Host.ops_u.arv_c != 0 && ( u3_Host.ops_u.imp_c == 0 || + u3_Host.ops_u.nuu == c3n ) ) { + fprintf(stderr, "-A only makes sense when creating a new galaxy"); + return c3n; + } + + if ( u3_Host.ops_u.imp_c != 0 && + u3_Host.ops_u.arv_c == 0 && + u3_Host.ops_u.nuu == c3y ) { + fprintf(stderr, "can't create a new galaxy without specifying " + "the initial sync path with -A\n"); + return c3n; + } + if ( u3_Host.ops_u.rop_s == 0 && u3_Host.ops_u.raf_c != 0 ) { fprintf(stderr, "The -r flag requires -l.\n"); return c3n; diff --git a/vere/unix.c b/vere/unix.c index fa4926a3a..2634d0857 100644 --- a/vere/unix.c +++ b/vere/unix.c @@ -1010,7 +1010,9 @@ _unix_initial_update_file(c3_c* pax_c) return u3_nul; } else { - u3_noun pax = _unix_string_to_path_helper(pax_c + strlen(U3_LIB) + 6); /* XX VERY BAD */ + u3_noun pax = _unix_string_to_path_helper(pax_c + + strlen(u3_Host.ops_u.arv_c) + + 1); /* XX slightly less VERY BAD than before*/ u3_noun mim = u3nt(c3__text, u3i_string("plain"), u3_nul); u3_noun dat = u3nt(mim, len_ws, u3i_bytes(len_ws, dat_y)); @@ -1445,9 +1447,7 @@ u3_unix_ef_move(void) void u3_unix_ef_initial_into() { - c3_c* pax_c = _unix_down(U3_LIB, "arvo"); - u3_noun can = _unix_initial_update_dir(pax_c); - free(pax_c); + u3_noun can = _unix_initial_update_dir(u3_Host.ops_u.arv_c); u3v_plan(u3nq(u3_blip, c3__sync, u3k(u3A->sen), u3_nul), u3nq(c3__into, u3_nul, c3y, can));