summaryrefslogtreecommitdiffstats
path: root/release/sysinstall/label.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-08-11 13:08:29 +0000
committerjkh <jkh@FreeBSD.org>1997-08-11 13:08:29 +0000
commita6a2ca12c2ed98f5f638b0863a615ed44b6e7844 (patch)
treefa66bee42847b4e038a79c7e7d990c493370d746 /release/sysinstall/label.c
parentba6340d33073b774ebb6897ce35dfb411e0d005b (diff)
downloadFreeBSD-src-a6a2ca12c2ed98f5f638b0863a615ed44b6e7844.zip
FreeBSD-src-a6a2ca12c2ed98f5f638b0863a615ed44b6e7844.tar.gz
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).
Diffstat (limited to 'release/sysinstall/label.c')
-rw-r--r--release/sysinstall/label.c87
1 files changed, 49 insertions, 38 deletions
diff --git a/release/sysinstall/label.c b/release/sysinstall/label.c
index 582e561..abc6f12 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.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;
OpenPOWER on IntegriCloud