aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1996-07-31 06:20:59 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1996-07-31 06:20:59 +0000
commite5034f83b0defad53ec34ca4ee53d72e3105e002 (patch)
treecc2ecdeb856d895ae030139b6745edde8dae0e30 /usr.sbin
parent7e33c72e6a2d7545acd4ee2e350850a2e8fbdd20 (diff)
Notes
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/disks.c17
-rw-r--r--usr.sbin/sade/install.c36
-rw-r--r--usr.sbin/sade/label.c158
-rw-r--r--usr.sbin/sade/msg.c4
-rw-r--r--usr.sbin/sade/sade.h3
-rw-r--r--usr.sbin/sysinstall/disks.c17
-rw-r--r--usr.sbin/sysinstall/install.c36
-rw-r--r--usr.sbin/sysinstall/label.c158
-rw-r--r--usr.sbin/sysinstall/msg.c4
-rw-r--r--usr.sbin/sysinstall/sysinstall.h3
10 files changed, 242 insertions, 194 deletions
diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c
index 21dbe87b9ebd..df857ef122fb 100644
--- a/usr.sbin/sade/disks.c
+++ b/usr.sbin/sade/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.54 1996/07/05 08:35:52 jkh Exp $
+ * $Id: disks.c,v 1.55 1996/07/09 03:07:47 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -70,24 +70,27 @@ print_chunks(Disk *d)
int row;
int i;
- if ((!d->bios_cyl || d->bios_cyl > 65536) || (!d->bios_hd || d->bios_hd > 256) || (!d->bios_sect || d->bios_sect >= 64)) {
+ if (!d->bios_cyl && !d->bios_hd && !d->bios_sect) {
+ All_FreeBSD(d, TRUE);
+ d->bios_hd = d->bios_sect = d->bios_cyl = 1;
+ }
+ else if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
int sz;
dialog_clear();
- msgConfirm("WARNING: The current geometry for %s is incorrect. Using\n"
+ msgConfirm("WARNING: A geometry of %d/%d/%d for %s is incorrect. Using\n"
"a default geometry of 64 heads and 32 sectors. If this geometry\n"
"is incorrect or you are unsure as to whether or not it's correct,\n"
"please consult the Hardware Guide in the Documentation submenu\n"
- "or use the (G)eometry command to change it now.", d->name);
+ "or use the (G)eometry command to change it now.", d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
d->bios_hd = 64;
d->bios_sect = 32;
- sz = 0;
- for (i = 0; chunk_info[i]; i++)
+ for (i = sz = 0; chunk_info[i]; i++)
sz += chunk_info[i]->size;
if (sz)
d->bios_cyl = sz / ONE_MEG;
else
- msgConfirm("Couldn't set geometry! You'll have to do it by hand.");
+ msgConfirm("Couldn't calculate disk size! You'll have to set the geometry by hand.");
}
attrset(A_NORMAL);
mvaddstr(0, 0, "Disk name:\t");
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index e5ee68975a57..05c330261f1c 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/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.114 1996/07/13 05:13:25 jkh Exp $
+ * $Id: install.c,v 1.115 1996/07/16 17:11:41 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -55,19 +55,19 @@ static void create_termcap(void);
static void installConfigure(void);
-static Boolean
-checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev)
+Boolean
+checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev)
{
Device **devs;
Boolean status;
Disk *disk;
- Chunk *c1, *c2, *rootdev, *swapdev, *usrdev;
+ Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev;
int i;
status = TRUE;
- *rdev = *sdev = *udev = rootdev = swapdev = usrdev = NULL;
+ *rdev = *sdev = *udev = *vdev = rootdev = swapdev = usrdev = vardev = NULL;
- /* We don't need to worry about root/usr/swap if we already have it */
+ /* We don't need to worry about root/usr/swap if we're already multiuser */
if (!RunningAsInit)
return status;
@@ -108,6 +108,18 @@ checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev)
msgDebug("Found usrdev at %s!\n", usrdev->name);
}
}
+ else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/var")) {
+ if (vardev) {
+ msgConfirm("WARNING: You have more than one /var filesystem.\n"
+ "Using the first one found.");
+ continue;
+ }
+ else {
+ vardev = c2;
+ if (isDebug())
+ msgDebug("Found vardev at %s!\n", vardev->name);
+ }
+ }
}
}
}
@@ -140,6 +152,7 @@ checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev)
*rdev = rootdev;
*sdev = swapdev;
*udev = usrdev;
+ *vdev = vardev;
if (!rootdev) {
msgConfirm("No root device found - you must label a partition as /\n"
@@ -157,6 +170,13 @@ checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev)
"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) {
+ 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"
+ "cause your root filesystem to fill up if you receive lots of mail\n"
+ "or edit large temporary files.");
+ }
return status;
}
@@ -647,7 +667,7 @@ installFilesystems(dialogMenuItem *self)
{
int i;
Disk *disk;
- Chunk *c1, *c2, *rootdev, *swapdev, *usrdev;
+ Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev;
Device **devs;
PartInfo *root;
char dname[80], *str;
@@ -656,7 +676,7 @@ installFilesystems(dialogMenuItem *self)
str = variable_get(SYSTEM_STATE);
- if (!checkLabels(&rootdev, &swapdev, &usrdev))
+ if (!checkLabels(&rootdev, &swapdev, &usrdev, &vardev))
return DITEM_FAILURE;
if (rootdev)
diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c
index ed9c26e9c8de..5b49ed27c758 100644
--- a/usr.sbin/sade/label.c
+++ b/usr.sbin/sade/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.52 1996/07/12 15:24:49 jkh Exp $
+ * $Id: label.c,v 1.53 1996/07/14 01:54:39 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -313,7 +313,7 @@ get_partition_type(void)
{
char selection[20];
int i;
- WINDOW *w = savescr();
+ WINDOW *save = savescr();
static unsigned char *fs_types[] = {
"FS",
@@ -321,11 +321,12 @@ get_partition_type(void)
"Swap",
"A swap partition.",
};
+ dialog_clear();
i = dialog_menu("Please choose a partition type",
"If you want to use this partition for swap space, select Swap.\n"
"If you want to put a filesystem on it, choose FS.",
-1, -1, 2, 2, fs_types, selection, NULL, NULL);
- restorescr(w);
+ restorescr(save);
if (!i) {
if (!strcmp(selection, "FS"))
return PART_FILESYSTEM;
@@ -468,7 +469,6 @@ diskLabel(char *str)
PartInfo *p, *oldp;
PartType type;
Device **devs;
- WINDOW *w;
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
@@ -480,7 +480,6 @@ diskLabel(char *str)
keypad(stdscr, TRUE);
record_label_chunks(devs);
- w = savescr();
dialog_clear(); clear();
while (labeling) {
print_label_chunks();
@@ -501,6 +500,7 @@ diskLabel(char *str)
key = toupper(getch());
switch (key) {
int i;
+ static char _msg[40];
case '\014': /* ^L */
continue;
@@ -544,91 +544,93 @@ diskLabel(char *str)
break;
}
sz = space_free(label_chunk_info[here].c);
- if (sz <= FS_MIN_SIZE) {
+ if (sz <= FS_MIN_SIZE)
msg = "Not enough free space to create a new partition in the slice";
- break;
- }
else {
struct chunk *tmp;
int mib[2];
int physmem;
size_t size, swsize;
char *cp;
+ Chunk *rootdev, *swapdev, *usrdev, *vardev;
- cp = variable_get(VAR_ROOT_SIZE);
- tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c,
- (cp ? atoi(cp) : 32) * ONE_MEG, part, FS_BSDFFS,
- CHUNK_IS_ROOT);
-
- if (!tmp) {
- msgConfirm("Unable to create the root partition. Too big?");
- break;
- }
- tmp->private_data = new_part("/", TRUE, tmp->size);
- tmp->private_free = safe_free;
- record_label_chunks(devs);
-
- cp = variable_get(VAR_SWAP_SIZE);
- if (cp)
- swsize = atoi(cp) * ONE_MEG;
- else {
- mib[0] = CTL_HW;
- mib[1] = HW_PHYSMEM;
- size = sizeof physmem;
- sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0);
- swsize = 16 * ONE_MEG + (physmem * 2 / 512);
- }
- tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c,
- swsize,
- part, FS_SWAP, 0);
- if (!tmp) {
- msgConfirm("Unable to create the swap partition. Too big?");
- break;
+ (void)checkLabels(&rootdev, &swapdev, &usrdev, &vardev);
+ if (!rootdev) {
+ cp = variable_get(VAR_ROOT_SIZE);
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
+ (cp ? atoi(cp) : 32) * ONE_MEG, part, FS_BSDFFS, CHUNK_IS_ROOT);
+ if (!tmp) {
+ msgConfirm("Unable to create the root partition. Too big?");
+ break;
+ }
+ tmp->private_data = new_part("/", TRUE, tmp->size);
+ tmp->private_free = safe_free;
+ record_label_chunks(devs);
}
-
- tmp->private_data = 0;
- tmp->private_free = safe_free;
- record_label_chunks(devs);
-
- cp = variable_get(VAR_VAR_SIZE);
- tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c,
- (cp ? atoi(cp) : VAR_MIN_SIZE) * ONE_MEG, part, FS_BSDFFS, 0);
- if (!tmp) {
- msgConfirm("Less than %dMB free for /var - you will need to\n"
- "partition your disk manually with a custom install!", (cp ? atoi(cp) : VAR_MIN_SIZE));
- break;
+
+ if (!swapdev) {
+ cp = variable_get(VAR_SWAP_SIZE);
+ if (cp)
+ swsize = atoi(cp) * ONE_MEG;
+ else {
+ mib[0] = CTL_HW;
+ mib[1] = HW_PHYSMEM;
+ size = sizeof physmem;
+ sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0);
+ swsize = 16 * ONE_MEG + (physmem * 2 / 512);
+ }
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
+ swsize, part, FS_SWAP, 0);
+ if (!tmp) {
+ msgConfirm("Unable to create the swap partition. Too big?");
+ break;
+ }
+ tmp->private_data = 0;
+ tmp->private_free = safe_free;
+ record_label_chunks(devs);
}
- tmp->private_data = new_part("/var", TRUE, tmp->size);
- tmp->private_free = safe_free;
- record_label_chunks(devs);
-
- cp = variable_get(VAR_USR_SIZE);
- if (cp)
- sz = atoi(cp) * ONE_MEG;
- else
- sz = space_free(label_chunk_info[here].c);
- if (!sz || sz < (USR_MIN_SIZE * ONE_MEG)) {
- msgConfirm("Less than %dMB free for /usr - you will need to\n"
- "partition your disk manually with a custom install!", USR_MIN_SIZE);
- break;
+
+ if (!vardev) {
+ cp = variable_get(VAR_VAR_SIZE);
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
+ (cp ? atoi(cp) : VAR_MIN_SIZE) * ONE_MEG, part, FS_BSDFFS, 0);
+ if (!tmp) {
+ msgConfirm("Less than %dMB free for /var - you will need to\n"
+ "partition your disk manually with a custom install!",
+ (cp ? atoi(cp) : VAR_MIN_SIZE));
+ break;
+ }
+ tmp->private_data = new_part("/var", TRUE, tmp->size);
+ tmp->private_free = safe_free;
+ record_label_chunks(devs);
}
- tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c,
- sz, part, FS_BSDFFS, 0);
- if (!tmp) {
- msgConfirm("Unable to create the /usr partition. Not enough space?\n"
- "You will need to partition your disk manually with a custom install!");
- break;
+ if (!usrdev) {
+ cp = variable_get(VAR_USR_SIZE);
+ if (cp)
+ sz = atoi(cp) * ONE_MEG;
+ else
+ sz = space_free(label_chunk_info[here].c);
+ if (!sz || sz < (USR_MIN_SIZE * ONE_MEG)) {
+ msgConfirm("Less than %dMB free for /usr - you will need to\n"
+ "partition your disk manually with a custom install!", USR_MIN_SIZE);
+ break;
+ }
+
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
+ label_chunk_info[here].c,
+ sz, part, FS_BSDFFS, 0);
+ if (!tmp) {
+ msgConfirm("Unable to create the /usr partition. Not enough space?\n"
+ "You will need to partition your disk manually with a custom install!");
+ break;
+ }
+ tmp->private_data = new_part("/usr", TRUE, tmp->size);
+ tmp->private_free = safe_free;
+ record_label_chunks(devs);
}
/* At this point, we're reasonably "labelled" */
variable_set2(DISK_LABELLED, "yes");
- tmp->private_data = new_part("/usr", TRUE, tmp->size);
- tmp->private_free = safe_free;
- record_label_chunks(devs);
}
break;
@@ -863,10 +865,10 @@ diskLabel(char *str)
default:
beep();
- msg = "Type F1 or ? for help";
+ sprintf(_msg, "Invalid key %d - Type F1 or ? for help", key);
+ msg = _msg;
break;
}
}
- restorescr(w);
- return DITEM_SUCCESS;
+ return DITEM_SUCCESS | DITEM_RESTORE;
}
diff --git a/usr.sbin/sade/msg.c b/usr.sbin/sade/msg.c
index f37b0d37ddb8..3369019cec21 100644
--- a/usr.sbin/sade/msg.c
+++ b/usr.sbin/sade/msg.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: msg.c,v 1.36 1996/06/14 14:33:57 jkh Exp $
+ * $Id: msg.c,v 1.37 1996/07/10 11:38:28 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -82,9 +82,7 @@ msgInfo(char *fmt, ...)
/* NULL is a special convention meaning "erase the old stuff" */
if (!fmt) {
move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0);
- attrset(A_NORMAL);
clrtoeol();
- attrset(attrs);
return;
}
errstr = (char *)alloca(FILENAME_MAX);
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 98aa679aaa35..49c6dc4f7d4a 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.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.74 1996/07/09 14:28:22 jkh Exp $
+ * $Id: sysinstall.h,v 1.75 1996/07/16 17:11:45 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -466,6 +466,7 @@ void index_print(PkgNodePtr top, int level);
int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist);
/* install.c */
+extern Boolean checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev);
extern int installCommit(dialogMenuItem *self);
extern int installCustomCommit(dialogMenuItem *self);
extern int installExpress(dialogMenuItem *self);
diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c
index 21dbe87b9ebd..df857ef122fb 100644
--- a/usr.sbin/sysinstall/disks.c
+++ b/usr.sbin/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.54 1996/07/05 08:35:52 jkh Exp $
+ * $Id: disks.c,v 1.55 1996/07/09 03:07:47 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -70,24 +70,27 @@ print_chunks(Disk *d)
int row;
int i;
- if ((!d->bios_cyl || d->bios_cyl > 65536) || (!d->bios_hd || d->bios_hd > 256) || (!d->bios_sect || d->bios_sect >= 64)) {
+ if (!d->bios_cyl && !d->bios_hd && !d->bios_sect) {
+ All_FreeBSD(d, TRUE);
+ d->bios_hd = d->bios_sect = d->bios_cyl = 1;
+ }
+ else if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
int sz;
dialog_clear();
- msgConfirm("WARNING: The current geometry for %s is incorrect. Using\n"
+ msgConfirm("WARNING: A geometry of %d/%d/%d for %s is incorrect. Using\n"
"a default geometry of 64 heads and 32 sectors. If this geometry\n"
"is incorrect or you are unsure as to whether or not it's correct,\n"
"please consult the Hardware Guide in the Documentation submenu\n"
- "or use the (G)eometry command to change it now.", d->name);
+ "or use the (G)eometry command to change it now.", d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
d->bios_hd = 64;
d->bios_sect = 32;
- sz = 0;
- for (i = 0; chunk_info[i]; i++)
+ for (i = sz = 0; chunk_info[i]; i++)
sz += chunk_info[i]->size;
if (sz)
d->bios_cyl = sz / ONE_MEG;
else
- msgConfirm("Couldn't set geometry! You'll have to do it by hand.");
+ msgConfirm("Couldn't calculate disk size! You'll have to set the geometry by hand.");
}
attrset(A_NORMAL);
mvaddstr(0, 0, "Disk name:\t");
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index e5ee68975a57..05c330261f1c 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/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.114 1996/07/13 05:13:25 jkh Exp $
+ * $Id: install.c,v 1.115 1996/07/16 17:11:41 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -55,19 +55,19 @@ static void create_termcap(void);
static void installConfigure(void);
-static Boolean
-checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev)
+Boolean
+checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev)
{
Device **devs;
Boolean status;
Disk *disk;
- Chunk *c1, *c2, *rootdev, *swapdev, *usrdev;
+ Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev;
int i;
status = TRUE;
- *rdev = *sdev = *udev = rootdev = swapdev = usrdev = NULL;
+ *rdev = *sdev = *udev = *vdev = rootdev = swapdev = usrdev = vardev = NULL;
- /* We don't need to worry about root/usr/swap if we already have it */
+ /* We don't need to worry about root/usr/swap if we're already multiuser */
if (!RunningAsInit)
return status;
@@ -108,6 +108,18 @@ checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev)
msgDebug("Found usrdev at %s!\n", usrdev->name);
}
}
+ else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/var")) {
+ if (vardev) {
+ msgConfirm("WARNING: You have more than one /var filesystem.\n"
+ "Using the first one found.");
+ continue;
+ }
+ else {
+ vardev = c2;
+ if (isDebug())
+ msgDebug("Found vardev at %s!\n", vardev->name);
+ }
+ }
}
}
}
@@ -140,6 +152,7 @@ checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev)
*rdev = rootdev;
*sdev = swapdev;
*udev = usrdev;
+ *vdev = vardev;
if (!rootdev) {
msgConfirm("No root device found - you must label a partition as /\n"
@@ -157,6 +170,13 @@ checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev)
"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) {
+ 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"
+ "cause your root filesystem to fill up if you receive lots of mail\n"
+ "or edit large temporary files.");
+ }
return status;
}
@@ -647,7 +667,7 @@ installFilesystems(dialogMenuItem *self)
{
int i;
Disk *disk;
- Chunk *c1, *c2, *rootdev, *swapdev, *usrdev;
+ Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev;
Device **devs;
PartInfo *root;
char dname[80], *str;
@@ -656,7 +676,7 @@ installFilesystems(dialogMenuItem *self)
str = variable_get(SYSTEM_STATE);
- if (!checkLabels(&rootdev, &swapdev, &usrdev))
+ if (!checkLabels(&rootdev, &swapdev, &usrdev, &vardev))
return DITEM_FAILURE;
if (rootdev)
diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c
index ed9c26e9c8de..5b49ed27c758 100644
--- a/usr.sbin/sysinstall/label.c
+++ b/usr.sbin/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.52 1996/07/12 15:24:49 jkh Exp $
+ * $Id: label.c,v 1.53 1996/07/14 01:54:39 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -313,7 +313,7 @@ get_partition_type(void)
{
char selection[20];
int i;
- WINDOW *w = savescr();
+ WINDOW *save = savescr();
static unsigned char *fs_types[] = {
"FS",
@@ -321,11 +321,12 @@ get_partition_type(void)
"Swap",
"A swap partition.",
};
+ dialog_clear();
i = dialog_menu("Please choose a partition type",
"If you want to use this partition for swap space, select Swap.\n"
"If you want to put a filesystem on it, choose FS.",
-1, -1, 2, 2, fs_types, selection, NULL, NULL);
- restorescr(w);
+ restorescr(save);
if (!i) {
if (!strcmp(selection, "FS"))
return PART_FILESYSTEM;
@@ -468,7 +469,6 @@ diskLabel(char *str)
PartInfo *p, *oldp;
PartType type;
Device **devs;
- WINDOW *w;
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
@@ -480,7 +480,6 @@ diskLabel(char *str)
keypad(stdscr, TRUE);
record_label_chunks(devs);
- w = savescr();
dialog_clear(); clear();
while (labeling) {
print_label_chunks();
@@ -501,6 +500,7 @@ diskLabel(char *str)
key = toupper(getch());
switch (key) {
int i;
+ static char _msg[40];
case '\014': /* ^L */
continue;
@@ -544,91 +544,93 @@ diskLabel(char *str)
break;
}
sz = space_free(label_chunk_info[here].c);
- if (sz <= FS_MIN_SIZE) {
+ if (sz <= FS_MIN_SIZE)
msg = "Not enough free space to create a new partition in the slice";
- break;
- }
else {
struct chunk *tmp;
int mib[2];
int physmem;
size_t size, swsize;
char *cp;
+ Chunk *rootdev, *swapdev, *usrdev, *vardev;
- cp = variable_get(VAR_ROOT_SIZE);
- tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c,
- (cp ? atoi(cp) : 32) * ONE_MEG, part, FS_BSDFFS,
- CHUNK_IS_ROOT);
-
- if (!tmp) {
- msgConfirm("Unable to create the root partition. Too big?");
- break;
- }
- tmp->private_data = new_part("/", TRUE, tmp->size);
- tmp->private_free = safe_free;
- record_label_chunks(devs);
-
- cp = variable_get(VAR_SWAP_SIZE);
- if (cp)
- swsize = atoi(cp) * ONE_MEG;
- else {
- mib[0] = CTL_HW;
- mib[1] = HW_PHYSMEM;
- size = sizeof physmem;
- sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0);
- swsize = 16 * ONE_MEG + (physmem * 2 / 512);
- }
- tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c,
- swsize,
- part, FS_SWAP, 0);
- if (!tmp) {
- msgConfirm("Unable to create the swap partition. Too big?");
- break;
+ (void)checkLabels(&rootdev, &swapdev, &usrdev, &vardev);
+ if (!rootdev) {
+ cp = variable_get(VAR_ROOT_SIZE);
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
+ (cp ? atoi(cp) : 32) * ONE_MEG, part, FS_BSDFFS, CHUNK_IS_ROOT);
+ if (!tmp) {
+ msgConfirm("Unable to create the root partition. Too big?");
+ break;
+ }
+ tmp->private_data = new_part("/", TRUE, tmp->size);
+ tmp->private_free = safe_free;
+ record_label_chunks(devs);
}
-
- tmp->private_data = 0;
- tmp->private_free = safe_free;
- record_label_chunks(devs);
-
- cp = variable_get(VAR_VAR_SIZE);
- tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c,
- (cp ? atoi(cp) : VAR_MIN_SIZE) * ONE_MEG, part, FS_BSDFFS, 0);
- if (!tmp) {
- msgConfirm("Less than %dMB free for /var - you will need to\n"
- "partition your disk manually with a custom install!", (cp ? atoi(cp) : VAR_MIN_SIZE));
- break;
+
+ if (!swapdev) {
+ cp = variable_get(VAR_SWAP_SIZE);
+ if (cp)
+ swsize = atoi(cp) * ONE_MEG;
+ else {
+ mib[0] = CTL_HW;
+ mib[1] = HW_PHYSMEM;
+ size = sizeof physmem;
+ sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0);
+ swsize = 16 * ONE_MEG + (physmem * 2 / 512);
+ }
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
+ swsize, part, FS_SWAP, 0);
+ if (!tmp) {
+ msgConfirm("Unable to create the swap partition. Too big?");
+ break;
+ }
+ tmp->private_data = 0;
+ tmp->private_free = safe_free;
+ record_label_chunks(devs);
}
- tmp->private_data = new_part("/var", TRUE, tmp->size);
- tmp->private_free = safe_free;
- record_label_chunks(devs);
-
- cp = variable_get(VAR_USR_SIZE);
- if (cp)
- sz = atoi(cp) * ONE_MEG;
- else
- sz = space_free(label_chunk_info[here].c);
- if (!sz || sz < (USR_MIN_SIZE * ONE_MEG)) {
- msgConfirm("Less than %dMB free for /usr - you will need to\n"
- "partition your disk manually with a custom install!", USR_MIN_SIZE);
- break;
+
+ if (!vardev) {
+ cp = variable_get(VAR_VAR_SIZE);
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
+ (cp ? atoi(cp) : VAR_MIN_SIZE) * ONE_MEG, part, FS_BSDFFS, 0);
+ if (!tmp) {
+ msgConfirm("Less than %dMB free for /var - you will need to\n"
+ "partition your disk manually with a custom install!",
+ (cp ? atoi(cp) : VAR_MIN_SIZE));
+ break;
+ }
+ tmp->private_data = new_part("/var", TRUE, tmp->size);
+ tmp->private_free = safe_free;
+ record_label_chunks(devs);
}
- tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c,
- sz, part, FS_BSDFFS, 0);
- if (!tmp) {
- msgConfirm("Unable to create the /usr partition. Not enough space?\n"
- "You will need to partition your disk manually with a custom install!");
- break;
+ if (!usrdev) {
+ cp = variable_get(VAR_USR_SIZE);
+ if (cp)
+ sz = atoi(cp) * ONE_MEG;
+ else
+ sz = space_free(label_chunk_info[here].c);
+ if (!sz || sz < (USR_MIN_SIZE * ONE_MEG)) {
+ msgConfirm("Less than %dMB free for /usr - you will need to\n"
+ "partition your disk manually with a custom install!", USR_MIN_SIZE);
+ break;
+ }
+
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
+ label_chunk_info[here].c,
+ sz, part, FS_BSDFFS, 0);
+ if (!tmp) {
+ msgConfirm("Unable to create the /usr partition. Not enough space?\n"
+ "You will need to partition your disk manually with a custom install!");
+ break;
+ }
+ tmp->private_data = new_part("/usr", TRUE, tmp->size);
+ tmp->private_free = safe_free;
+ record_label_chunks(devs);
}
/* At this point, we're reasonably "labelled" */
variable_set2(DISK_LABELLED, "yes");
- tmp->private_data = new_part("/usr", TRUE, tmp->size);
- tmp->private_free = safe_free;
- record_label_chunks(devs);
}
break;
@@ -863,10 +865,10 @@ diskLabel(char *str)
default:
beep();
- msg = "Type F1 or ? for help";
+ sprintf(_msg, "Invalid key %d - Type F1 or ? for help", key);
+ msg = _msg;
break;
}
}
- restorescr(w);
- return DITEM_SUCCESS;
+ return DITEM_SUCCESS | DITEM_RESTORE;
}
diff --git a/usr.sbin/sysinstall/msg.c b/usr.sbin/sysinstall/msg.c
index f37b0d37ddb8..3369019cec21 100644
--- a/usr.sbin/sysinstall/msg.c
+++ b/usr.sbin/sysinstall/msg.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: msg.c,v 1.36 1996/06/14 14:33:57 jkh Exp $
+ * $Id: msg.c,v 1.37 1996/07/10 11:38:28 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -82,9 +82,7 @@ msgInfo(char *fmt, ...)
/* NULL is a special convention meaning "erase the old stuff" */
if (!fmt) {
move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0);
- attrset(A_NORMAL);
clrtoeol();
- attrset(attrs);
return;
}
errstr = (char *)alloca(FILENAME_MAX);
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 98aa679aaa35..49c6dc4f7d4a 100644
--- a/usr.sbin/sysinstall/sysinstall.h
+++ b/usr.sbin/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.74 1996/07/09 14:28:22 jkh Exp $
+ * $Id: sysinstall.h,v 1.75 1996/07/16 17:11:45 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -466,6 +466,7 @@ void index_print(PkgNodePtr top, int level);
int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist);
/* install.c */
+extern Boolean checkLabels(Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev);
extern int installCommit(dialogMenuItem *self);
extern int installCustomCommit(dialogMenuItem *self);
extern int installExpress(dialogMenuItem *self);