More autopart fixes (set new partition active if none other set active)
This commit is contained in:
parent
fa21660f75
commit
a23604dc81
1 changed files with 24 additions and 20 deletions
|
@ -1227,12 +1227,12 @@ void check_ind(struct part_entry *pe)
|
||||||
{
|
{
|
||||||
struct part_entry *pe2;
|
struct part_entry *pe2;
|
||||||
|
|
||||||
if (pe->sysind != NO_PART) return;
|
|
||||||
|
|
||||||
for (pe2= table + 1; pe2 < table + 1 + NR_PARTITIONS; pe2++)
|
for (pe2= table + 1; pe2 < table + 1 + NR_PARTITIONS; pe2++)
|
||||||
if (pe2->sysind != NO_PART || pe2->bootind & ACTIVE_FLAG) break;
|
if (pe2->sysind != NO_PART && (pe2->bootind & ACTIVE_FLAG))
|
||||||
|
return;
|
||||||
|
|
||||||
if (pe2 == table + 1 + NR_PARTITIONS) pe->bootind= ACTIVE_FLAG;
|
pe->bootind= ACTIVE_FLAG;
|
||||||
|
dirty = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_existing(struct part_entry *pe)
|
int check_existing(struct part_entry *pe)
|
||||||
|
@ -1867,12 +1867,16 @@ void m_read(int ev, object_t *op)
|
||||||
} else
|
} else
|
||||||
if (n < SECTOR_SIZE) {
|
if (n < SECTOR_SIZE) {
|
||||||
if(probing) {
|
if(probing) {
|
||||||
|
v = 0;
|
||||||
|
ioctl(device, DIOCTIMEOUT, &v);
|
||||||
close(device);
|
close(device);
|
||||||
device= -1;
|
device= -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("%s: Unexpected EOF", curdev->subname);
|
printf("%s: Unexpected EOF", curdev->subname);
|
||||||
}
|
}
|
||||||
|
v = 0;
|
||||||
|
ioctl(device, DIOCTIMEOUT, &v);
|
||||||
if (n <= 0) stat_end(5);
|
if (n <= 0) stat_end(5);
|
||||||
|
|
||||||
if (n < SECTOR_SIZE) n= SECTOR_SIZE;
|
if (n < SECTOR_SIZE) n= SECTOR_SIZE;
|
||||||
|
@ -2311,11 +2315,11 @@ may_kill_region(void)
|
||||||
|
|
||||||
if(used_regions < 1) return 1;
|
if(used_regions < 1) return 1;
|
||||||
|
|
||||||
printf("\n-- STEP 2 -- Optionally delete regions -----------------------------\n\n");
|
printf("\n -- Delete in-use region? ----\n\n");
|
||||||
|
|
||||||
printregions(regions, 0, nr_partitions, free_regions, nr_regions, 1);
|
printregions(regions, 0, nr_partitions, free_regions, nr_regions, 1);
|
||||||
printf("\nIf you want to delete an in-use region to free it up for MINIX,\n"
|
printf("\nIf you want to delete an in-use region, please type its \n"
|
||||||
"type its number. Otherwise hit ENTER to continue: ");
|
"number. Otherwise hit ENTER to continue: ");
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
fgets(line, sizeof(line)-2, stdin);
|
fgets(line, sizeof(line)-2, stdin);
|
||||||
if(!isdigit(line[0]))
|
if(!isdigit(line[0]))
|
||||||
|
@ -2386,14 +2390,19 @@ select_region(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nr_regions > 1) {
|
if(nr_regions > 1) {
|
||||||
printf("\nPlease enter region number you want to use,\n"
|
printf("\nPlease enter region number you want to use");
|
||||||
"or ENTER to go back a step to free a region: ");
|
if(used_regions > 0) {
|
||||||
|
printf(" or F to free an in-use region: ");
|
||||||
|
}
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
|
|
||||||
if(!fgets(line, sizeof(line)-2, stdin))
|
if(!fgets(line, sizeof(line)-2, stdin))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
if(line[0] == '\n') return NULL;
|
if(line[0] == 'F') {
|
||||||
|
may_kill_region();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if(sscanf(line, "%d", &rn) != 1)
|
if(sscanf(line, "%d", &rn) != 1)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2553,12 +2562,11 @@ do_autopart(int resultfd)
|
||||||
|
|
||||||
printf("\nWelcome to the autopart process. There are four steps.\n\n"
|
printf("\nWelcome to the autopart process. There are four steps.\n\n"
|
||||||
"1. Select the drive you want to use.\n"
|
"1. Select the drive you want to use.\n"
|
||||||
"2. Optionally delete in-use regions(s), if they exist.\n"
|
"2. Select a region to install MINIX in.\n"
|
||||||
"3. Select a region to install MINIX in.\n"
|
"3. After confirmation, write new table to disk.\n"
|
||||||
"4. After confirmation, write new table to disk.\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"As you can see, nothing will happen to your disk before the\n"
|
"As you can see, nothing will happen to your disk before the\n"
|
||||||
"last step. Then I will print the new table and let you confirm it.\n\n"
|
"last step.\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
printf("Press ENTER to continue: ");
|
printf("Press ENTER to continue: ");
|
||||||
|
@ -2582,17 +2590,13 @@ do_autopart(int resultfd)
|
||||||
memcpy(orig_table, table, sizeof(table));
|
memcpy(orig_table, table, sizeof(table));
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* Allow for partition(s) to be killed. */
|
printf("\n-- STEP 2 -- Select region to install in ---------------------------\n\n");
|
||||||
while(!may_kill_region())
|
|
||||||
;
|
|
||||||
|
|
||||||
printf("\n-- STEP 3 -- Select region to install in ---------------------------\n\n");
|
|
||||||
|
|
||||||
/* Show regions. */
|
/* Show regions. */
|
||||||
r = select_region();
|
r = select_region();
|
||||||
} while(!r); /* Back to step 2. */
|
} while(!r); /* Back to step 2. */
|
||||||
|
|
||||||
printf("\n-- STEP 4 -- Write table to disk -----------------------------------\n\n");
|
printf("\n-- STEP 3 -- Write table to disk -----------------------------------\n\n");
|
||||||
|
|
||||||
/* Write things. */
|
/* Write things. */
|
||||||
if(scribble_region(r, &pe)) {
|
if(scribble_region(r, &pe)) {
|
||||||
|
|
Loading…
Reference in a new issue