summaryrefslogtreecommitdiffstats
path: root/release
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-10-12 16:21:21 +0000
committerjkh <jkh@FreeBSD.org>1997-10-12 16:21:21 +0000
commitefc02b645339a7893a4d03dbc6e3964b407073ba (patch)
tree57ce6590609851e2fefa29ae94f96be90a801eb4 /release
parentf8166c26056e021527a33646876a912064a9c76b (diff)
downloadFreeBSD-src-efc02b645339a7893a4d03dbc6e3964b407073ba.zip
FreeBSD-src-efc02b645339a7893a4d03dbc6e3964b407073ba.tar.gz
Separate the siamese twins that were the partition and label editor.
Now you can use one without entering the other and it will DTRT. These changes just allowed me to do the most straight-forward new disk installation I've ever managed with sysinstall.
Diffstat (limited to 'release')
-rw-r--r--release/sysinstall/disks.c106
-rw-r--r--release/sysinstall/install.c28
-rw-r--r--release/sysinstall/installUpgrade.c29
-rw-r--r--release/sysinstall/label.c139
-rw-r--r--release/sysinstall/sysinstall.h6
-rw-r--r--release/sysinstall/variable.c12
6 files changed, 212 insertions, 108 deletions
diff --git a/release/sysinstall/disks.c b/release/sysinstall/disks.c
index 9130924..e05a78f 100644
--- a/release/sysinstall/disks.c
+++ b/release/sysinstall/disks.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: disks.c,v 1.90 1997/09/07 14:05:21 joerg Exp $
+ * $Id: disks.c,v 1.91 1997/09/11 17:12:08 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -45,7 +45,7 @@
static struct chunk *chunk_info[16];
static int current_chunk;
-static void diskPartitionNonInteractive(Device *dev, Disk *d);
+static void diskPartitionNonInteractive(Device *dev);
static void
record_chunks(Disk *d)
@@ -171,8 +171,27 @@ getBootMgr(char *dname)
return NULL;
}
+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;
+}
+
void
-diskPartition(Device *dev, Disk *d)
+diskPartition(Device *dev)
{
char *cp, *p;
int rv, key = 0;
@@ -180,6 +199,7 @@ diskPartition(Device *dev, Disk *d)
char *msg = NULL;
u_char *mbrContents;
WINDOW *w = savescr();
+ Disk *d = (Disk *)dev->private;
chunking = TRUE;
keypad(stdscr, TRUE);
@@ -416,7 +436,8 @@ diskPartition(Device *dev, Disk *d)
"installation. If you are installing FreeBSD for the first time\n"
"then you should simply type Q when you're finished here and your\n"
"changes will be committed in one batch automatically at the end of\n"
- "these questions.\n\n"
+ "these questions. If you're adding a disk, you should NOT write\n"
+ "from this screen, you should do it from the label editor.\n\n"
"Are you absolutely sure you want to do this now?")) {
variable_set2(DISK_PARTITIONED, "yes");
@@ -494,11 +515,11 @@ partitionHook(dialogMenuItem *selected)
/* Toggle enabled status? */
if (!devs[0]->enabled) {
devs[0]->enabled = TRUE;
- diskPartition(devs[0], (Disk *)devs[0]->private);
+ diskPartition(devs[0]);
}
else
devs[0]->enabled = FALSE;
- return DITEM_SUCCESS | DITEM_REDRAW;
+ return DITEM_SUCCESS | DITEM_RESTORE;
}
static int
@@ -518,58 +539,62 @@ diskPartitionEditor(dialogMenuItem *self)
DMenu *menu;
Device **devs;
int i, cnt;
- char *cp;
- cp = variable_get(VAR_DISK);
- devs = deviceFind(cp, DEVICE_TYPE_DISK);
- cnt = deviceCount(devs);
- if (!cnt) {
+ cnt = diskGetSelectCount(&devs);
+ if (cnt == -1) {
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"
"Documentation menu for clues on diagnosing this type of problem.");
- i = DITEM_FAILURE;
+ return DITEM_FAILURE;
}
- else if (cnt == 1) {
- devs[0]->enabled = TRUE;
- if (variable_get(VAR_NONINTERACTIVE))
- diskPartitionNonInteractive(devs[0], (Disk *)devs[0]->private);
- else
- diskPartition(devs[0], (Disk *)devs[0]->private);
- i = DITEM_SUCCESS;
+ else if (cnt) {
+ /* Some are already selected */
+ for (i = 0; i < cnt; i++) {
+ if (devs[i]->enabled) {
+ if (variable_get(VAR_NONINTERACTIVE))
+ diskPartitionNonInteractive(devs[i]);
+ else
+ diskPartition(devs[i]);
+ }
+ }
}
else {
- menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook, partitionCheck);
- if (!menu) {
- msgConfirm("No devices suitable for installation found!\n\n"
- "Please verify that your disk controller (and attached drives)\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"
- "the boot messages. Press [Scroll Lock] again to return.");
- i = DITEM_FAILURE;
+ /* No disks are selected, fall-back case now */
+ cnt = deviceCount(devs);
+ if (cnt == 1) {
+ devs[0]->enabled = TRUE;
+ if (variable_get(VAR_NONINTERACTIVE))
+ diskPartitionNonInteractive(devs[0]);
+ else
+ diskPartition(devs[0]);
+ return DITEM_SUCCESS;
}
else {
- i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
- free(menu);
+ menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook, partitionCheck);
+ if (!menu) {
+ msgConfirm("No devices suitable for installation found!\n\n"
+ "Please verify that your disk controller (and attached drives)\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"
+ "the boot messages. Press [Scroll Lock] again to return.");
+ return DITEM_FAILURE;
+ }
+ else {
+ i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
+ free(menu);
+ }
+ return i | DITEM_RESTORE;
}
- i = i | DITEM_RESTORE;
}
- return i;
+ return DITEM_FAILURE;
}
int
diskPartitionWrite(dialogMenuItem *self)
{
Device **devs;
- char *cp;
int i;
- if ((cp = variable_get(DISK_PARTITIONED)) && strcmp(cp, "yes"))
- return DITEM_SUCCESS;
- else if (!cp) {
- msgConfirm("You must partition the disk(s) before this option can be used.");
- return DITEM_FAILURE;
- }
-
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
msgConfirm("Unable to find any disks to write to??");
@@ -615,11 +640,12 @@ diskPartitionWrite(dialogMenuItem *self)
/* Partition a disk based wholly on which variables are set */
static void
-diskPartitionNonInteractive(Device *dev, Disk *d)
+diskPartitionNonInteractive(Device *dev)
{
char *cp;
int i, sz, all_disk = 0;
u_char *mbrContents;
+ Disk *d = (Disk *)dev->private;
record_chunks(d);
cp = variable_get(VAR_GEOMETRY);
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index aca9884..4cdf685 100644
--- a/release/sysinstall/install.c
+++ b/release/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.199 1997/10/06 08:34:56 jkh Exp $
+ * $Id: install.c,v 1.200 1997/10/06 08:36:12 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -183,7 +183,7 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
"intend to mount your /usr filesystem over NFS), but it may otherwise\n"
"cause you trouble if you're not exactly sure what you are doing!");
}
- if (!vardev && whinge) {
+ if (!vardev && whinge && variable_cmp(SYSTEM_STATE, "upgrade")) {
msgConfirm("WARNING: No /var filesystem found. This is not technically\n"
"an error if your root filesystem is big enough (or you later\n"
"intend to link /var to someplace else), but it may otherwise\n"
@@ -460,7 +460,8 @@ installExpress(dialogMenuItem *self)
int
installNovice(dialogMenuItem *self)
{
- int i;
+ int i, tries = 0;
+ Device **devs;
variable_set2(SYSTEM_STATE, "novice");
dialog_clear_norefresh();
@@ -471,9 +472,17 @@ installNovice(dialogMenuItem *self)
"by a (Q)uit. If you wish to allocate only free space to FreeBSD, move to a\n"
"partition marked \"unused\" and use the (C)reate command.");
+nodisks:
if (DITEM_STATUS(diskPartitionEditor(self)) == DITEM_FAILURE)
return DITEM_FAILURE;
-
+
+ if (diskGetSelectCount(&devs) <= 0 && tries < 3) {
+ msgConfirm("You need to select some disks to operate on! Be sure to use SPACE\n"
+ "instead of RETURN in the disk selection menu when selecting a disk.");
+ ++tries;
+ goto nodisks;
+ }
+
dialog_clear_norefresh();
msgConfirm("Next, you need to create BSD partitions inside of the fdisk partition(s)\n"
"just created. If you have a reasonable amount of disk space (200MB or more)\n"
@@ -733,7 +742,7 @@ installFixup(dialogMenuItem *self)
if (file_readable("/kernel.GENERIC")) {
#ifdef SAVE_USERCONFIG
/* Snapshot any boot -c changes back to the GENERIC kernel */
- if (!strcmp(variable_get(VAR_RELNAME), RELEASE_NAME))
+ if (!variable_cmp(VAR_RELNAME, RELEASE_NAME))
save_userconfig_to_kernel("/kernel.GENERIC");
#endif
if (vsystem("cp -p /kernel.GENERIC /kernel")) {
@@ -826,16 +835,15 @@ installFilesystems(dialogMenuItem *self)
Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev;
Device **devs;
PartInfo *root;
- char dname[80], *str;
+ char dname[80];
extern int MakeDevChunk(Chunk *c, char *n);
Boolean upgrade = FALSE;
/* If we've already done this, bail out */
- if ((str = variable_get(DISK_LABELLED)) && !strcmp(str, "written"))
+ if (!variable_cmp(DISK_LABELLED, "written"))
return DITEM_SUCCESS;
- str = variable_get(SYSTEM_STATE);
-
+ upgrade = !variable_cmp(SYSTEM_STATE, "upgrade");
if (!checkLabels(TRUE, &rootdev, &swapdev, &usrdev, &vardev))
return DITEM_FAILURE;
@@ -845,8 +853,6 @@ installFilesystems(dialogMenuItem *self)
root = NULL;
command_clear();
- upgrade = str && !strcmp(str, "upgrade");
-
if (swapdev && RunningAsInit) {
/* As the very first thing, try to get ourselves some swap space */
sprintf(dname, "/dev/%s", swapdev->name);
diff --git a/release/sysinstall/installUpgrade.c b/release/sysinstall/installUpgrade.c
index 6350141..fc1d89c 100644
--- a/release/sysinstall/installUpgrade.c
+++ b/release/sysinstall/installUpgrade.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: installUpgrade.c,v 1.51 1997/09/09 09:19:30 jkh Exp $
+ * $Id: installUpgrade.c,v 1.52 1997/10/01 01:30:35 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -152,7 +152,7 @@ traverseHitlist(HitList *h)
int
installUpgrade(dialogMenuItem *self)
{
- char *saved_etc;
+ char saved_etc[FILENAME_MAX];
Boolean extractingBin = TRUE;
if (variable_get(VAR_NONINTERACTIVE))
@@ -167,11 +167,8 @@ installUpgrade(dialogMenuItem *self)
return DITEM_FAILURE | DITEM_RESTORE;
if (!Dists) {
- msgConfirm("You haven't specified any distributions yet. The upgrade procedure will\n"
- "only upgrade those portions of the system for which a distribution has\n"
- "been selected. In the next screen, we'll go to the Distributions menu\n"
- "to select those portions of the new system you wish to install on top of\n"
- "the old.");
+ msgConfirm("First, you must select some distribution components. The upgrade procedure\n"
+ "will only upgrade the distributions you select in the next set of menus.");
if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists)
return DITEM_FAILURE | DITEM_RESTORE;
dialog_clear_norefresh();
@@ -180,7 +177,7 @@ installUpgrade(dialogMenuItem *self)
if (msgYesNo("You didn't select the bin distribution as one of the distributons to load.\n"
"This one is pretty vital to a successful upgrade. Are you SURE you don't\n"
"want to select the bin distribution? Chose No to bring up the Distributions\n"
- "menu.") != 0) {
+ "menu again.") != 0) {
if (!dmenuOpenSimple(&MenuDistributions, FALSE))
return DITEM_FAILURE | DITEM_RESTORE;
dialog_clear_norefresh();
@@ -252,20 +249,23 @@ installUpgrade(dialogMenuItem *self)
systemCreateHoloshell();
}
- saved_etc = NULL;
+ saved_etc[0] = '\0';
if (extractingBin) {
- while (!saved_etc) {
- saved_etc = msgGetInput("/usr/tmp/etc", "Under which directory do you wish to save your current /etc?");
- if (!saved_etc || !*saved_etc || Mkdir(saved_etc)) {
- saved_etc = NULL;
+ while (!*saved_etc) {
+ char *cp = msgGetInput("/usr/tmp/etc", "Under which directory do you wish to save your current /etc?");
+
+ if (!cp || !*cp || Mkdir(cp)) {
if (msgYesNo("Directory was not specified, was invalid or user selected Cancel.\n\n"
"Doing an upgrade without first backing up your /etc directory is a very\n"
"bad idea! Do you want to go back and specify the save directory again?") != 0)
break;
}
+ else {
+ SAFE_STRCPY(saved_etc, cp);
+ }
}
- if (saved_etc) {
+ if (saved_etc[0]) {
msgNotify("Preserving /etc directory..");
if (vsystem("tar -cBpf - -C /etc . | tar --unlink -xBpf - -C %s", saved_etc))
if (msgYesNo("Unable to backup your /etc into %s.\n"
@@ -287,6 +287,7 @@ installUpgrade(dialogMenuItem *self)
}
media:
+ /* We do this very late, but we unfortunately need to back up /etc first */
if (!mediaVerify())
return DITEM_FAILURE | DITEM_RESTORE;
diff --git a/release/sysinstall/label.c b/release/sysinstall/label.c
index e0e774d..4e7abce 100644
--- a/release/sysinstall/label.c
+++ b/release/sysinstall/label.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: label.c,v 1.75 1997/09/20 02:48:46 jkh Exp $
+ * $Id: label.c,v 1.76 1997/09/20 06:24:17 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -80,38 +80,95 @@ static int here;
/*** with this value we try to track the most recently added label ***/
static int label_focus = 0, pslice_focus = 0;
-static int diskLabel(char *str);
-static int diskLabelNonInteractive(char *str);
+static int diskLabel(Device *dev);
+static int diskLabelNonInteractive(Device *dev);
+
+static int
+labelHook(dialogMenuItem *selected)
+{
+ Device **devs = NULL;
+
+ devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("Unable to find disk %s!", selected->prompt);
+ return DITEM_FAILURE;
+ }
+ /* Toggle enabled status? */
+ if (!devs[0]->enabled) {
+ devs[0]->enabled = TRUE;
+ diskLabel(devs[0]);
+ }
+ else
+ devs[0]->enabled = FALSE;
+ return DITEM_SUCCESS | DITEM_RESTORE;
+}
+
+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
diskLabelEditor(dialogMenuItem *self)
{
+ DMenu *menu;
Device **devs;
- int i, cnt, enabled;
- char *cp;
+ int i, cnt;
- cp = variable_get(VAR_DISK);
- devs = deviceFind(cp, DEVICE_TYPE_DISK);
- cnt = deviceCount(devs);
- if (!cnt) {
+ i = 0;
+ cnt = diskGetSelectCount(&devs);
+ if (cnt == -1) {
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"
"Documentation menu for clues on diagnosing this type of problem.");
return DITEM_FAILURE;
}
- for (i = 0, enabled = 0; i < cnt; i++) {
- if (devs[i]->enabled)
- ++enabled;
+ else if (cnt) {
+ int j;
+
+ /* Some are already selected */
+ for (j = 0; j < cnt; j++) {
+ if (devs[j]->enabled) {
+ if (variable_get(VAR_NONINTERACTIVE))
+ i |= diskLabelNonInteractive(devs[j]);
+ else
+ i |= diskLabel(devs[j]);
+ }
+ }
}
- if (!enabled) {
- msgConfirm("No disks have been selected. Please visit the Partition\n"
- "editor first to specify which disks you wish to operate on.");
- return DITEM_FAILURE;
+ else {
+ /* No disks are selected, fall-back case now */
+ cnt = deviceCount(devs);
+ if (cnt == 1) {
+ devs[0]->enabled = TRUE;
+ if (variable_get(VAR_NONINTERACTIVE))
+ i = diskLabelNonInteractive(devs[0]);
+ else
+ i = diskLabel(devs[0]);
+ }
+ else {
+ menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, labelHook, labelCheck);
+ if (!menu) {
+ msgConfirm("No devices suitable for installation found!\n\n"
+ "Please verify that your disk controller (and attached drives)\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"
+ "the boot messages. Press [Scroll Lock] again to return.");
+ i = DITEM_FAILURE;
+ }
+ else {
+ i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
+ free(menu);
+ }
+ i |= DITEM_RESTORE;
+ }
}
- if (variable_get(VAR_NONINTERACTIVE))
- i = diskLabelNonInteractive(devs[0]->name);
- else
- i = diskLabel(devs[0]->name);
if (DITEM_STATUS(i) != DITEM_FAILURE) {
char *cp;
@@ -179,7 +236,7 @@ space_free(struct chunk *c)
/* Snapshot the current situation into the displayed chunks structure */
static void
-record_label_chunks(Device **devs)
+record_label_chunks(Device **devs, Device *dev)
{
int i, j, p;
struct chunk *c1, *c2;
@@ -188,7 +245,7 @@ record_label_chunks(Device **devs)
j = p = 0;
/* First buzz through and pick up the FreeBSD slices */
for (i = 0; devs[i]; i++) {
- if (!devs[i]->enabled)
+ if ((dev && devs[i] != dev) || !devs[i]->enabled)
continue;
d = (Disk *)devs[i]->private;
if (!d->chunks)
@@ -594,7 +651,7 @@ clear_wins(void)
}
static int
-diskLabel(char *str)
+diskLabel(Device *dev)
{
int sz, key = 0;
Boolean labeling;
@@ -606,15 +663,15 @@ diskLabel(char *str)
label_focus = 0;
pslice_focus = 0;
here = 0;
+
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
msgConfirm("No disks found!");
return DITEM_FAILURE;
}
-
labeling = TRUE;
keypad(stdscr, TRUE);
- record_label_chunks(devs);
+ record_label_chunks(devs, dev);
clear();
while (labeling) {
@@ -707,7 +764,7 @@ diskLabel(char *str)
}
tmp->private_data = new_part("/", TRUE, tmp->size);
tmp->private_free = safe_free;
- record_label_chunks(devs);
+ record_label_chunks(devs, dev);
}
if (!swapdev) {
@@ -730,7 +787,7 @@ diskLabel(char *str)
}
tmp->private_data = 0;
tmp->private_free = safe_free;
- record_label_chunks(devs);
+ record_label_chunks(devs, dev);
}
if (!vardev) {
@@ -746,7 +803,7 @@ diskLabel(char *str)
}
tmp->private_data = new_part("/var", TRUE, tmp->size);
tmp->private_free = safe_free;
- record_label_chunks(devs);
+ record_label_chunks(devs, dev);
}
if (!usrdev) {
@@ -774,7 +831,7 @@ diskLabel(char *str)
}
tmp->private_data = new_part("/usr", TRUE, tmp->size);
tmp->private_free = safe_free;
- record_label_chunks(devs);
+ record_label_chunks(devs, dev);
}
}
/* At this point, we're reasonably "labelled" */
@@ -889,7 +946,7 @@ diskLabel(char *str)
tmp->private_free = safe_free;
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
variable_set2(DISK_LABELLED, "yes");
- record_label_chunks(devs);
+ record_label_chunks(devs, dev);
clear_wins();
/*** This is where we assign focus to new label so it shows ***/
{
@@ -920,7 +977,7 @@ diskLabel(char *str)
Delete_Chunk(label_chunk_info[here].c->disk, label_chunk_info[here].c);
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
variable_set2(DISK_LABELLED, "yes");
- record_label_chunks(devs);
+ record_label_chunks(devs, dev);
break;
case 'M': /* mount */
@@ -949,7 +1006,7 @@ diskLabel(char *str)
}
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
variable_set2(DISK_LABELLED, "yes");
- record_label_chunks(devs);
+ record_label_chunks(devs, dev);
clear_wins();
break;
@@ -999,10 +1056,10 @@ diskLabel(char *str)
else if ((d = Open_Disk(devs[i]->name)) != NULL) {
Free_Disk(devs[i]->private);
devs[i]->private = d;
- diskPartition(devs[i], d);
+ diskPartition(devs[i]);
}
}
- record_label_chunks(devs);
+ record_label_chunks(devs, dev);
}
clear_wins();
break;
@@ -1047,7 +1104,7 @@ diskLabel(char *str)
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
variable_set2(DISK_LABELLED, "yes");
DialogActive = TRUE;
- record_label_chunks(devs);
+ record_label_chunks(devs, dev);
clear_wins();
}
else
@@ -1074,7 +1131,7 @@ diskLabel(char *str)
}
static int
-diskLabelNonInteractive(char *str)
+diskLabelNonInteractive(Device *dev)
{
char *cp;
PartType type;
@@ -1085,21 +1142,23 @@ diskLabelNonInteractive(char *str)
Disk *d;
status = DITEM_SUCCESS;
+
cp = variable_get(VAR_DISK);
if (!cp) {
dialog_clear();
msgConfirm("diskLabel: No disk selected - can't label automatically.");
return DITEM_FAILURE;
}
-
devs = deviceFind(cp, DEVICE_TYPE_DISK);
if (!devs) {
msgConfirm("diskLabel: No disk device %s found!", cp);
return DITEM_FAILURE;
}
- d = devs[0]->private;
-
- record_label_chunks(devs);
+ if (dev)
+ d = dev->private;
+ else
+ d = devs[0]->private;
+ record_label_chunks(devs, dev);
for (i = 0; label_chunk_info[i].c; i++) {
Chunk *c1 = label_chunk_info[i].c;
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index fad032a..026e642 100644
--- a/release/sysinstall/sysinstall.h
+++ b/release/sysinstall/sysinstall.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.140 1997/09/16 18:57:17 jkh Exp $
+ * $Id: sysinstall.h,v 1.141 1997/09/17 16:18:21 pst Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -461,7 +461,8 @@ extern void dummyShutdown(Device *dev);
/* disks.c */
extern int diskPartitionEditor(dialogMenuItem *self);
extern int diskPartitionWrite(dialogMenuItem *self);
-extern void diskPartition(Device *dev, Disk *d);
+extern int diskGetSelectCount(Device ***devs);
+extern void diskPartition(Device *dev);
/* dispatch.c */
extern int dispatchCommand(char *command);
@@ -711,6 +712,7 @@ extern int userAddUser(dialogMenuItem *self);
extern void variable_set(char *var);
extern void variable_set2(char *name, char *value);
extern char *variable_get(char *var);
+extern int variable_cmp(char *var, char *value);
extern void variable_unset(char *var);
extern char *variable_get_value(char *var, char *prompt);
extern int variable_check(char *data);
diff --git a/release/sysinstall/variable.c b/release/sysinstall/variable.c
index 0e31ae39..a13b71d 100644
--- a/release/sysinstall/variable.c
+++ b/release/sysinstall/variable.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: variable.c,v 1.19 1997/06/11 08:41:10 jkh Exp $
+ * $Id: variable.c,v 1.20 1997/06/13 14:21:22 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -105,6 +105,16 @@ variable_get(char *var)
return getenv(var);
}
+int
+variable_cmp(char *var, char *value)
+{
+ char *val;
+
+ if ((val = variable_get(var)))
+ return strcmp(val, value);
+ return -1;
+}
+
void
variable_unset(char *var)
{
OpenPOWER on IntegriCloud