Disk selection dialog is now a normal menu, not a checkboxed menu:
checkboxed menu is confusing and also can not be implemented in new libdialog.
This commit is contained in:
parent
b010577828
commit
246864a52b
@ -122,7 +122,7 @@ deviceTry(struct _devname dev, char *try, int i)
|
|||||||
|
|
||||||
/* Register a new device in the devices array */
|
/* Register a new device in the devices array */
|
||||||
Device *
|
Device *
|
||||||
deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled,
|
deviceRegister(char *name, char *desc, char *devname, DeviceType type,
|
||||||
Boolean (*init)(Device *), FILE * (*get)(Device *, char *, Boolean),
|
Boolean (*init)(Device *), FILE * (*get)(Device *, char *, Boolean),
|
||||||
void (*shutdown)(Device *), void *private)
|
void (*shutdown)(Device *), void *private)
|
||||||
{
|
{
|
||||||
@ -135,7 +135,6 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e
|
|||||||
newdev->description = desc;
|
newdev->description = desc;
|
||||||
newdev->devname = devname;
|
newdev->devname = devname;
|
||||||
newdev->type = type;
|
newdev->type = type;
|
||||||
newdev->enabled = enabled;
|
|
||||||
newdev->init = init ? init : dummyInit;
|
newdev->init = init ? init : dummyInit;
|
||||||
newdev->get = get ? get : dummyGet;
|
newdev->get = get ? get : dummyGet;
|
||||||
newdev->shutdown = shutdown ? shutdown : dummyShutdown;
|
newdev->shutdown = shutdown ? shutdown : dummyShutdown;
|
||||||
@ -223,7 +222,7 @@ deviceGetAll(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceRegister(names[i], names[i], d->name, DEVICE_TYPE_DISK, FALSE,
|
deviceRegister(names[i], names[i], d->name, DEVICE_TYPE_DISK,
|
||||||
dummyInit, dummyGet, dummyShutdown, d);
|
dummyInit, dummyGet, dummyShutdown, d);
|
||||||
if (isDebug())
|
if (isDebug())
|
||||||
msgDebug("Found a disk device named %s\n", names[i]);
|
msgDebug("Found a disk device named %s\n", names[i]);
|
||||||
@ -237,7 +236,7 @@ deviceGetAll(void)
|
|||||||
|
|
||||||
/* Got one! */
|
/* Got one! */
|
||||||
snprintf(devname, sizeof devname, "/dev/%s", c1->name);
|
snprintf(devname, sizeof devname, "/dev/%s", c1->name);
|
||||||
dev = deviceRegister(c1->name, c1->name, strdup(devname), DEVICE_TYPE_DOS, TRUE,
|
dev = deviceRegister(c1->name, c1->name, strdup(devname), DEVICE_TYPE_DOS,
|
||||||
mediaInitDOS, mediaGetDOS, mediaShutdownDOS, NULL);
|
mediaInitDOS, mediaGetDOS, mediaShutdownDOS, NULL);
|
||||||
dev->private = c1;
|
dev->private = c1;
|
||||||
if (isDebug())
|
if (isDebug())
|
||||||
@ -314,7 +313,7 @@ deviceCount(Device **devs)
|
|||||||
* menu is cloned.
|
* menu is cloned.
|
||||||
*/
|
*/
|
||||||
DMenu *
|
DMenu *
|
||||||
deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), int (*check)(dialogMenuItem *d))
|
deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d))
|
||||||
{
|
{
|
||||||
Device **devs;
|
Device **devs;
|
||||||
int numdevs;
|
int numdevs;
|
||||||
@ -338,7 +337,6 @@ deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), i
|
|||||||
if (j == numDevs)
|
if (j == numDevs)
|
||||||
tmp->items[i].title = "<unknown device type>";
|
tmp->items[i].title = "<unknown device type>";
|
||||||
tmp->items[i].fire = hook;
|
tmp->items[i].fire = hook;
|
||||||
tmp->items[i].checked = check;
|
|
||||||
}
|
}
|
||||||
tmp->items[i].title = NULL;
|
tmp->items[i].title = NULL;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -305,25 +305,6 @@ getBootMgr(char *dname, u_char **bootCode, size_t *bootCodeSize)
|
|||||||
#endif
|
#endif
|
||||||
#endif /* WITH_SLICES */
|
#endif /* WITH_SLICES */
|
||||||
|
|
||||||
int
|
|
||||||
diskGetSelectCount(Device ***devs)
|
|
||||||
{
|
|
||||||
int i, cnt, enabled;
|
|
||||||
char *cp;
|
|
||||||
Device **dp;
|
|
||||||
|
|
||||||
cp = variable_get(VAR_DISK);
|
|
||||||
dp = *devs = deviceFind(cp, DEVICE_TYPE_DISK);
|
|
||||||
cnt = deviceCount(dp);
|
|
||||||
if (!cnt)
|
|
||||||
return -1;
|
|
||||||
for (i = 0, enabled = 0; i < cnt; i++) {
|
|
||||||
if (dp[i]->enabled)
|
|
||||||
++enabled;
|
|
||||||
}
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WITH_SLICES
|
#ifdef WITH_SLICES
|
||||||
void
|
void
|
||||||
diskPartition(Device *dev)
|
diskPartition(Device *dev)
|
||||||
@ -641,7 +622,7 @@ diskPartition(Device *dev)
|
|||||||
Set_Boot_Mgr(d, mbrContents, mbrSize);
|
Set_Boot_Mgr(d, mbrContents, mbrSize);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (DITEM_STATUS(diskPartitionWrite(NULL)) != DITEM_SUCCESS)
|
if (DITEM_STATUS(diskPartitionWrite(dev)) != DITEM_SUCCESS)
|
||||||
msgConfirm("Disk partition write returned an error status!");
|
msgConfirm("Disk partition write returned an error status!");
|
||||||
else
|
else
|
||||||
msgConfirm("Wrote FDISK partition information out successfully.");
|
msgConfirm("Wrote FDISK partition information out successfully.");
|
||||||
@ -770,7 +751,7 @@ bootalloc(char *name, size_t *size)
|
|||||||
}
|
}
|
||||||
#endif /* !__ia64__ */
|
#endif /* !__ia64__ */
|
||||||
|
|
||||||
#ifdef WITH_SLICES
|
#ifdef WITH_SLICES
|
||||||
static int
|
static int
|
||||||
partitionHook(dialogMenuItem *selected)
|
partitionHook(dialogMenuItem *selected)
|
||||||
{
|
{
|
||||||
@ -781,58 +762,28 @@ partitionHook(dialogMenuItem *selected)
|
|||||||
msgConfirm("Unable to find disk %s!", selected->prompt);
|
msgConfirm("Unable to find disk %s!", selected->prompt);
|
||||||
return DITEM_FAILURE;
|
return DITEM_FAILURE;
|
||||||
}
|
}
|
||||||
/* Toggle enabled status? */
|
diskPartition(devs[0]);
|
||||||
if (!devs[0]->enabled) {
|
|
||||||
devs[0]->enabled = TRUE;
|
|
||||||
diskPartition(devs[0]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
devs[0]->enabled = FALSE;
|
|
||||||
return DITEM_SUCCESS;
|
return DITEM_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
partitionCheck(dialogMenuItem *selected)
|
|
||||||
{
|
|
||||||
Device **devs = NULL;
|
|
||||||
|
|
||||||
devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);
|
|
||||||
if (!devs || devs[0]->enabled == FALSE)
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
diskPartitionEditor(dialogMenuItem *self)
|
diskPartitionEditor(dialogMenuItem *self)
|
||||||
{
|
{
|
||||||
DMenu *menu;
|
DMenu *menu;
|
||||||
Device **devs;
|
Device **devs;
|
||||||
int i, cnt, devcnt;
|
|
||||||
|
|
||||||
cnt = diskGetSelectCount(&devs);
|
devs = deviceFind(variable_get(VAR_DISK), DEVICE_TYPE_DISK);
|
||||||
devcnt = deviceCount(devs);
|
if (devs == NULL) {
|
||||||
if (cnt == -1) {
|
|
||||||
msgConfirm("No disks found! Please verify that your disk controller is being\n"
|
msgConfirm("No disks found! Please verify that your disk controller is being\n"
|
||||||
"properly probed at boot time. See the Hardware Guide on the\n"
|
"properly probed at boot time. See the Hardware Guide on the\n"
|
||||||
"Documentation menu for clues on diagnosing this type of problem.");
|
"Documentation menu for clues on diagnosing this type of problem.");
|
||||||
return DITEM_FAILURE;
|
return DITEM_FAILURE;
|
||||||
}
|
}
|
||||||
else if (cnt) {
|
|
||||||
/* Some are already selected */
|
|
||||||
for (i = 0; i < devcnt; i++) {
|
|
||||||
if (devs[i]->enabled) {
|
|
||||||
if (variable_get(VAR_NONINTERACTIVE) &&
|
|
||||||
!variable_get(VAR_DISKINTERACTIVE))
|
|
||||||
diskPartitionNonInteractive(devs[i]);
|
|
||||||
else
|
|
||||||
diskPartition(devs[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
/* No disks are selected, fall-back case now */
|
/* No disks are selected, fall-back case now */
|
||||||
if (devcnt == 1) {
|
int cnt = deviceCount(devs);
|
||||||
devs[0]->enabled = TRUE;
|
|
||||||
|
if (cnt == 1) {
|
||||||
if (variable_get(VAR_NONINTERACTIVE) &&
|
if (variable_get(VAR_NONINTERACTIVE) &&
|
||||||
!variable_get(VAR_DISKINTERACTIVE))
|
!variable_get(VAR_DISKINTERACTIVE))
|
||||||
diskPartitionNonInteractive(devs[0]);
|
diskPartitionNonInteractive(devs[0]);
|
||||||
@ -841,7 +792,9 @@ diskPartitionEditor(dialogMenuItem *self)
|
|||||||
return DITEM_SUCCESS;
|
return DITEM_SUCCESS;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook, partitionCheck);
|
int result;
|
||||||
|
|
||||||
|
menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook);
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
msgConfirm("No devices suitable for installation found!\n\n"
|
msgConfirm("No devices suitable for installation found!\n\n"
|
||||||
"Please verify that your disk controller (and attached drives)\n"
|
"Please verify that your disk controller (and attached drives)\n"
|
||||||
@ -850,11 +803,10 @@ diskPartitionEditor(dialogMenuItem *self)
|
|||||||
"the boot messages. Press [Scroll Lock] again to return.");
|
"the boot messages. Press [Scroll Lock] again to return.");
|
||||||
return DITEM_FAILURE;
|
return DITEM_FAILURE;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
|
result = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
|
||||||
free(menu);
|
free(menu);
|
||||||
}
|
return result;
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DITEM_SUCCESS;
|
return DITEM_SUCCESS;
|
||||||
@ -862,48 +814,34 @@ diskPartitionEditor(dialogMenuItem *self)
|
|||||||
#endif /* WITH_SLICES */
|
#endif /* WITH_SLICES */
|
||||||
|
|
||||||
int
|
int
|
||||||
diskPartitionWrite(dialogMenuItem *self)
|
diskPartitionWrite(Device *dev)
|
||||||
{
|
{
|
||||||
Device **devs;
|
Disk *d = (Disk *)dev->private;
|
||||||
int i;
|
#if !defined(__ia64__)
|
||||||
|
static u_char *boot1;
|
||||||
|
#endif
|
||||||
|
#if defined(__i386__) || defined(__amd64__)
|
||||||
|
static u_char *boot2;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!variable_cmp(DISK_PARTITIONED, "written"))
|
if (!variable_cmp(DISK_PARTITIONED, "written"))
|
||||||
return DITEM_SUCCESS;
|
return DITEM_SUCCESS;
|
||||||
|
|
||||||
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
|
|
||||||
if (!devs) {
|
|
||||||
msgConfirm("Unable to find any disks to write to??");
|
|
||||||
return DITEM_FAILURE;
|
|
||||||
}
|
|
||||||
if (isDebug())
|
|
||||||
msgDebug("diskPartitionWrite: Examining %d devices\n", deviceCount(devs));
|
|
||||||
for (i = 0; devs[i]; i++) {
|
|
||||||
Disk *d = (Disk *)devs[i]->private;
|
|
||||||
#if !defined(__ia64__)
|
|
||||||
static u_char *boot1;
|
|
||||||
#endif
|
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
#if defined(__i386__) || defined(__amd64__)
|
||||||
static u_char *boot2;
|
if (!boot1) boot1 = bootalloc("boot1", NULL);
|
||||||
#endif
|
if (!boot2) boot2 = bootalloc("boot2", NULL);
|
||||||
|
Set_Boot_Blocks(d, boot1, boot2);
|
||||||
if (!devs[i]->enabled)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
|
||||||
if (!boot1) boot1 = bootalloc("boot1", NULL);
|
|
||||||
if (!boot2) boot2 = bootalloc("boot2", NULL);
|
|
||||||
Set_Boot_Blocks(d, boot1, boot2);
|
|
||||||
#elif !defined(__ia64__)
|
#elif !defined(__ia64__)
|
||||||
if (!boot1) boot1 = bootalloc("boot1", NULL);
|
if (!boot1) boot1 = bootalloc("boot1", NULL);
|
||||||
Set_Boot_Blocks(d, boot1, NULL);
|
Set_Boot_Blocks(d, boot1, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
msgNotify("Writing partition information to drive %s", d->name);
|
msgNotify("Writing partition information to drive %s", d->name);
|
||||||
if (!Fake && Write_Disk(d)) {
|
if (!Fake && Write_Disk(d)) {
|
||||||
msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
|
msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
|
||||||
return DITEM_FAILURE;
|
return DITEM_FAILURE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now it's not "yes", but "written" */
|
/* Now it's not "yes", but "written" */
|
||||||
variable_set2(DISK_PARTITIONED, "written", 0);
|
variable_set2(DISK_PARTITIONED, "written", 0);
|
||||||
return DITEM_SUCCESS | DITEM_RESTORE;
|
return DITEM_SUCCESS | DITEM_RESTORE;
|
||||||
|
@ -113,12 +113,10 @@ performNewfs(PartInfo *pi, char *dname, int queue)
|
|||||||
|
|
||||||
/* Go newfs and/or mount all the filesystems we've been asked to */
|
/* Go newfs and/or mount all the filesystems we've been asked to */
|
||||||
int
|
int
|
||||||
installFilesystems(dialogMenuItem *self)
|
installFilesystems(Device *dev)
|
||||||
{
|
{
|
||||||
int i;
|
Disk *disk = (Disk *)dev->private;
|
||||||
Disk *disk;
|
|
||||||
Chunk *c1, *c2;
|
Chunk *c1, *c2;
|
||||||
Device **devs;
|
|
||||||
PartInfo *root;
|
PartInfo *root;
|
||||||
char dname[80];
|
char dname[80];
|
||||||
Boolean upgrade = FALSE;
|
Boolean upgrade = FALSE;
|
||||||
@ -136,84 +134,77 @@ installFilesystems(dialogMenuItem *self)
|
|||||||
command_clear();
|
command_clear();
|
||||||
|
|
||||||
/* Now buzz through the rest of the partitions and mount them too */
|
/* Now buzz through the rest of the partitions and mount them too */
|
||||||
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
|
if (!disk->chunks) {
|
||||||
for (i = 0; devs[i]; i++) {
|
msgConfirm("No chunk list found for %s!", disk->name);
|
||||||
if (!devs[i]->enabled)
|
return DITEM_FAILURE | DITEM_RESTORE;
|
||||||
continue;
|
}
|
||||||
|
for (c1 = disk->chunks->part; c1; c1 = c1->next) {
|
||||||
disk = (Disk *)devs[i]->private;
|
|
||||||
if (!disk->chunks) {
|
|
||||||
msgConfirm("No chunk list found for %s!", disk->name);
|
|
||||||
return DITEM_FAILURE | DITEM_RESTORE;
|
|
||||||
}
|
|
||||||
for (c1 = disk->chunks->part; c1; c1 = c1->next) {
|
|
||||||
#ifdef __ia64__
|
#ifdef __ia64__
|
||||||
if (c1->type == part) {
|
if (c1->type == part) {
|
||||||
c2 = c1;
|
c2 = c1;
|
||||||
{
|
{
|
||||||
#elif defined(__powerpc__)
|
#elif defined(__powerpc__)
|
||||||
if (c1->type == apple) {
|
if (c1->type == apple) {
|
||||||
for (c2 = c1->part; c2; c2 = c2->next) {
|
for (c2 = c1->part; c2; c2 = c2->next) {
|
||||||
#else
|
#else
|
||||||
if (c1->type == freebsd) {
|
if (c1->type == freebsd) {
|
||||||
for (c2 = c1->part; c2; c2 = c2->next) {
|
for (c2 = c1->part; c2; c2 = c2->next) {
|
||||||
#endif
|
#endif
|
||||||
if (c2->type == part && c2->subtype != FS_SWAP && c2->private_data) {
|
if (c2->type == part && c2->subtype != FS_SWAP && c2->private_data) {
|
||||||
PartInfo *tmp = (PartInfo *)c2->private_data;
|
PartInfo *tmp = (PartInfo *)c2->private_data;
|
||||||
|
|
||||||
/* Already did root */
|
/* Already did root */
|
||||||
if (c2 == RootChunk)
|
if (c2 == RootChunk)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sprintf(dname, "/dev/%s", c2->name);
|
sprintf(dname, "/dev/%s", c2->name);
|
||||||
|
|
||||||
if (tmp->do_newfs && (!upgrade ||
|
if (tmp->do_newfs && (!upgrade ||
|
||||||
!msgNoYes("You are upgrading - are you SURE you"
|
!msgNoYes("You are upgrading - are you SURE you"
|
||||||
" want to newfs /dev/%s?", c2->name)))
|
" want to newfs /dev/%s?", c2->name)))
|
||||||
performNewfs(tmp, dname, QUEUE_YES);
|
performNewfs(tmp, dname, QUEUE_YES);
|
||||||
else
|
else
|
||||||
command_shell_add(tmp->mountpoint,
|
command_shell_add(tmp->mountpoint,
|
||||||
"fsck_ffs -y /dev/%s", c2->name);
|
"fsck_ffs -y /dev/%s", c2->name);
|
||||||
command_func_add(tmp->mountpoint, Mount, c2->name);
|
command_func_add(tmp->mountpoint, Mount, c2->name);
|
||||||
}
|
}
|
||||||
else if (c2->type == part && c2->subtype == FS_SWAP) {
|
else if (c2->type == part && c2->subtype == FS_SWAP) {
|
||||||
char fname[80];
|
char fname[80];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (c2 == SwapChunk)
|
if (c2 == SwapChunk)
|
||||||
continue;
|
continue;
|
||||||
sprintf(fname, "/dev/%s", c2->name);
|
sprintf(fname, "/dev/%s", c2->name);
|
||||||
i = (Fake || swapon(fname));
|
i = (Fake || swapon(fname));
|
||||||
if (!i) {
|
if (!i) {
|
||||||
dialog_clear_norefresh();
|
dialog_clear_norefresh();
|
||||||
msgNotify("Added %s as an additional swap device", fname);
|
msgNotify("Added %s as an additional swap device", fname);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
msgConfirm("Unable to add %s as a swap device: %s", fname, strerror(errno));
|
msgConfirm("Unable to add %s as a swap device: %s", fname, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c1->type == fat && c1->private_data &&
|
else if (c1->type == fat && c1->private_data &&
|
||||||
(root->do_newfs || upgrade)) {
|
(root->do_newfs || upgrade)) {
|
||||||
char name[FILENAME_MAX];
|
char name[FILENAME_MAX];
|
||||||
|
|
||||||
sprintf(name, "/%s", ((PartInfo *)c1->private_data)->mountpoint);
|
sprintf(name, "/%s", ((PartInfo *)c1->private_data)->mountpoint);
|
||||||
Mkdir(name);
|
Mkdir(name);
|
||||||
}
|
}
|
||||||
#if defined(__ia64__)
|
#if defined(__ia64__)
|
||||||
else if (c1->type == efi && c1->private_data) {
|
else if (c1->type == efi && c1->private_data) {
|
||||||
PartInfo *pi = (PartInfo *)c1->private_data;
|
PartInfo *pi = (PartInfo *)c1->private_data;
|
||||||
|
|
||||||
sprintf(dname, "/dev/%s", c1->name);
|
sprintf(dname, "/dev/%s", c1->name);
|
||||||
|
|
||||||
if (pi->do_newfs && (!upgrade ||
|
if (pi->do_newfs && (!upgrade ||
|
||||||
!msgNoYes("You are upgrading - are you SURE you want to "
|
!msgNoYes("You are upgrading - are you SURE you want to "
|
||||||
"newfs /dev/%s?", c1->name)))
|
"newfs /dev/%s?", c1->name)))
|
||||||
performNewfs(pi, dname, QUEUE_YES);
|
performNewfs(pi, dname, QUEUE_YES);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
command_sort();
|
command_sort();
|
||||||
|
@ -110,7 +110,7 @@ static int label_focus = 0, pslice_focus = 0;
|
|||||||
|
|
||||||
static int diskLabel(Device *dev);
|
static int diskLabel(Device *dev);
|
||||||
static int diskLabelNonInteractive(Device *dev);
|
static int diskLabelNonInteractive(Device *dev);
|
||||||
static char *try_auto_label(Device **devs, Device *dev, int perc, int *req);
|
static char *try_auto_label(Device *dev, int perc, int *req);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
labelHook(dialogMenuItem *selected)
|
labelHook(dialogMenuItem *selected)
|
||||||
@ -122,86 +122,59 @@ labelHook(dialogMenuItem *selected)
|
|||||||
msgConfirm("Unable to find disk %s!", selected->prompt);
|
msgConfirm("Unable to find disk %s!", selected->prompt);
|
||||||
return DITEM_FAILURE;
|
return DITEM_FAILURE;
|
||||||
}
|
}
|
||||||
/* Toggle enabled status? */
|
diskLabel(devs[0]);
|
||||||
if (!devs[0]->enabled) {
|
|
||||||
devs[0]->enabled = TRUE;
|
|
||||||
diskLabel(devs[0]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
devs[0]->enabled = FALSE;
|
|
||||||
return DITEM_SUCCESS;
|
return DITEM_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
labelCheck(dialogMenuItem *selected)
|
|
||||||
{
|
|
||||||
Device **devs = NULL;
|
|
||||||
|
|
||||||
devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);
|
|
||||||
if (!devs || devs[0]->enabled == FALSE)
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
diskLabelEditor(dialogMenuItem *self)
|
diskLabelEditor(dialogMenuItem *self)
|
||||||
{
|
{
|
||||||
DMenu *menu;
|
DMenu *menu;
|
||||||
Device **devs;
|
Device **devs;
|
||||||
int i, cnt;
|
int result;
|
||||||
|
|
||||||
i = 0;
|
devs = deviceFind(variable_get(VAR_DISK), DEVICE_TYPE_DISK);
|
||||||
cnt = diskGetSelectCount(&devs);
|
if (devs == NULL) {
|
||||||
if (cnt == -1) {
|
|
||||||
msgConfirm("No disks found! Please verify that your disk controller is being\n"
|
msgConfirm("No disks found! Please verify that your disk controller is being\n"
|
||||||
"properly probed at boot time. See the Hardware Guide on the\n"
|
"properly probed at boot time. See the Hardware Guide on the\n"
|
||||||
"Documentation menu for clues on diagnosing this type of problem.");
|
"Documentation menu for clues on diagnosing this type of problem.");
|
||||||
return DITEM_FAILURE;
|
return DITEM_FAILURE;
|
||||||
}
|
}
|
||||||
else if (cnt) {
|
|
||||||
/* Some are already selected */
|
|
||||||
if (variable_get(VAR_NONINTERACTIVE) &&
|
|
||||||
!variable_get(VAR_DISKINTERACTIVE))
|
|
||||||
i = diskLabelNonInteractive(NULL);
|
|
||||||
else
|
|
||||||
i = diskLabel(NULL);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
/* No disks are selected, fall-back case now */
|
/* No disks are selected, fall-back case now */
|
||||||
cnt = deviceCount(devs);
|
int cnt = deviceCount(devs);
|
||||||
if (cnt == 1) {
|
if (cnt == 1) {
|
||||||
devs[0]->enabled = TRUE;
|
|
||||||
if (variable_get(VAR_NONINTERACTIVE) &&
|
if (variable_get(VAR_NONINTERACTIVE) &&
|
||||||
!variable_get(VAR_DISKINTERACTIVE))
|
!variable_get(VAR_DISKINTERACTIVE))
|
||||||
i = diskLabelNonInteractive(devs[0]);
|
result = diskLabelNonInteractive(devs[0]);
|
||||||
else
|
else
|
||||||
i = diskLabel(devs[0]);
|
result = diskLabel(devs[0]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, labelHook, labelCheck);
|
menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, labelHook);
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
msgConfirm("No devices suitable for installation found!\n\n"
|
msgConfirm("No devices suitable for installation found!\n\n"
|
||||||
"Please verify that your disk controller (and attached drives)\n"
|
"Please verify that your disk controller (and attached drives)\n"
|
||||||
"were detected properly. This can be done by pressing the\n"
|
"were detected properly. This can be done by pressing the\n"
|
||||||
"[Scroll Lock] key and using the Arrow keys to move back to\n"
|
"[Scroll Lock] key and using the Arrow keys to move back to\n"
|
||||||
"the boot messages. Press [Scroll Lock] again to return.");
|
"the boot messages. Press [Scroll Lock] again to return.");
|
||||||
i = DITEM_FAILURE;
|
result = DITEM_FAILURE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
|
result = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
|
||||||
free(menu);
|
free(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DITEM_STATUS(i) != DITEM_FAILURE) {
|
if (DITEM_STATUS(result) != DITEM_FAILURE) {
|
||||||
if (variable_cmp(DISK_LABELLED, "written"))
|
if (variable_cmp(DISK_LABELLED, "written"))
|
||||||
variable_set2(DISK_LABELLED, "yes", 0);
|
variable_set2(DISK_LABELLED, "yes", 0);
|
||||||
}
|
}
|
||||||
return i;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
diskLabelCommit(dialogMenuItem *self)
|
diskLabelCommit(Device *dev)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
int i;
|
int i;
|
||||||
@ -214,9 +187,9 @@ diskLabelCommit(dialogMenuItem *self)
|
|||||||
i = DITEM_FAILURE;
|
i = DITEM_FAILURE;
|
||||||
}
|
}
|
||||||
/* The routine will guard against redundant writes, just as this one does */
|
/* The routine will guard against redundant writes, just as this one does */
|
||||||
else if (DITEM_STATUS(diskPartitionWrite(self)) != DITEM_SUCCESS)
|
else if (DITEM_STATUS(diskPartitionWrite(dev)) != DITEM_SUCCESS)
|
||||||
i = DITEM_FAILURE;
|
i = DITEM_FAILURE;
|
||||||
else if (DITEM_STATUS(installFilesystems(self)) != DITEM_SUCCESS)
|
else if (DITEM_STATUS(installFilesystems(dev)) != DITEM_SUCCESS)
|
||||||
i = DITEM_FAILURE;
|
i = DITEM_FAILURE;
|
||||||
else {
|
else {
|
||||||
msgInfo("All filesystem information written successfully.");
|
msgInfo("All filesystem information written successfully.");
|
||||||
@ -258,98 +231,87 @@ space_free(struct chunk *c)
|
|||||||
|
|
||||||
/* Snapshot the current situation into the displayed chunks structure */
|
/* Snapshot the current situation into the displayed chunks structure */
|
||||||
static void
|
static void
|
||||||
record_label_chunks(Device **devs, Device *dev)
|
record_label_chunks(Device *dev)
|
||||||
{
|
{
|
||||||
int i, j, p;
|
int j, p;
|
||||||
struct chunk *c1, *c2;
|
struct chunk *c1, *c2;
|
||||||
Disk *d;
|
Disk *d = (Disk *)dev->private;
|
||||||
|
|
||||||
j = p = 0;
|
j = p = 0;
|
||||||
/* First buzz through and pick up the FreeBSD slices */
|
/* First buzz through and pick up the FreeBSD slices */
|
||||||
for (i = 0; devs[i]; i++) {
|
if (!d->chunks)
|
||||||
if ((dev && devs[i] != dev) || !devs[i]->enabled)
|
msgFatal("No chunk list found for %s!", d->name);
|
||||||
continue;
|
|
||||||
d = (Disk *)devs[i]->private;
|
|
||||||
if (!d->chunks)
|
|
||||||
msgFatal("No chunk list found for %s!", d->name);
|
|
||||||
|
|
||||||
#ifdef __ia64__
|
#ifdef __ia64__
|
||||||
label_chunk_info[j].type = PART_SLICE;
|
label_chunk_info[j].type = PART_SLICE;
|
||||||
label_chunk_info[j].c = d->chunks;
|
label_chunk_info[j].c = d->chunks;
|
||||||
j++;
|
j++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Put the slice entries first */
|
/* Put the slice entries first */
|
||||||
for (c1 = d->chunks->part; c1; c1 = c1->next) {
|
for (c1 = d->chunks->part; c1; c1 = c1->next) {
|
||||||
if (c1->type == freebsd) {
|
if (c1->type == freebsd) {
|
||||||
label_chunk_info[j].type = PART_SLICE;
|
label_chunk_info[j].type = PART_SLICE;
|
||||||
label_chunk_info[j].c = c1;
|
label_chunk_info[j].c = c1;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
#ifdef __powerpc__
|
#ifdef __powerpc__
|
||||||
if (c1->type == apple) {
|
if (c1->type == apple) {
|
||||||
label_chunk_info[j].type = PART_SLICE;
|
label_chunk_info[j].type = PART_SLICE;
|
||||||
label_chunk_info[j].c = c1;
|
label_chunk_info[j].c = c1;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now run through again and get the FreeBSD partition entries */
|
/* Then buzz through and pick up the partitions */
|
||||||
for (i = 0; devs[i]; i++) {
|
for (c1 = d->chunks->part; c1; c1 = c1->next) {
|
||||||
if (!devs[i]->enabled)
|
if (c1->type == freebsd) {
|
||||||
continue;
|
for (c2 = c1->part; c2; c2 = c2->next) {
|
||||||
d = (Disk *)devs[i]->private;
|
if (c2->type == part) {
|
||||||
/* Then buzz through and pick up the partitions */
|
if (c2->subtype == FS_SWAP)
|
||||||
for (c1 = d->chunks->part; c1; c1 = c1->next) {
|
label_chunk_info[j].type = PART_SWAP;
|
||||||
if (c1->type == freebsd) {
|
else
|
||||||
for (c2 = c1->part; c2; c2 = c2->next) {
|
label_chunk_info[j].type = PART_FILESYSTEM;
|
||||||
if (c2->type == part) {
|
label_chunk_info[j].c = c2;
|
||||||
if (c2->subtype == FS_SWAP)
|
++j;
|
||||||
label_chunk_info[j].type = PART_SWAP;
|
}
|
||||||
else
|
}
|
||||||
label_chunk_info[j].type = PART_FILESYSTEM;
|
}
|
||||||
label_chunk_info[j].c = c2;
|
else if (c1->type == fat) {
|
||||||
++j;
|
label_chunk_info[j].type = PART_FAT;
|
||||||
}
|
label_chunk_info[j].c = c1;
|
||||||
}
|
++j;
|
||||||
}
|
}
|
||||||
else if (c1->type == fat) {
|
|
||||||
label_chunk_info[j].type = PART_FAT;
|
|
||||||
label_chunk_info[j].c = c1;
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
#ifdef __ia64__
|
#ifdef __ia64__
|
||||||
else if (c1->type == efi) {
|
else if (c1->type == efi) {
|
||||||
label_chunk_info[j].type = PART_EFI;
|
label_chunk_info[j].type = PART_EFI;
|
||||||
label_chunk_info[j].c = c1;
|
label_chunk_info[j].c = c1;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
else if (c1->type == part) {
|
else if (c1->type == part) {
|
||||||
if (c1->subtype == FS_SWAP)
|
if (c1->subtype == FS_SWAP)
|
||||||
label_chunk_info[j].type = PART_SWAP;
|
label_chunk_info[j].type = PART_SWAP;
|
||||||
else
|
else
|
||||||
label_chunk_info[j].type = PART_FILESYSTEM;
|
label_chunk_info[j].type = PART_FILESYSTEM;
|
||||||
label_chunk_info[j].c = c1;
|
label_chunk_info[j].c = c1;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef __powerpc__
|
#ifdef __powerpc__
|
||||||
else if (c1->type == apple) {
|
else if (c1->type == apple) {
|
||||||
for (c2 = c1->part; c2; c2 = c2->next) {
|
for (c2 = c1->part; c2; c2 = c2->next) {
|
||||||
if (c2->type == part) {
|
if (c2->type == part) {
|
||||||
if (c2->subtype == FS_SWAP)
|
if (c2->subtype == FS_SWAP)
|
||||||
label_chunk_info[j].type = PART_SWAP;
|
label_chunk_info[j].type = PART_SWAP;
|
||||||
else
|
else
|
||||||
label_chunk_info[j].type = PART_FILESYSTEM;
|
label_chunk_info[j].type = PART_FILESYSTEM;
|
||||||
label_chunk_info[j].c = c2;
|
label_chunk_info[j].c = c2;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
label_chunk_info[j].c = NULL;
|
label_chunk_info[j].c = NULL;
|
||||||
if (here >= j) {
|
if (here >= j) {
|
||||||
@ -845,22 +807,15 @@ diskLabel(Device *dev)
|
|||||||
char *msg = NULL;
|
char *msg = NULL;
|
||||||
PartInfo *p, *oldp;
|
PartInfo *p, *oldp;
|
||||||
PartType type;
|
PartType type;
|
||||||
Device **devs;
|
|
||||||
WINDOW *w = savescr();
|
WINDOW *w = savescr();
|
||||||
|
|
||||||
label_focus = 0;
|
label_focus = 0;
|
||||||
pslice_focus = 0;
|
pslice_focus = 0;
|
||||||
here = 0;
|
here = 0;
|
||||||
|
|
||||||
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
|
|
||||||
if (!devs) {
|
|
||||||
msgConfirm("No disks found!");
|
|
||||||
restorescr(w);
|
|
||||||
return DITEM_FAILURE;
|
|
||||||
}
|
|
||||||
labeling = TRUE;
|
labeling = TRUE;
|
||||||
keypad(stdscr, TRUE);
|
keypad(stdscr, TRUE);
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
while (labeling) {
|
while (labeling) {
|
||||||
@ -883,7 +838,6 @@ diskLabel(Device *dev)
|
|||||||
refresh();
|
refresh();
|
||||||
key = getch();
|
key = getch();
|
||||||
switch (toupper(key)) {
|
switch (toupper(key)) {
|
||||||
int i;
|
|
||||||
static char _msg[40];
|
static char _msg[40];
|
||||||
|
|
||||||
case '\014': /* ^L */
|
case '\014': /* ^L */
|
||||||
@ -972,7 +926,7 @@ diskLabel(Device *dev)
|
|||||||
|
|
||||||
for (perc = 100; perc > 0; perc -= 5) {
|
for (perc = 100; perc > 0; perc -= 5) {
|
||||||
req = 0; /* reset for each loop */
|
req = 0; /* reset for each loop */
|
||||||
if ((msg = try_auto_label(devs, dev, perc, &req)) == NULL)
|
if ((msg = try_auto_label(dev, perc, &req)) == NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (msg) {
|
if (msg) {
|
||||||
@ -1114,7 +1068,7 @@ diskLabel(Device *dev)
|
|||||||
tmp->private_free = safe_free;
|
tmp->private_free = safe_free;
|
||||||
if (variable_cmp(DISK_LABELLED, "written"))
|
if (variable_cmp(DISK_LABELLED, "written"))
|
||||||
variable_set2(DISK_LABELLED, "yes", 0);
|
variable_set2(DISK_LABELLED, "yes", 0);
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
clear_wins();
|
clear_wins();
|
||||||
/* This is where we assign focus to new label so it shows. */
|
/* This is where we assign focus to new label so it shows. */
|
||||||
{
|
{
|
||||||
@ -1151,7 +1105,7 @@ diskLabel(Device *dev)
|
|||||||
Delete_Chunk2(label_chunk_info[here].c->disk, label_chunk_info[here].c, rflags);
|
Delete_Chunk2(label_chunk_info[here].c->disk, label_chunk_info[here].c, rflags);
|
||||||
if (variable_cmp(DISK_LABELLED, "written"))
|
if (variable_cmp(DISK_LABELLED, "written"))
|
||||||
variable_set2(DISK_LABELLED, "yes", 0);
|
variable_set2(DISK_LABELLED, "yes", 0);
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M': /* mount */
|
case 'M': /* mount */
|
||||||
@ -1183,7 +1137,7 @@ diskLabel(Device *dev)
|
|||||||
}
|
}
|
||||||
if (variable_cmp(DISK_LABELLED, "written"))
|
if (variable_cmp(DISK_LABELLED, "written"))
|
||||||
variable_set2(DISK_LABELLED, "yes", 0);
|
variable_set2(DISK_LABELLED, "yes", 0);
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
clear_wins();
|
clear_wins();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1252,22 +1206,18 @@ diskLabel(Device *dev)
|
|||||||
"it's too late to undo!");
|
"it's too late to undo!");
|
||||||
}
|
}
|
||||||
else if (!msgNoYes("Are you SURE you want to Undo everything?")) {
|
else if (!msgNoYes("Are you SURE you want to Undo everything?")) {
|
||||||
|
Disk *d;
|
||||||
|
|
||||||
variable_unset(DISK_PARTITIONED);
|
variable_unset(DISK_PARTITIONED);
|
||||||
variable_unset(DISK_LABELLED);
|
variable_unset(DISK_LABELLED);
|
||||||
for (i = 0; devs[i]; i++) {
|
if ((d = Open_Disk(dev->name)) != NULL) {
|
||||||
Disk *d;
|
Free_Disk(dev->private);
|
||||||
|
dev->private = d;
|
||||||
if (!devs[i]->enabled)
|
|
||||||
continue;
|
|
||||||
else if ((d = Open_Disk(devs[i]->name)) != NULL) {
|
|
||||||
Free_Disk(devs[i]->private);
|
|
||||||
devs[i]->private = d;
|
|
||||||
#ifdef WITH_SLICES
|
#ifdef WITH_SLICES
|
||||||
diskPartition(devs[i]);
|
diskPartition(dev);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
}
|
}
|
||||||
clear_wins();
|
clear_wins();
|
||||||
break;
|
break;
|
||||||
@ -1282,7 +1232,7 @@ diskLabel(Device *dev)
|
|||||||
"installation.\n\n"
|
"installation.\n\n"
|
||||||
"Are you absolutely sure you want to continue?")) {
|
"Are you absolutely sure you want to continue?")) {
|
||||||
variable_set2(DISK_LABELLED, "yes", 0);
|
variable_set2(DISK_LABELLED, "yes", 0);
|
||||||
diskLabelCommit(NULL);
|
diskLabelCommit(dev);
|
||||||
}
|
}
|
||||||
clear_wins();
|
clear_wins();
|
||||||
break;
|
break;
|
||||||
@ -1301,25 +1251,16 @@ diskLabel(Device *dev)
|
|||||||
if (!msgNoYes("Are you sure you want to go into Wizard mode?\n\n"
|
if (!msgNoYes("Are you sure you want to go into Wizard mode?\n\n"
|
||||||
"This is an entirely undocumented feature which you are not\n"
|
"This is an entirely undocumented feature which you are not\n"
|
||||||
"expected to understand!")) {
|
"expected to understand!")) {
|
||||||
int i;
|
|
||||||
Device **devs;
|
|
||||||
|
|
||||||
dialog_clear();
|
dialog_clear();
|
||||||
end_dialog();
|
end_dialog();
|
||||||
DialogActive = FALSE;
|
DialogActive = FALSE;
|
||||||
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
|
if (dev->private) {
|
||||||
if (!devs) {
|
slice_wizard(((Disk *)dev->private));
|
||||||
msgConfirm("Can't find any disk devices!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for (i = 0; devs[i] && ((Disk *)devs[i]->private); i++) {
|
|
||||||
if (devs[i]->enabled)
|
|
||||||
slice_wizard(((Disk *)devs[i]->private));
|
|
||||||
}
|
}
|
||||||
if (variable_cmp(DISK_LABELLED, "written"))
|
if (variable_cmp(DISK_LABELLED, "written"))
|
||||||
variable_set2(DISK_LABELLED, "yes", 0);
|
variable_set2(DISK_LABELLED, "yes", 0);
|
||||||
DialogActive = TRUE;
|
DialogActive = TRUE;
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
clear_wins();
|
clear_wins();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1378,7 +1319,7 @@ requested_part_size(char *varName, daddr_t nom, int def, int perc)
|
|||||||
* and /home. /home receives any extra left over disk space.
|
* and /home. /home receives any extra left over disk space.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
try_auto_label(Device *dev, int perc, int *req)
|
||||||
{
|
{
|
||||||
daddr_t sz;
|
daddr_t sz;
|
||||||
Chunk *AutoHome, *AutoRoot, *AutoSwap;
|
Chunk *AutoHome, *AutoRoot, *AutoSwap;
|
||||||
@ -1413,7 +1354,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
|||||||
AutoEfi->private_data = new_part(PART_EFI, "/efi", TRUE);
|
AutoEfi->private_data = new_part(PART_EFI, "/efi", TRUE);
|
||||||
AutoEfi->private_free = safe_free;
|
AutoEfi->private_free = safe_free;
|
||||||
AutoEfi->flags |= CHUNK_NEWFS;
|
AutoEfi->flags |= CHUNK_NEWFS;
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1431,7 +1372,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
|||||||
AutoRoot->private_data = new_part(PART_FILESYSTEM, "/", TRUE);
|
AutoRoot->private_data = new_part(PART_FILESYSTEM, "/", TRUE);
|
||||||
AutoRoot->private_free = safe_free;
|
AutoRoot->private_free = safe_free;
|
||||||
AutoRoot->flags |= CHUNK_NEWFS;
|
AutoRoot->flags |= CHUNK_NEWFS;
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
}
|
}
|
||||||
if (SwapChunk == NULL) {
|
if (SwapChunk == NULL) {
|
||||||
sz = requested_part_size(VAR_SWAP_SIZE, 0, 0, perc);
|
sz = requested_part_size(VAR_SWAP_SIZE, 0, 0, perc);
|
||||||
@ -1461,7 +1402,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
|||||||
}
|
}
|
||||||
AutoSwap->private_data = 0;
|
AutoSwap->private_data = 0;
|
||||||
AutoSwap->private_free = safe_free;
|
AutoSwap->private_free = safe_free;
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
}
|
}
|
||||||
if (VarChunk == NULL) {
|
if (VarChunk == NULL) {
|
||||||
/* Work out how much extra space we want for a crash dump */
|
/* Work out how much extra space we want for a crash dump */
|
||||||
@ -1492,7 +1433,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
|||||||
AutoVar->private_data = new_part(PART_FILESYSTEM, "/var", TRUE);
|
AutoVar->private_data = new_part(PART_FILESYSTEM, "/var", TRUE);
|
||||||
AutoVar->private_free = safe_free;
|
AutoVar->private_free = safe_free;
|
||||||
AutoVar->flags |= CHUNK_NEWFS;
|
AutoVar->flags |= CHUNK_NEWFS;
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
}
|
}
|
||||||
if (TmpChunk == NULL && !variable_get(VAR_NO_TMP)) {
|
if (TmpChunk == NULL && !variable_get(VAR_NO_TMP)) {
|
||||||
sz = requested_part_size(VAR_TMP_SIZE, TMP_NOMINAL_SIZE, TMP_DEFAULT_SIZE, perc);
|
sz = requested_part_size(VAR_TMP_SIZE, TMP_NOMINAL_SIZE, TMP_DEFAULT_SIZE, perc);
|
||||||
@ -1509,7 +1450,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
|||||||
AutoTmp->private_data = new_part(PART_FILESYSTEM, "/tmp", TRUE);
|
AutoTmp->private_data = new_part(PART_FILESYSTEM, "/tmp", TRUE);
|
||||||
AutoTmp->private_free = safe_free;
|
AutoTmp->private_free = safe_free;
|
||||||
AutoTmp->flags |= CHUNK_NEWFS;
|
AutoTmp->flags |= CHUNK_NEWFS;
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
}
|
}
|
||||||
if (UsrChunk == NULL && !variable_get(VAR_NO_USR)) {
|
if (UsrChunk == NULL && !variable_get(VAR_NO_USR)) {
|
||||||
sz = requested_part_size(VAR_USR_SIZE, USR_NOMINAL_SIZE, USR_DEFAULT_SIZE, perc);
|
sz = requested_part_size(VAR_USR_SIZE, USR_NOMINAL_SIZE, USR_DEFAULT_SIZE, perc);
|
||||||
@ -1535,7 +1476,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
|||||||
AutoUsr->private_data = new_part(PART_FILESYSTEM, "/usr", TRUE);
|
AutoUsr->private_data = new_part(PART_FILESYSTEM, "/usr", TRUE);
|
||||||
AutoUsr->private_free = safe_free;
|
AutoUsr->private_free = safe_free;
|
||||||
AutoUsr->flags |= CHUNK_NEWFS;
|
AutoUsr->flags |= CHUNK_NEWFS;
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if AUTO_HOME == 1
|
#if AUTO_HOME == 1
|
||||||
@ -1562,7 +1503,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
|||||||
AutoHome->private_data = new_part(PART_FILESYSTEM, "/home", TRUE);
|
AutoHome->private_data = new_part(PART_FILESYSTEM, "/home", TRUE);
|
||||||
AutoHome->private_free = safe_free;
|
AutoHome->private_free = safe_free;
|
||||||
AutoHome->flags |= CHUNK_NEWFS;
|
AutoHome->flags |= CHUNK_NEWFS;
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1585,7 +1526,7 @@ done:
|
|||||||
Delete_Chunk(AutoUsr->disk, AutoUsr);
|
Delete_Chunk(AutoUsr->disk, AutoUsr);
|
||||||
if (AutoHome != NULL)
|
if (AutoHome != NULL)
|
||||||
Delete_Chunk(AutoHome->disk, AutoHome);
|
Delete_Chunk(AutoHome->disk, AutoHome);
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
}
|
}
|
||||||
return(msg);
|
return(msg);
|
||||||
}
|
}
|
||||||
@ -1616,7 +1557,7 @@ diskLabelNonInteractive(Device *dev)
|
|||||||
d = dev->private;
|
d = dev->private;
|
||||||
else
|
else
|
||||||
d = devs[0]->private;
|
d = devs[0]->private;
|
||||||
record_label_chunks(devs, dev);
|
record_label_chunks(dev);
|
||||||
for (i = 0; label_chunk_info[i].c; i++) {
|
for (i = 0; label_chunk_info[i].c; i++) {
|
||||||
Chunk *c1 = label_chunk_info[i].c;
|
Chunk *c1 = label_chunk_info[i].c;
|
||||||
|
|
||||||
|
@ -42,14 +42,14 @@ static const char rcsid[] =
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
DMenu MenuDiskDevices = {
|
DMenu MenuDiskDevices = {
|
||||||
DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
|
DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
|
||||||
"Select Drive(s)",
|
"Select Drive(s)",
|
||||||
"Please select the drive, or drives, on which you wish to perform\n"
|
"Please select the drive on which you wish to perform this\n"
|
||||||
"this operation. If you are attempting to install a boot partition\n"
|
"operation. If you are attempting to install a boot partition\n"
|
||||||
"on a drive other than the first one or have multiple operating\n"
|
"on a drive other than the first one or have multiple operating\n"
|
||||||
"systems on your machine, you will have the option to install a boot\n"
|
"systems on your machine, you will have the option to install a boot\n"
|
||||||
"manager later. To select a drive, use the arrow keys to move to it\n"
|
"manager later. To select a drive, use the arrow keys to move to it\n"
|
||||||
"and press [SPACE] or [ENTER]. To de-select it, press it again.\n\n"
|
"and press [SPACE] or [ENTER].\n\n"
|
||||||
"Use [TAB] to get to the buttons and leave this menu.",
|
"Use [TAB] to get to the buttons and leave this menu.",
|
||||||
"Press F1 for important information regarding disk geometry!",
|
"Press F1 for important information regarding disk geometry!",
|
||||||
"drives",
|
"drives",
|
||||||
|
@ -184,7 +184,6 @@ typedef struct _device {
|
|||||||
char *description;
|
char *description;
|
||||||
char *devname;
|
char *devname;
|
||||||
DeviceType type;
|
DeviceType type;
|
||||||
Boolean enabled;
|
|
||||||
Boolean (*init)(struct _device *dev);
|
Boolean (*init)(struct _device *dev);
|
||||||
FILE * (*get)(struct _device *dev, char *file, Boolean probe);
|
FILE * (*get)(struct _device *dev, char *file, Boolean probe);
|
||||||
void (*shutdown)(struct _device *dev);
|
void (*shutdown)(struct _device *dev);
|
||||||
@ -302,8 +301,7 @@ extern void command_shell_add(char *key, const char *fmt, ...) __printflike(2, 3
|
|||||||
extern void command_func_add(char *key, commandFunc func, void *data);
|
extern void command_func_add(char *key, commandFunc func, void *data);
|
||||||
|
|
||||||
/* devices.c */
|
/* devices.c */
|
||||||
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d),
|
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d));
|
||||||
int (*check)(dialogMenuItem *d));
|
|
||||||
extern void deviceGetAll(void);
|
extern void deviceGetAll(void);
|
||||||
extern void deviceReset(void);
|
extern void deviceReset(void);
|
||||||
extern void deviceRescan(void);
|
extern void deviceRescan(void);
|
||||||
@ -311,7 +309,7 @@ extern Device **deviceFind(char *name, DeviceType type);
|
|||||||
extern Device **deviceFindDescr(char *name, char *desc, DeviceType class);
|
extern Device **deviceFindDescr(char *name, char *desc, DeviceType class);
|
||||||
extern int deviceCount(Device **devs);
|
extern int deviceCount(Device **devs);
|
||||||
extern Device *new_device(char *name);
|
extern Device *new_device(char *name);
|
||||||
extern Device *deviceRegister(char *name, char *desc, char *devicename, DeviceType type, Boolean enabled,
|
extern Device *deviceRegister(char *name, char *desc, char *devicename, DeviceType type,
|
||||||
Boolean (*init)(Device *mediadev),
|
Boolean (*init)(Device *mediadev),
|
||||||
FILE * (*get)(Device *dev, char *file, Boolean probe),
|
FILE * (*get)(Device *dev, char *file, Boolean probe),
|
||||||
void (*shutDown)(Device *mediadev),
|
void (*shutDown)(Device *mediadev),
|
||||||
@ -325,8 +323,7 @@ extern void dummyShutdown(Device *dev);
|
|||||||
extern void diskPartition(Device *dev);
|
extern void diskPartition(Device *dev);
|
||||||
extern int diskPartitionEditor(dialogMenuItem *self);
|
extern int diskPartitionEditor(dialogMenuItem *self);
|
||||||
#endif
|
#endif
|
||||||
extern int diskPartitionWrite(dialogMenuItem *self);
|
extern int diskPartitionWrite(Device *dev);
|
||||||
extern int diskGetSelectCount(Device ***devs);
|
|
||||||
|
|
||||||
/* dispatch.c */
|
/* dispatch.c */
|
||||||
extern int dispatchCommand(char *command);
|
extern int dispatchCommand(char *command);
|
||||||
@ -366,7 +363,7 @@ extern void globalsInit(void);
|
|||||||
extern Boolean checkLabels(Boolean whinge);
|
extern Boolean checkLabels(Boolean whinge);
|
||||||
extern int installCommit(dialogMenuItem *self);
|
extern int installCommit(dialogMenuItem *self);
|
||||||
extern int installCustomCommit(dialogMenuItem *self);
|
extern int installCustomCommit(dialogMenuItem *self);
|
||||||
extern int installFilesystems(dialogMenuItem *self);
|
extern int installFilesystems(Device *dev);
|
||||||
extern int installVarDefaults(dialogMenuItem *self);
|
extern int installVarDefaults(dialogMenuItem *self);
|
||||||
extern void installEnvironment(void);
|
extern void installEnvironment(void);
|
||||||
extern Boolean copySelf(void);
|
extern Boolean copySelf(void);
|
||||||
@ -376,7 +373,7 @@ extern int kget(char *out);
|
|||||||
|
|
||||||
/* label.c */
|
/* label.c */
|
||||||
extern int diskLabelEditor(dialogMenuItem *self);
|
extern int diskLabelEditor(dialogMenuItem *self);
|
||||||
extern int diskLabelCommit(dialogMenuItem *self);
|
extern int diskLabelCommit(Device *dev);
|
||||||
|
|
||||||
/* misc.c */
|
/* misc.c */
|
||||||
extern Boolean file_readable(char *fname);
|
extern Boolean file_readable(char *fname);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user