aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/sysinstall/label.c
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1997-08-11 13:08:29 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1997-08-11 13:08:29 +0000
commit86ff6248345adc9bd4a5c1d94d3e64b0cdc19740 (patch)
treed33ca74ad7a6879a4acd0c2961dcb3d71e0f8f7e /usr.sbin/sysinstall/label.c
parent74875cc69fc1f4cddc57fcf06f28437a203094ad (diff)
downloadsrc-86ff6248345adc9bd4a5c1d94d3e64b0cdc19740.tar.gz
src-86ff6248345adc9bd4a5c1d94d3e64b0cdc19740.zip
Make some changes to the way the label editor reads script variables
so you don't need to re-enter it for each and every filesystem. Heads up! This change is incompatible with the previous scripting format, so those folks (all 2 of you) using config files should take a look at the changes to the sample install.cfg file for the diskLabelEditor's new calling syntax. Finally write a man page for this thing, documenting all of the above and more. I can't drive a stake through this thing's heart without properly documenting it first, so please consider this step #1 in that process (to be honest, sysinstall will also live on for some time in the 2.2. branch since it's unlikely that the new install tools will ever make it over there - they're strictly 3.0 material).
Notes
Notes: svn path=/head/; revision=28075
Diffstat (limited to 'usr.sbin/sysinstall/label.c')
-rw-r--r--usr.sbin/sysinstall/label.c87
1 files changed, 49 insertions, 38 deletions
diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c
index 582e561f3144..abc6f12e2ba8 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.70 1997/03/11 17:51:01 jkh Exp $
+ * $Id: label.c,v 1.71 1997/06/05 09:47:57 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -972,63 +972,74 @@ diskLabelNonInteractive(char *str)
Chunk *c1 = label_chunk_info[i].c;
if (label_chunk_info[i].type == PART_SLICE) {
- if ((cp = variable_get(c1->name)) != NULL) {
- int sz;
- char typ[10], mpoint[50];
+ char name[512];
+ int entries = 1;
- if (sscanf(cp, "%s %d %s", typ, &sz, mpoint) != 3) {
- msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp);
- status = DITEM_FAILURE;
- continue;
- }
- else {
- Chunk *tmp;
+ while (entries) {
+ snprintf(name, sizeof name, "%s-%d", c1->name, entries);
+ if ((cp = variable_get(name)) != NULL) {
+ int sz;
+ char typ[10], mpoint[50];
- if (!strcmp(typ, "swap")) {
- type = PART_SWAP;
- strcpy(mpoint, "SWAP");
- }
- else {
- type = PART_FILESYSTEM;
- if (!strcmp(mpoint, "/"))
- flags |= CHUNK_IS_ROOT;
- }
- if (!sz)
- sz = space_free(c1);
- if (sz > space_free(c1)) {
- msgConfirm("Not enough free space to create partition: %s", mpoint);
+ if (sscanf(cp, "%s %d %s", typ, &sz, mpoint) != 3) {
+ msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp);
status = DITEM_FAILURE;
continue;
}
- if (!(tmp = Create_Chunk_DWIM(d, c1, sz, part,
- (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, flags))) {
- msgConfirm("Unable to create from partition spec: %s. Too big?", cp);
- status = DITEM_FAILURE;
- break;
- }
else {
- tmp->private_data = new_part(mpoint, TRUE, sz);
- tmp->private_free = safe_free;
- status = DITEM_SUCCESS;
+ Chunk *tmp;
+
+ if (!strcmp(typ, "swap")) {
+ type = PART_SWAP;
+ strcpy(mpoint, "SWAP");
+ }
+ else {
+ type = PART_FILESYSTEM;
+ if (!strcmp(mpoint, "/"))
+ flags |= CHUNK_IS_ROOT;
+ }
+ if (!sz)
+ sz = space_free(c1);
+ if (sz > space_free(c1)) {
+ msgConfirm("Not enough free space to create partition: %s", mpoint);
+ status = DITEM_FAILURE;
+ continue;
+ }
+ if (!(tmp = Create_Chunk_DWIM(d, c1, sz, part,
+ (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, flags))) {
+ msgConfirm("Unable to create from partition spec: %s. Too big?", cp);
+ status = DITEM_FAILURE;
+ break;
+ }
+ else {
+ tmp->private_data = new_part(mpoint, TRUE, sz);
+ tmp->private_free = safe_free;
+ status = DITEM_SUCCESS;
+ }
}
+ entries++;
+ }
+ else {
+ /* No more matches, leave the loop */
+ entries = 0;
}
}
}
else {
- /* Must be something we can set a mountpoint */
+ /* Must be something we can set a mountpoint for */
cp = variable_get(c1->name);
if (cp) {
- char mpoint[50], nwfs[8];
+ char mpoint[50], do_newfs[8];
Boolean newfs = FALSE;
- nwfs[0] = '\0';
- if (sscanf(cp, "%s %s", mpoint, nwfs) != 2) {
+ do_newfs[0] = '\0';
+ if (sscanf(cp, "%s %s", mpoint, do_newfs) != 2) {
dialog_clear();
msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp);
status = DITEM_FAILURE;
continue;
}
- newfs = toupper(nwfs[0]) == 'Y' ? TRUE : FALSE;
+ newfs = toupper(do_newfs[0]) == 'Y' ? TRUE : FALSE;
if (c1->private_data) {
p = c1->private_data;
p->newfs = newfs;