summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/disks.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-04-07 03:52:36 +0000
committerjkh <jkh@FreeBSD.org>1996-04-07 03:52:36 +0000
commit61af07d0231e53139c2d8c49081a0f43da46af74 (patch)
treea289c0714788a15dfb0bcf3c9030a3425c5072c3 /usr.sbin/sysinstall/disks.c
parent318997a39fbec1e8347a1ff0431ca2713799510f (diff)
downloadFreeBSD-src-61af07d0231e53139c2d8c49081a0f43da46af74.zip
FreeBSD-src-61af07d0231e53139c2d8c49081a0f43da46af74.tar.gz
Major surgery.
1. Use new dialog menu hacks (no strings, just arrays of dialogMenuItem structs) so that I can create composite menus with radio/checkbox/... items in them, removing some long-standing UI bogons in various menus. This work isn't finished yet, but will be done in two phases. This is phase one. 2. Remove all the script installation stuff. I never got time to document it, it was arcane and it just complicated much of the code. There are better ways of doing this if I want to do auto-driven installations later. 3. Remove much dead code and otherwise attempt to remove as much historical grot as possible so that this code is easier to hack on. This is also a two-stage process, phase one of which is now complete.
Diffstat (limited to 'usr.sbin/sysinstall/disks.c')
-rw-r--r--usr.sbin/sysinstall/disks.c100
1 files changed, 6 insertions, 94 deletions
diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c
index c07afb0..6f8f3de 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.37 1996/03/20 14:11:21 jkh Exp $
+ * $Id: disks.c,v 1.38 1996/03/24 18:57:35 joerg Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -135,92 +135,6 @@ print_command_summary()
move(0, 0);
}
-/* Partition a disk based wholly on which variables are set */
-static void
-scriptPartition(Device *dev, Disk *d)
-{
- char *cp;
- int i, sz;
-
- record_chunks(d);
- cp = variable_get(VAR_GEOMETRY);
- if (cp) {
- msgDebug("Setting geometry from script to: %s\n", cp);
- d->bios_cyl = strtol(cp, &cp, 0);
- d->bios_hd = strtol(cp + 1, &cp, 0);
- d->bios_sect = strtol(cp + 1, 0, 0);
- }
-
- cp = variable_get(VAR_DISKSPACE);
- if (cp) {
- if (!strcmp(cp, "free")) {
- /* Do free disk space case */
- for (i = 0; chunk_info[i]; i++) {
- /* If a chunk is at least 10MB in size, use it. */
- if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
- Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size, freebsd, 3,
- (chunk_info[i]->flags & CHUNK_ALIGN));
- variable_set2(DISK_PARTITIONED, "yes");
- break;
- }
- }
- if (!chunk_info[i]) {
- dialog_clear();
- msgConfirm("Unable to find any free space on this disk!");
- return;
- }
- }
- else if (!strcmp(cp, "all")) {
- /* Do all disk space case */
- msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
-
- All_FreeBSD(d, FALSE);
- }
- else if (!strcmp(cp, "exclusive")) {
- /* Do really-all-the-disk-space case */
- msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
-
- All_FreeBSD(d, TRUE);
- }
- else if ((sz = strtol(cp, &cp, 0))) {
- /* Look for sz bytes free */
- if (*cp && toupper(*cp) == 'M')
- sz *= ONE_MEG;
- for (i = 0; chunk_info[i]; i++) {
- /* If a chunk is at least sz MB, use it. */
- if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
- Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3, (chunk_info[i]->flags & CHUNK_ALIGN));
- variable_set2(DISK_PARTITIONED, "yes");
- break;
- }
- }
- if (!chunk_info[i]) {
- dialog_clear();
- msgConfirm("Unable to find %d free blocks on this disk!", sz);
- return;
- }
- }
- else if (!strcmp(cp, "existing")) {
- /* Do existing FreeBSD case */
- for (i = 0; chunk_info[i]; i++) {
- if (chunk_info[i]->type == freebsd)
- break;
- }
- if (!chunk_info[i]) {
- dialog_clear();
- msgConfirm("Unable to find any existing FreeBSD partitions on this disk!");
- return;
- }
- }
- else {
- dialog_clear();
- msgConfirm("`%s' is an invalid value for %s - is config file valid?", cp, VAR_DISKSPACE);
- return;
- }
- variable_set2(DISK_PARTITIONED, "yes");
- }
-}
-
static u_char *
getBootMgr(char *dname)
{
@@ -533,14 +447,15 @@ partitionHook(char *str)
}
int
-diskPartitionEditor(char *str)
+diskPartitionEditor(dialogMenuItem *self)
{
DMenu *menu;
Device **devs;
int i, cnt;
- char *cp;
+ char *cp, *str;
cp = variable_get(VAR_DISK);
+ str= variable_get(SYSTEM_STATE);
devs = deviceFind(cp, DEVICE_TYPE_DISK);
cnt = deviceCount(devs);
if (!cnt) {
@@ -552,10 +467,7 @@ diskPartitionEditor(char *str)
}
else if (cnt == 1) {
devs[0]->enabled = TRUE;
- if (str && !strcmp(str, "script"))
- scriptPartition(devs[0], (Disk *)devs[0]->private);
- else
- diskPartition(devs[0], (Disk *)devs[0]->private);
+ diskPartition(devs[0], (Disk *)devs[0]->private);
i = RET_SUCCESS;
variable_set2(DISK_SELECTED, "yes");
}
@@ -584,7 +496,7 @@ diskPartitionEditor(char *str)
}
int
-diskPartitionWrite(char *str)
+diskPartitionWrite(dialogMenuItem *self)
{
Device **devs;
char *cp;
OpenPOWER on IntegriCloud