mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-04 02:49:42 +03:00
Fetch pill from bootstrap site if not specified
This commit is contained in:
parent
8d43f39a4a
commit
b8dcc5f17d
@ -1531,6 +1531,7 @@ _boot_home(c3_c *dir_c, c3_c *pil_c)
|
|||||||
|
|
||||||
/* Copy urbit.pill. */
|
/* Copy urbit.pill. */
|
||||||
{
|
{
|
||||||
|
if ( pil_c != 0 ) {
|
||||||
snprintf(ful_c, 2048, "cp %s %s/.urb/urbit.pill",
|
snprintf(ful_c, 2048, "cp %s %s/.urb/urbit.pill",
|
||||||
pil_c, dir_c);
|
pil_c, dir_c);
|
||||||
printf("%s\r\n", ful_c);
|
printf("%s\r\n", ful_c);
|
||||||
@ -1538,6 +1539,33 @@ _boot_home(c3_c *dir_c, c3_c *pil_c)
|
|||||||
fprintf(stderr, "could not %s\n", ful_c);
|
fprintf(stderr, "could not %s\n", ful_c);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
c3_c *url_c = "https://bootstrap.urbit.org/latest.pill";
|
||||||
|
CURL *curl;
|
||||||
|
CURLcode result;
|
||||||
|
FILE *file;
|
||||||
|
|
||||||
|
snprintf(ful_c, 2048, "%s/.urb/urbit.pill", dir_c);
|
||||||
|
printf("fetching %s to %s\r\n", url_c, ful_c);
|
||||||
|
if ( !(curl = curl_easy_init()) ) {
|
||||||
|
fprintf(stderr, "failed to initialize libcurl\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if ( !(file = fopen(ful_c, "w")) ) {
|
||||||
|
fprintf(stderr, "failed to open %s\n", ful_c);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
curl_easy_setopt(curl, CURLOPT_URL, url_c);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
|
||||||
|
result = curl_easy_perform(curl);
|
||||||
|
fclose(file);
|
||||||
|
if ( result != CURLE_OK ) {
|
||||||
|
fprintf(stderr, "failed to fetch %s: %s\n", url_c, curl_easy_strerror(result));
|
||||||
|
fprintf(stderr, "please fetch it manually and specify the location with -B\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
vere/main.c
10
vere/main.c
@ -218,16 +218,6 @@ _main_getopt(c3_i argc, c3_c** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( u3_Host.ops_u.nuu == c3y && u3_Host.ops_u.pil_c == 0) {
|
|
||||||
struct stat s;
|
|
||||||
if ( stat("urbit.pill", &s) == 0 ) {
|
|
||||||
u3_Host.ops_u.pil_c = strdup("urbit.pill");
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Could not find urbit.pill\n");
|
|
||||||
return c3n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( u3_Host.ops_u.nam_c == 0 ) {
|
if ( u3_Host.ops_u.nam_c == 0 ) {
|
||||||
u3_Host.ops_u.nam_c = getenv("HOSTNAME");
|
u3_Host.ops_u.nam_c = getenv("HOSTNAME");
|
||||||
if ( u3_Host.ops_u.nam_c == 0 ) {
|
if ( u3_Host.ops_u.nam_c == 0 ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user