From 870f49cf8fed65c34b8fbd9c80155b829b356528 Mon Sep 17 00:00:00 2001 From: jkh Date: Wed, 15 Jan 1997 07:06:39 +0000 Subject: Make the bindist-only checks actually work. Add code which theoretically should let you get a disk up from start to finish while running multiuser, using your existing /dev entries. --- release/sysinstall/disks.c | 3 +-- release/sysinstall/install.c | 41 +++++++++++++++++++++-------------------- usr.sbin/sade/disks.c | 3 +-- usr.sbin/sade/install.c | 41 +++++++++++++++++++++-------------------- usr.sbin/sysinstall/disks.c | 3 +-- usr.sbin/sysinstall/install.c | 41 +++++++++++++++++++++-------------------- 6 files changed, 66 insertions(+), 66 deletions(-) diff --git a/release/sysinstall/disks.c b/release/sysinstall/disks.c index c82896e..fb66e3a 100644 --- a/release/sysinstall/disks.c +++ b/release/sysinstall/disks.c @@ -389,8 +389,7 @@ diskPartition(Device *dev, Disk *d) * disk (i.e., the disklabel 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 ((d->chunks->part->flags & CHUNK_FORCE_ALL) != CHUNK_FORCE_ALL - && (mbrContents = getBootMgr(d->name)) != NULL) + if (!(d->chunks->part->flags & CHUNK_FORCE_ALL) && (mbrContents = getBootMgr(d->name)) != NULL) Set_Boot_Mgr(d, mbrContents); if (DITEM_STATUS(diskPartitionWrite(NULL)) != DITEM_SUCCESS) diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c index 0b44fcc..af9d364 100644 --- a/release/sysinstall/install.c +++ b/release/sysinstall/install.c @@ -662,7 +662,7 @@ installCommit(dialogMenuItem *self) { int i; char *str; - Boolean need_bin = FALSE; + Boolean need_bin; if (!Dists) { if (!msgYesNo("No distributions are selected for installation! Do you\n" @@ -702,13 +702,10 @@ installCommit(dialogMenuItem *self) return i; } - if (Dists & DIST_BIN) - need_bin = TRUE; + need_bin = Dists & DIST_BIN; i = distExtractAll(self); - if (DITEM_STATUS(i) == DITEM_SUCCESS) { - if (!need_bin || !(Dists & DIST_BIN)) - i = installFixup(self); - } + if (DITEM_STATUS(i) == DITEM_SUCCESS && (!need_bin || !(Dists & DIST_BIN))) + i = installFixup(self); variable_set2(SYSTEM_STATE, DITEM_STATUS(i) == DITEM_FAILURE ? "error-install" : "full-install"); return i | DITEM_RECREATE; } @@ -838,7 +835,7 @@ installFilesystems(dialogMenuItem *self) command_clear(); upgrade = str && !strcmp(str, "upgrade"); - if (swapdev) { + if (swapdev && RunningAsInit) { /* As the very first thing, try to get ourselves some swap space */ sprintf(dname, "/dev/%s", swapdev->name); if (!Fake && (!MakeDevChunk(swapdev, "/dev") || !file_readable(dname))) { @@ -857,7 +854,7 @@ installFilesystems(dialogMenuItem *self) } } - if (rootdev) { + if (rootdev && RunningAsInit) { /* Next, create and/or mount the root device */ sprintf(dname, "/dev/r%sa", rootdev->disk->name); if (!Fake && (!MakeDevChunk(rootdev, "/dev") || !file_readable(dname))) { @@ -910,11 +907,13 @@ installFilesystems(dialogMenuItem *self) msgConfirm("No chunk list found for %s!", disk->name); return DITEM_FAILURE; } - if (root && (root->newfs || upgrade)) { + if (RunningAsInit && root && (root->newfs || upgrade)) { Mkdir("/mnt/dev"); if (!Fake) MakeDevDisk(disk, "/mnt/dev"); } + else if (!RunningAsInit && !Fake) + MakeDevDisk(disk, "/dev"); for (c1 = disk->chunks->part; c1; c1 = c1->next) { if (c1->type == freebsd) { @@ -927,9 +926,9 @@ installFilesystems(dialogMenuItem *self) continue; if (tmp->newfs) - command_shell_add(tmp->mountpoint, "%s /mnt/dev/r%s", tmp->newfs_cmd, c2->name); + command_shell_add(tmp->mountpoint, "%s %s/dev/r%s", tmp->newfs_cmd, RunningAsInit ? "/mnt" : "", c2->name); else - command_shell_add(tmp->mountpoint, "fsck -y /mnt/dev/r%s", c2->name); + command_shell_add(tmp->mountpoint, "fsck -y %s/dev/r%s", RunningAsInit ? "/mnt" : "", c2->name); command_func_add(tmp->mountpoint, Mount, c2->name); } else if (c2->type == part && c2->subtype == FS_SWAP) { @@ -938,7 +937,7 @@ installFilesystems(dialogMenuItem *self) if (c2 == swapdev) continue; - sprintf(fname, "/mnt/dev/%s", c2->name); + sprintf(fname, "%s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name); i = (Fake || swapon(fname)); if (!i) msgNotify("Added %s as an additional swap device", fname); @@ -950,19 +949,21 @@ installFilesystems(dialogMenuItem *self) else if (c1->type == fat && c1->private_data && (root->newfs || upgrade)) { char name[FILENAME_MAX]; - sprintf(name, "/mnt%s", ((PartInfo *)c1->private_data)->mountpoint); + sprintf(name, "%s/%s", RunningAsInit ? "/mnt" : "", ((PartInfo *)c1->private_data)->mountpoint); Mkdir(name); } } } - msgNotify("Copying initial device files.."); - /* Copy the boot floppy's dev files */ - if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio %s -pdum /mnt", cpioVerbosity())) { - msgConfirm("Couldn't clone the /dev files!"); - return DITEM_FAILURE; + if (RunningAsInit) { + msgNotify("Copying initial device files.."); + /* Copy the boot floppy's dev files */ + if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio %s -pdum /mnt", cpioVerbosity())) { + msgConfirm("Couldn't clone the /dev files!"); + return DITEM_FAILURE; + } } - + command_sort(); command_execute(); return DITEM_SUCCESS; diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c index c82896e..fb66e3a 100644 --- a/usr.sbin/sade/disks.c +++ b/usr.sbin/sade/disks.c @@ -389,8 +389,7 @@ diskPartition(Device *dev, Disk *d) * disk (i.e., the disklabel 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 ((d->chunks->part->flags & CHUNK_FORCE_ALL) != CHUNK_FORCE_ALL - && (mbrContents = getBootMgr(d->name)) != NULL) + if (!(d->chunks->part->flags & CHUNK_FORCE_ALL) && (mbrContents = getBootMgr(d->name)) != NULL) Set_Boot_Mgr(d, mbrContents); if (DITEM_STATUS(diskPartitionWrite(NULL)) != DITEM_SUCCESS) diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 0b44fcc..af9d364 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -662,7 +662,7 @@ installCommit(dialogMenuItem *self) { int i; char *str; - Boolean need_bin = FALSE; + Boolean need_bin; if (!Dists) { if (!msgYesNo("No distributions are selected for installation! Do you\n" @@ -702,13 +702,10 @@ installCommit(dialogMenuItem *self) return i; } - if (Dists & DIST_BIN) - need_bin = TRUE; + need_bin = Dists & DIST_BIN; i = distExtractAll(self); - if (DITEM_STATUS(i) == DITEM_SUCCESS) { - if (!need_bin || !(Dists & DIST_BIN)) - i = installFixup(self); - } + if (DITEM_STATUS(i) == DITEM_SUCCESS && (!need_bin || !(Dists & DIST_BIN))) + i = installFixup(self); variable_set2(SYSTEM_STATE, DITEM_STATUS(i) == DITEM_FAILURE ? "error-install" : "full-install"); return i | DITEM_RECREATE; } @@ -838,7 +835,7 @@ installFilesystems(dialogMenuItem *self) command_clear(); upgrade = str && !strcmp(str, "upgrade"); - if (swapdev) { + if (swapdev && RunningAsInit) { /* As the very first thing, try to get ourselves some swap space */ sprintf(dname, "/dev/%s", swapdev->name); if (!Fake && (!MakeDevChunk(swapdev, "/dev") || !file_readable(dname))) { @@ -857,7 +854,7 @@ installFilesystems(dialogMenuItem *self) } } - if (rootdev) { + if (rootdev && RunningAsInit) { /* Next, create and/or mount the root device */ sprintf(dname, "/dev/r%sa", rootdev->disk->name); if (!Fake && (!MakeDevChunk(rootdev, "/dev") || !file_readable(dname))) { @@ -910,11 +907,13 @@ installFilesystems(dialogMenuItem *self) msgConfirm("No chunk list found for %s!", disk->name); return DITEM_FAILURE; } - if (root && (root->newfs || upgrade)) { + if (RunningAsInit && root && (root->newfs || upgrade)) { Mkdir("/mnt/dev"); if (!Fake) MakeDevDisk(disk, "/mnt/dev"); } + else if (!RunningAsInit && !Fake) + MakeDevDisk(disk, "/dev"); for (c1 = disk->chunks->part; c1; c1 = c1->next) { if (c1->type == freebsd) { @@ -927,9 +926,9 @@ installFilesystems(dialogMenuItem *self) continue; if (tmp->newfs) - command_shell_add(tmp->mountpoint, "%s /mnt/dev/r%s", tmp->newfs_cmd, c2->name); + command_shell_add(tmp->mountpoint, "%s %s/dev/r%s", tmp->newfs_cmd, RunningAsInit ? "/mnt" : "", c2->name); else - command_shell_add(tmp->mountpoint, "fsck -y /mnt/dev/r%s", c2->name); + command_shell_add(tmp->mountpoint, "fsck -y %s/dev/r%s", RunningAsInit ? "/mnt" : "", c2->name); command_func_add(tmp->mountpoint, Mount, c2->name); } else if (c2->type == part && c2->subtype == FS_SWAP) { @@ -938,7 +937,7 @@ installFilesystems(dialogMenuItem *self) if (c2 == swapdev) continue; - sprintf(fname, "/mnt/dev/%s", c2->name); + sprintf(fname, "%s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name); i = (Fake || swapon(fname)); if (!i) msgNotify("Added %s as an additional swap device", fname); @@ -950,19 +949,21 @@ installFilesystems(dialogMenuItem *self) else if (c1->type == fat && c1->private_data && (root->newfs || upgrade)) { char name[FILENAME_MAX]; - sprintf(name, "/mnt%s", ((PartInfo *)c1->private_data)->mountpoint); + sprintf(name, "%s/%s", RunningAsInit ? "/mnt" : "", ((PartInfo *)c1->private_data)->mountpoint); Mkdir(name); } } } - msgNotify("Copying initial device files.."); - /* Copy the boot floppy's dev files */ - if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio %s -pdum /mnt", cpioVerbosity())) { - msgConfirm("Couldn't clone the /dev files!"); - return DITEM_FAILURE; + if (RunningAsInit) { + msgNotify("Copying initial device files.."); + /* Copy the boot floppy's dev files */ + if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio %s -pdum /mnt", cpioVerbosity())) { + msgConfirm("Couldn't clone the /dev files!"); + return DITEM_FAILURE; + } } - + command_sort(); command_execute(); return DITEM_SUCCESS; diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index c82896e..fb66e3a 100644 --- a/usr.sbin/sysinstall/disks.c +++ b/usr.sbin/sysinstall/disks.c @@ -389,8 +389,7 @@ diskPartition(Device *dev, Disk *d) * disk (i.e., the disklabel 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 ((d->chunks->part->flags & CHUNK_FORCE_ALL) != CHUNK_FORCE_ALL - && (mbrContents = getBootMgr(d->name)) != NULL) + if (!(d->chunks->part->flags & CHUNK_FORCE_ALL) && (mbrContents = getBootMgr(d->name)) != NULL) Set_Boot_Mgr(d, mbrContents); if (DITEM_STATUS(diskPartitionWrite(NULL)) != DITEM_SUCCESS) diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index 0b44fcc..af9d364 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -662,7 +662,7 @@ installCommit(dialogMenuItem *self) { int i; char *str; - Boolean need_bin = FALSE; + Boolean need_bin; if (!Dists) { if (!msgYesNo("No distributions are selected for installation! Do you\n" @@ -702,13 +702,10 @@ installCommit(dialogMenuItem *self) return i; } - if (Dists & DIST_BIN) - need_bin = TRUE; + need_bin = Dists & DIST_BIN; i = distExtractAll(self); - if (DITEM_STATUS(i) == DITEM_SUCCESS) { - if (!need_bin || !(Dists & DIST_BIN)) - i = installFixup(self); - } + if (DITEM_STATUS(i) == DITEM_SUCCESS && (!need_bin || !(Dists & DIST_BIN))) + i = installFixup(self); variable_set2(SYSTEM_STATE, DITEM_STATUS(i) == DITEM_FAILURE ? "error-install" : "full-install"); return i | DITEM_RECREATE; } @@ -838,7 +835,7 @@ installFilesystems(dialogMenuItem *self) command_clear(); upgrade = str && !strcmp(str, "upgrade"); - if (swapdev) { + if (swapdev && RunningAsInit) { /* As the very first thing, try to get ourselves some swap space */ sprintf(dname, "/dev/%s", swapdev->name); if (!Fake && (!MakeDevChunk(swapdev, "/dev") || !file_readable(dname))) { @@ -857,7 +854,7 @@ installFilesystems(dialogMenuItem *self) } } - if (rootdev) { + if (rootdev && RunningAsInit) { /* Next, create and/or mount the root device */ sprintf(dname, "/dev/r%sa", rootdev->disk->name); if (!Fake && (!MakeDevChunk(rootdev, "/dev") || !file_readable(dname))) { @@ -910,11 +907,13 @@ installFilesystems(dialogMenuItem *self) msgConfirm("No chunk list found for %s!", disk->name); return DITEM_FAILURE; } - if (root && (root->newfs || upgrade)) { + if (RunningAsInit && root && (root->newfs || upgrade)) { Mkdir("/mnt/dev"); if (!Fake) MakeDevDisk(disk, "/mnt/dev"); } + else if (!RunningAsInit && !Fake) + MakeDevDisk(disk, "/dev"); for (c1 = disk->chunks->part; c1; c1 = c1->next) { if (c1->type == freebsd) { @@ -927,9 +926,9 @@ installFilesystems(dialogMenuItem *self) continue; if (tmp->newfs) - command_shell_add(tmp->mountpoint, "%s /mnt/dev/r%s", tmp->newfs_cmd, c2->name); + command_shell_add(tmp->mountpoint, "%s %s/dev/r%s", tmp->newfs_cmd, RunningAsInit ? "/mnt" : "", c2->name); else - command_shell_add(tmp->mountpoint, "fsck -y /mnt/dev/r%s", c2->name); + command_shell_add(tmp->mountpoint, "fsck -y %s/dev/r%s", RunningAsInit ? "/mnt" : "", c2->name); command_func_add(tmp->mountpoint, Mount, c2->name); } else if (c2->type == part && c2->subtype == FS_SWAP) { @@ -938,7 +937,7 @@ installFilesystems(dialogMenuItem *self) if (c2 == swapdev) continue; - sprintf(fname, "/mnt/dev/%s", c2->name); + sprintf(fname, "%s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name); i = (Fake || swapon(fname)); if (!i) msgNotify("Added %s as an additional swap device", fname); @@ -950,19 +949,21 @@ installFilesystems(dialogMenuItem *self) else if (c1->type == fat && c1->private_data && (root->newfs || upgrade)) { char name[FILENAME_MAX]; - sprintf(name, "/mnt%s", ((PartInfo *)c1->private_data)->mountpoint); + sprintf(name, "%s/%s", RunningAsInit ? "/mnt" : "", ((PartInfo *)c1->private_data)->mountpoint); Mkdir(name); } } } - msgNotify("Copying initial device files.."); - /* Copy the boot floppy's dev files */ - if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio %s -pdum /mnt", cpioVerbosity())) { - msgConfirm("Couldn't clone the /dev files!"); - return DITEM_FAILURE; + if (RunningAsInit) { + msgNotify("Copying initial device files.."); + /* Copy the boot floppy's dev files */ + if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio %s -pdum /mnt", cpioVerbosity())) { + msgConfirm("Couldn't clone the /dev files!"); + return DITEM_FAILURE; + } } - + command_sort(); command_execute(); return DITEM_SUCCESS; -- cgit v1.1