diff options
author | jkh <jkh@FreeBSD.org> | 2001-03-12 10:18:54 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2001-03-12 10:18:54 +0000 |
commit | 338f25906d3f2b09a1e95a3e879422d0965a8fbd (patch) | |
tree | 22f7e6506cd2209cc05602b1bddc4dc4541ba77d /usr.sbin/sysinstall | |
parent | 2833cfc211ddea931a242764fd58c92128d862a9 (diff) | |
download | FreeBSD-src-338f25906d3f2b09a1e95a3e879422d0965a8fbd.zip FreeBSD-src-338f25906d3f2b09a1e95a3e879422d0965a8fbd.tar.gz |
Really finish softupdate setting from the label editor and fix
a few cosmetic problems:
o Allow it to work with scripts (see man page or install.cfg file).
o Preserve old softupdates flag across newfs toggles
o Clean up partitioned/labelled flag handling
o Don't ask for MBR choice again if you've already written it out.
o Actually document the new features.
Diffstat (limited to 'usr.sbin/sysinstall')
-rw-r--r-- | usr.sbin/sysinstall/disks.c | 49 | ||||
-rw-r--r-- | usr.sbin/sysinstall/install.cfg | 5 | ||||
-rw-r--r-- | usr.sbin/sysinstall/label.c | 36 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.8 | 5 |
4 files changed, 42 insertions, 53 deletions
diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index 4932528..a033782 100644 --- a/usr.sbin/sysinstall/disks.c +++ b/usr.sbin/sysinstall/disks.c @@ -527,7 +527,7 @@ diskPartition(Device *dev) break; case 'U': - if ((cp = variable_get(DISK_LABELLED)) && !strcmp(cp, "written")) { + if (!variable_cmp(DISK_LABELLED, "written")) { msgConfirm("You've already written this information out - you\n" "can't undo it."); } @@ -624,21 +624,6 @@ diskPartition(Device *dev) * starts at sector 0), even in cases where the user has requested * booteasy or a "standard" MBR -- both would be fatal in this case. */ -#if 0 - if ((d->chunks->part->flags & CHUNK_FORCE_ALL) != CHUNK_FORCE_ALL) { -#ifdef PC98 - getBootMgr(d->name, &bootipl, &bootipl_size, - &bootmenu, &bootmenu_size); - if (bootipl != NULL && bootmenu != NULL) - Set_Boot_Mgr(d, bootipl, bootipl_size, - bootmenu, bootmenu_size); -#else - getBootMgr(d->name, &mbrContents, &mbrSize); - if (mbrContents != NULL) - Set_Boot_Mgr(d, mbrContents, mbrSize); -#endif - } -#else /* * Don't offer to update the MBR on this disk if the first "real" * chunk looks like a FreeBSD "all disk" partition, or the disk is @@ -646,19 +631,20 @@ diskPartition(Device *dev) */ if ((d->chunks->part->type != freebsd) || (d->chunks->part->offset > 1)) { + if (variable_cmp(DISK_PARTITIONED, "written")) { #ifdef PC98 - getBootMgr(d->name, &bootipl, &bootipl_size, - &bootmenu, &bootmenu_size); - if (bootipl != NULL && bootmenu != NULL) - Set_Boot_Mgr(d, bootipl, bootipl_size, - bootmenu, bootmenu_size); + getBootMgr(d->name, &bootipl, &bootipl_size, + &bootmenu, &bootmenu_size); + if (bootipl != NULL && bootmenu != NULL) + Set_Boot_Mgr(d, bootipl, bootipl_size, + bootmenu, bootmenu_size); #else - getBootMgr(d->name, &mbrContents, &mbrSize); - if (mbrContents != NULL) - Set_Boot_Mgr(d, mbrContents, mbrSize); + getBootMgr(d->name, &mbrContents, &mbrSize); + if (mbrContents != NULL) + Set_Boot_Mgr(d, mbrContents, mbrSize); + } #endif } -#endif break; case 'Z': @@ -807,7 +793,9 @@ diskPartitionWrite(dialogMenuItem *self) { Device **devs; int i; - char *cp; + + if (!variable_cmp(DISK_PARTITIONED, "written")) + return DITEM_SUCCESS; devs = deviceFind(NULL, DEVICE_TYPE_DISK); if (!devs) { @@ -816,10 +804,6 @@ diskPartitionWrite(dialogMenuItem *self) } if (isDebug()) msgDebug("diskPartitionWrite: Examining %d devices\n", deviceCount(devs)); - cp = variable_get(DISK_PARTITIONED); - if (cp && !strcmp(cp, "written")) - return DITEM_SUCCESS; - for (i = 0; devs[i]; i++) { Disk *d = (Disk *)devs[i]->private; static u_char *boot1; @@ -844,10 +828,6 @@ diskPartitionWrite(dialogMenuItem *self) msgConfirm("ERROR: Unable to write data to disk %s!", d->name); return DITEM_FAILURE; } - - /* If we've been through here before, we don't need to do the rest */ - if (cp && !strcmp(cp, "written")) - return DITEM_SUCCESS; } /* Now it's not "yes", but "written" */ variable_set2(DISK_PARTITIONED, "written", 0); @@ -972,3 +952,4 @@ diskPartitionNonInteractive(Device *dev) variable_set2(DISK_PARTITIONED, "yes", 0); } } + diff --git a/usr.sbin/sysinstall/install.cfg b/usr.sbin/sysinstall/install.cfg index 2660547..fd8e520 100644 --- a/usr.sbin/sysinstall/install.cfg +++ b/usr.sbin/sysinstall/install.cfg @@ -1,6 +1,8 @@ # This is the installation configuration file for my test machine, # crate.cdrom.com. # It is included here merely as a sort-of-documented example. +# +# $FreeBSD$ # Turn on extra debugging. debug=yes @@ -55,7 +57,8 @@ ad0s1-1=ufs 40960 / # And a 20MB swap partition ad0s1-2=swap 40960 none # Followed by a /usr partition using all remaining space (size 0 = free space) -ad0s1-3=ufs 0 /usr +# and with softupdates enabled (non-zero arg following mountpoint). +ad0s1-3=ufs 0 /usr 1 # Let's do it! diskLabelEditor diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c index 64ec624..9d18939 100644 --- a/usr.sbin/sysinstall/label.c +++ b/usr.sbin/sysinstall/label.c @@ -174,9 +174,7 @@ diskLabelEditor(dialogMenuItem *self) } } if (DITEM_STATUS(i) != DITEM_FAILURE) { - char *cp; - - if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written"))) + if (variable_cmp(DISK_LABELLED, "written")) variable_set2(DISK_LABELLED, "yes", 0); } return i; @@ -420,7 +418,7 @@ getNewfsCmd(PartInfo *p) #define PART_MOUNT_COL 10 #define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 3) #define PART_NEWFS_COL (PART_SIZE_COL + 8) -#define PART_OFF 38 +#define PART_OFF 39 #define TOTAL_AVAIL_LINES (10) #define PSLICE_SHOWABLE (4) @@ -882,7 +880,7 @@ diskLabel(Device *dev) } /* At this point, we're reasonably "labelled" */ - if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written"))) + if (variable_cmp(DISK_LABELLED, "written")) variable_set2(DISK_LABELLED, "yes", 0); } break; @@ -982,7 +980,7 @@ diskLabel(Device *dev) else tmp->private_data = p; tmp->private_free = safe_free; - if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written"))) + if (variable_cmp(DISK_LABELLED, "written")) variable_set2(DISK_LABELLED, "yes", 0); record_label_chunks(devs, dev); clear_wins(); @@ -1013,7 +1011,7 @@ diskLabel(Device *dev) break; } Delete_Chunk(label_chunk_info[here].c->disk, label_chunk_info[here].c); - if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written"))) + if (variable_cmp(DISK_LABELLED, "written")) variable_set2(DISK_LABELLED, "yes", 0); record_label_chunks(devs, dev); break; @@ -1042,7 +1040,7 @@ diskLabel(Device *dev) strcpy(p->mountpoint, "/bogus"); } } - if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written"))) + if (variable_cmp(DISK_LABELLED, "written")) variable_set2(DISK_LABELLED, "yes", 0); record_label_chunks(devs, dev); clear_wins(); @@ -1071,6 +1069,8 @@ diskLabel(Device *dev) else msg = MSG_NOT_APPLICABLE; } + else + msg = MSG_NOT_APPLICABLE; break; case 'T': /* Toggle newfs state */ @@ -1078,9 +1078,11 @@ diskLabel(Device *dev) PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private_data); label_chunk_info[here].c->private_data = new_part(pi ? pi->mountpoint : NULL, pi ? !pi->newfs : TRUE, label_chunk_info[here].c->size); + if (pi && pi->soft) + ((PartInfo *)label_chunk_info[here].c->private_data)->soft = 1; safe_free(pi); label_chunk_info[here].c->private_free = safe_free; - if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written"))) + if (variable_cmp(DISK_LABELLED, "written")) variable_set2(DISK_LABELLED, "yes", 0); } else @@ -1089,7 +1091,7 @@ diskLabel(Device *dev) case 'U': clear(); - if ((cp = variable_get(DISK_LABELLED)) && !strcmp(cp, "written")) { + if (!variable_cmp(DISK_LABELLED, "written")) { msgConfirm("You've already written out your changes -\n" "it's too late to undo!"); } @@ -1113,10 +1115,10 @@ diskLabel(Device *dev) break; case 'W': - if ((cp = variable_get(DISK_LABELLED)) && !strcmp(cp, "written")) { + if (!variable_cmp(DISK_LABELLED, "written")) { msgConfirm("You've already written out your changes - if you\n" - "wish to overwrite them, you'll have to start this\n" - "procedure again from the beginning."); + "wish to overwrite them, you'll have to restart\n" + "sysinstall first."); } else if (!msgNoYes("WARNING: This should only be used when modifying an EXISTING\n" "installation. If you are installing FreeBSD for the first time\n" @@ -1149,7 +1151,7 @@ diskLabel(Device *dev) if (devs[i]->enabled) slice_wizard(((Disk *)devs[i]->private)); } - if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written"))) + if (variable_cmp(DISK_LABELLED, "written")) variable_set2(DISK_LABELLED, "yes", 0); DialogActive = TRUE; record_label_chunks(devs, dev); @@ -1214,7 +1216,7 @@ diskLabelNonInteractive(Device *dev) if (label_chunk_info[i].type == PART_SLICE) { char name[512]; - int entries = 1; + int soft, entries = 1; while (entries) { snprintf(name, sizeof name, "%s-%d", c1->name, entries); @@ -1222,7 +1224,7 @@ diskLabelNonInteractive(Device *dev) int sz; char typ[10], mpoint[50]; - if (sscanf(cp, "%s %d %s", typ, &sz, mpoint) != 3) { + if (sscanf(cp, "%s %d %s %d", typ, &sz, mpoint, &soft) < 3) { msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp); status = DITEM_FAILURE; continue; @@ -1257,6 +1259,8 @@ diskLabelNonInteractive(Device *dev) else { tmp->private_data = new_part(mpoint, TRUE, sz); tmp->private_free = safe_free; + if (!soft) + ((PartInfo *)tmp->private_data)->soft = 1; status = DITEM_SUCCESS; } } diff --git a/usr.sbin/sysinstall/sysinstall.8 b/usr.sbin/sysinstall/sysinstall.8 index 2cf6fca..440a429 100644 --- a/usr.sbin/sysinstall/sysinstall.8 +++ b/usr.sbin/sysinstall/sysinstall.8 @@ -320,9 +320,10 @@ A 20MB root file system (all sizes are in 512 byte blocks). A 64MB swap partition. .It Li "da0s2-3=ufs 204800 /var" A 100MB /var file system. -.It Li "da0s2-4=ufs 0 /usr" +.It Li "da0s2-4=ufs 0 /usr 1" With the balance of free space (around 316MB) going to the /usr -file system. +file system and with soft-updates enabled (the argument following +the mount point, if non-zero, means to set the soft updates flag). .El .Pp One can also use the |