Properly working _boot_home()

Awful hack - there is more than one place where the various pier
directories are created, sadly. So the best we can do without the real
great boot sequence refactoring is this flaky test for urbit.pill's
presence, and removing the error tests from mkdir() calls...
This commit is contained in:
Raymond Pasco 2016-09-22 02:02:14 -04:00
parent 3bf37b6c04
commit 20b38fb84d

View File

@ -1503,16 +1503,6 @@ _boot_home(c3_c *dir_c, c3_c *pil_c)
{
c3_c ful_c[2048];
/* have we done this before? */
{
struct stat s;
snprintf(ful_c, 2048, "%s/.urb", dir_c);
if ( stat(ful_c, &s) == 0 ) {
printf("home: already exists\r\n");
return;
}
}
/* Create subdirectories. */
{
mkdir(dir_c, 0700);
@ -1521,26 +1511,26 @@ _boot_home(c3_c *dir_c, c3_c *pil_c)
mkdir(ful_c, 0700);
snprintf(ful_c, 2048, "%s/.urb/get", dir_c);
if ( 0 != mkdir(ful_c, 0700) ) {
perror(ful_c);
exit(1);
}
mkdir(ful_c, 0700);
snprintf(ful_c, 2048, "%s/.urb/put", dir_c);
if ( 0 != mkdir(ful_c, 0700) ) {
perror(ful_c);
exit(1);
}
mkdir(ful_c, 0700);
snprintf(ful_c, 2048, "%s/.urb/sis", dir_c);
if ( 0 != mkdir(ful_c, 0700) ) {
perror(ful_c);
exit(1);
}
mkdir(ful_c, 0700);
}
/* Copy urbit.pill. */
{
{
struct stat s;
snprintf(ful_c, 2048, "%s/.urb/urbit.pill", dir_c);
if ( stat(ful_c, &s) == 0 ) {
/* we're in a "logical boot". awful hack, but bail here */
printf("%s confirmed to exist\r\n", ful_c);
return;
}
}
if ( pil_c != 0 ) {
snprintf(ful_c, 2048, "cp %s %s/.urb/urbit.pill",
pil_c, dir_c);