summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authormatusita <matusita@FreeBSD.org>2001-12-02 04:47:46 +0000
committermatusita <matusita@FreeBSD.org>2001-12-02 04:47:46 +0000
commitbf876280398626fe18ca702a44809c2fbd111e1f (patch)
tree0a12ccb525f0aa6ddade8c0433580f7a389fa195 /usr.sbin
parent6e91b14e51cd98d698f1c679747ab06f3be7a8dd (diff)
downloadFreeBSD-src-bf876280398626fe18ca702a44809c2fbd111e1f.zip
FreeBSD-src-bf876280398626fe18ca702a44809c2fbd111e1f.tar.gz
Sysinstall cleanups for installation:
1) Use devfs to mount filesystems. If mounting devfs is fail, fallback to old code. 2) When fscking filesystems, use 'fsck_ffs' explicitly. As a result, we no longer need 'fsck' the wrapper program. Reviewed by: jkh
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/install.c47
-rw-r--r--usr.sbin/sysinstall/install.c47
2 files changed, 56 insertions, 38 deletions
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index b2399f8..6b5a6b1 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -849,7 +849,7 @@ installFixupXFree(dialogMenuItem *self)
int
installFilesystems(dialogMenuItem *self)
{
- int i;
+ int i, mountfailed;
Disk *disk;
Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev;
Device **devs;
@@ -924,7 +924,7 @@ installFilesystems(dialogMenuItem *self)
}
dialog_clear_norefresh();
msgNotify("Checking integrity of existing %s filesystem.", dname);
- i = vsystem("fsck -y %s", dname);
+ i = vsystem("fsck_ffs -y %s", dname);
if (i)
msgConfirm("Warning: fsck returned status of %d for %s.\n"
"This partition may be unsafe to use.", i, dname);
@@ -941,6 +941,21 @@ installFilesystems(dialogMenuItem *self)
msgConfirm("Unable to mount the root file system on %s! Giving up.", dname);
return DITEM_FAILURE | DITEM_RESTORE;
}
+
+ /* Mount devfs for other partitions to mount */
+ Mkdir("/mnt/dev");
+ if (!Fake)
+ mountfailed = mount("devfs", "/mnt/dev", 0, NULL);
+
+ if (mountfailed) {
+ dialog_clear_norefresh();
+ 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 | DITEM_RESTORE;
+ }
+ }
}
/* Now buzz through the rest of the partitions and mount them too */
@@ -954,13 +969,15 @@ installFilesystems(dialogMenuItem *self)
msgConfirm("No chunk list found for %s!", disk->name);
return DITEM_FAILURE | DITEM_RESTORE;
}
- if (RunningAsInit && root && (root->newfs || upgrade)) {
- Mkdir("/mnt/dev");
- if (!Fake)
- MakeDevDisk(disk, "/mnt/dev");
+ if (mountfailed) {
+ if (RunningAsInit && root && (root->newfs || upgrade)) {
+ Mkdir("/mnt/dev");
+ if (!Fake)
+ MakeDevDisk(disk, "/mnt/dev");
+ }
+ else if (!RunningAsInit && !Fake)
+ MakeDevDisk(disk, "/dev");
}
- else if (!RunningAsInit && !Fake)
- MakeDevDisk(disk, "/dev");
for (c1 = disk->chunks->part; c1; c1 = c1->next) {
if (c1->type == freebsd) {
@@ -975,7 +992,7 @@ installFilesystems(dialogMenuItem *self)
if (tmp->newfs && (!upgrade || !msgNoYes("You are upgrading - are you SURE you want to newfs /dev/%s?", c2->name)))
command_shell_add(tmp->mountpoint, "%s %s/dev/%s", tmp->newfs_cmd, RunningAsInit ? "/mnt" : "", c2->name);
else
- command_shell_add(tmp->mountpoint, "fsck -y %s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
+ command_shell_add(tmp->mountpoint, "fsck_ffs -y %s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
if (tmp->soft)
command_shell_add(tmp->mountpoint, "tunefs -n enable %s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
command_func_add(tmp->mountpoint, Mount, c2->name);
@@ -1007,18 +1024,10 @@ installFilesystems(dialogMenuItem *self)
}
}
- if (RunningAsInit) {
- dialog_clear_norefresh();
- 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 | DITEM_RESTORE;
- }
- }
-
command_sort();
command_execute();
+ if (!mountfailed && !Fake)
+ unmount("/mnt/dev", MNT_FORCE);
dialog_clear_norefresh();
return DITEM_SUCCESS | DITEM_RESTORE;
}
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index b2399f8..6b5a6b1 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/sysinstall/install.c
@@ -849,7 +849,7 @@ installFixupXFree(dialogMenuItem *self)
int
installFilesystems(dialogMenuItem *self)
{
- int i;
+ int i, mountfailed;
Disk *disk;
Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev;
Device **devs;
@@ -924,7 +924,7 @@ installFilesystems(dialogMenuItem *self)
}
dialog_clear_norefresh();
msgNotify("Checking integrity of existing %s filesystem.", dname);
- i = vsystem("fsck -y %s", dname);
+ i = vsystem("fsck_ffs -y %s", dname);
if (i)
msgConfirm("Warning: fsck returned status of %d for %s.\n"
"This partition may be unsafe to use.", i, dname);
@@ -941,6 +941,21 @@ installFilesystems(dialogMenuItem *self)
msgConfirm("Unable to mount the root file system on %s! Giving up.", dname);
return DITEM_FAILURE | DITEM_RESTORE;
}
+
+ /* Mount devfs for other partitions to mount */
+ Mkdir("/mnt/dev");
+ if (!Fake)
+ mountfailed = mount("devfs", "/mnt/dev", 0, NULL);
+
+ if (mountfailed) {
+ dialog_clear_norefresh();
+ 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 | DITEM_RESTORE;
+ }
+ }
}
/* Now buzz through the rest of the partitions and mount them too */
@@ -954,13 +969,15 @@ installFilesystems(dialogMenuItem *self)
msgConfirm("No chunk list found for %s!", disk->name);
return DITEM_FAILURE | DITEM_RESTORE;
}
- if (RunningAsInit && root && (root->newfs || upgrade)) {
- Mkdir("/mnt/dev");
- if (!Fake)
- MakeDevDisk(disk, "/mnt/dev");
+ if (mountfailed) {
+ if (RunningAsInit && root && (root->newfs || upgrade)) {
+ Mkdir("/mnt/dev");
+ if (!Fake)
+ MakeDevDisk(disk, "/mnt/dev");
+ }
+ else if (!RunningAsInit && !Fake)
+ MakeDevDisk(disk, "/dev");
}
- else if (!RunningAsInit && !Fake)
- MakeDevDisk(disk, "/dev");
for (c1 = disk->chunks->part; c1; c1 = c1->next) {
if (c1->type == freebsd) {
@@ -975,7 +992,7 @@ installFilesystems(dialogMenuItem *self)
if (tmp->newfs && (!upgrade || !msgNoYes("You are upgrading - are you SURE you want to newfs /dev/%s?", c2->name)))
command_shell_add(tmp->mountpoint, "%s %s/dev/%s", tmp->newfs_cmd, RunningAsInit ? "/mnt" : "", c2->name);
else
- command_shell_add(tmp->mountpoint, "fsck -y %s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
+ command_shell_add(tmp->mountpoint, "fsck_ffs -y %s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
if (tmp->soft)
command_shell_add(tmp->mountpoint, "tunefs -n enable %s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
command_func_add(tmp->mountpoint, Mount, c2->name);
@@ -1007,18 +1024,10 @@ installFilesystems(dialogMenuItem *self)
}
}
- if (RunningAsInit) {
- dialog_clear_norefresh();
- 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 | DITEM_RESTORE;
- }
- }
-
command_sort();
command_execute();
+ if (!mountfailed && !Fake)
+ unmount("/mnt/dev", MNT_FORCE);
dialog_clear_norefresh();
return DITEM_SUCCESS | DITEM_RESTORE;
}
OpenPOWER on IntegriCloud