From 48800325a6a9e7ba5cce316eeb986b2b0d6e31d3 Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Tue, 25 Jun 1996 18:41:10 +0000 Subject: [PATCH] Make "Fake" turn off more potentially system-nuking options. --- release/sysinstall/disks.c | 16 +++++++++------- release/sysinstall/install.c | 15 ++++++++------- release/sysinstall/misc.c | 7 +++++-- usr.sbin/sade/disks.c | 16 +++++++++------- usr.sbin/sade/install.c | 15 ++++++++------- usr.sbin/sade/misc.c | 7 +++++-- usr.sbin/sysinstall/disks.c | 16 +++++++++------- usr.sbin/sysinstall/install.c | 15 ++++++++------- usr.sbin/sysinstall/misc.c | 7 +++++-- 9 files changed, 66 insertions(+), 48 deletions(-) diff --git a/release/sysinstall/disks.c b/release/sysinstall/disks.c index f6d899d71771..cf8ee980b371 100644 --- a/release/sysinstall/disks.c +++ b/release/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.50 1996/06/08 09:08:32 jkh Exp $ + * $Id: disks.c,v 1.51 1996/06/11 13:07:57 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -543,12 +543,14 @@ diskPartitionWrite(dialogMenuItem *self) int ret; msgNotify("Running bad block scan on partition %s", c1->name); - ret = vsystem("bad144 -v /dev/r%s 1234", c1->name); - if (ret) - msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret); - ret = vsystem("bad144 -v -s /dev/r%s", c1->name); - if (ret) - msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret); + if (!Fake) { + ret = vsystem("bad144 -v /dev/r%s 1234", c1->name); + if (ret) + msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret); + ret = vsystem("bad144 -v -s /dev/r%s", c1->name); + if (ret) + msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret); + } } } } diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c index 17e2442d89f2..5a7252c4b04a 100644 --- a/release/sysinstall/install.c +++ b/release/sysinstall/install.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: install.c,v 1.101 1996/06/13 17:36:28 jkh Exp $ + * $Id: install.c,v 1.102 1996/06/14 14:33:55 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -658,21 +658,21 @@ installFilesystems(dialogMenuItem *self) /* As the very first thing, try to get ourselves some swap space */ sprintf(dname, "/dev/%s", swapdev->name); - if (!MakeDevChunk(swapdev, "/dev") || !file_readable(dname)) { + if (!Fake && (!MakeDevChunk(swapdev, "/dev") || !file_readable(dname))) { msgConfirm("Unable to make device node for %s in /dev!\n" "The creation of filesystems will be aborted.", dname); return DITEM_FAILURE; } - if (!swapon(dname)) + if (!Fake && !swapon(dname)) msgNotify("Added %s as initial swap device", dname); - else + else if (!Fake) msgConfirm("WARNING! Unable to swap to %s: %s\n" "This may cause the installation to fail at some point\n" "if you don't have a lot of memory.", dname, strerror(errno)); /* Next, create and/or mount the root device */ sprintf(dname, "/dev/r%sa", rootdev->disk->name); - if (!MakeDevChunk(rootdev, "/dev") || !file_readable(dname)) { + if (!Fake && (!MakeDevChunk(rootdev, "/dev") || !file_readable(dname))) { msgConfirm("Unable to make device node for %s in /dev!\n" "The creation of filesystems will be aborted.", dname); return DITEM_FAILURE; @@ -723,7 +723,8 @@ installFilesystems(dialogMenuItem *self) } if (root->newfs || upgrade) { Mkdir("/mnt/dev", NULL); - MakeDevDisk(disk, "/mnt/dev"); + if (!Fake) + MakeDevDisk(disk, "/mnt/dev"); } for (c1 = disk->chunks->part; c1; c1 = c1->next) { @@ -749,7 +750,7 @@ installFilesystems(dialogMenuItem *self) if (c2 == swapdev) continue; sprintf(fname, "/mnt/dev/%s", c2->name); - i = swapon(fname); + i = (Fake || swapon(fname)); if (!i) msgNotify("Added %s as an additional swap device", fname); else diff --git a/release/sysinstall/misc.c b/release/sysinstall/misc.c index 559990a0948c..1c737cb794de 100644 --- a/release/sysinstall/misc.c +++ b/release/sysinstall/misc.c @@ -1,7 +1,7 @@ /* * Miscellaneous support routines.. * - * $Id: misc.c,v 1.18 1996/04/28 03:27:21 jkh Exp $ + * $Id: misc.c,v 1.19 1996/06/17 21:48:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -255,7 +255,7 @@ Mkdir(char *ipath, void *data) int final=0; char *p, *path; - if (file_readable(ipath)) + if (file_readable(ipath) || Fake) return DITEM_SUCCESS; path = strdup(ipath); @@ -295,6 +295,9 @@ Mount(char *mountp, void *dev) char device[80]; char mountpoint[FILENAME_MAX]; + if (Fake) + return DITEM_SUCCESS; + if (*((char *)dev) != '/') { sprintf(device, "/mnt/dev/%s", (char *)dev); sprintf(mountpoint, "/mnt%s", mountp); diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c index f6d899d71771..cf8ee980b371 100644 --- a/usr.sbin/sade/disks.c +++ b/usr.sbin/sade/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.50 1996/06/08 09:08:32 jkh Exp $ + * $Id: disks.c,v 1.51 1996/06/11 13:07:57 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -543,12 +543,14 @@ diskPartitionWrite(dialogMenuItem *self) int ret; msgNotify("Running bad block scan on partition %s", c1->name); - ret = vsystem("bad144 -v /dev/r%s 1234", c1->name); - if (ret) - msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret); - ret = vsystem("bad144 -v -s /dev/r%s", c1->name); - if (ret) - msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret); + if (!Fake) { + ret = vsystem("bad144 -v /dev/r%s 1234", c1->name); + if (ret) + msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret); + ret = vsystem("bad144 -v -s /dev/r%s", c1->name); + if (ret) + msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret); + } } } } diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 17e2442d89f2..5a7252c4b04a 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: install.c,v 1.101 1996/06/13 17:36:28 jkh Exp $ + * $Id: install.c,v 1.102 1996/06/14 14:33:55 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -658,21 +658,21 @@ installFilesystems(dialogMenuItem *self) /* As the very first thing, try to get ourselves some swap space */ sprintf(dname, "/dev/%s", swapdev->name); - if (!MakeDevChunk(swapdev, "/dev") || !file_readable(dname)) { + if (!Fake && (!MakeDevChunk(swapdev, "/dev") || !file_readable(dname))) { msgConfirm("Unable to make device node for %s in /dev!\n" "The creation of filesystems will be aborted.", dname); return DITEM_FAILURE; } - if (!swapon(dname)) + if (!Fake && !swapon(dname)) msgNotify("Added %s as initial swap device", dname); - else + else if (!Fake) msgConfirm("WARNING! Unable to swap to %s: %s\n" "This may cause the installation to fail at some point\n" "if you don't have a lot of memory.", dname, strerror(errno)); /* Next, create and/or mount the root device */ sprintf(dname, "/dev/r%sa", rootdev->disk->name); - if (!MakeDevChunk(rootdev, "/dev") || !file_readable(dname)) { + if (!Fake && (!MakeDevChunk(rootdev, "/dev") || !file_readable(dname))) { msgConfirm("Unable to make device node for %s in /dev!\n" "The creation of filesystems will be aborted.", dname); return DITEM_FAILURE; @@ -723,7 +723,8 @@ installFilesystems(dialogMenuItem *self) } if (root->newfs || upgrade) { Mkdir("/mnt/dev", NULL); - MakeDevDisk(disk, "/mnt/dev"); + if (!Fake) + MakeDevDisk(disk, "/mnt/dev"); } for (c1 = disk->chunks->part; c1; c1 = c1->next) { @@ -749,7 +750,7 @@ installFilesystems(dialogMenuItem *self) if (c2 == swapdev) continue; sprintf(fname, "/mnt/dev/%s", c2->name); - i = swapon(fname); + i = (Fake || swapon(fname)); if (!i) msgNotify("Added %s as an additional swap device", fname); else diff --git a/usr.sbin/sade/misc.c b/usr.sbin/sade/misc.c index 559990a0948c..1c737cb794de 100644 --- a/usr.sbin/sade/misc.c +++ b/usr.sbin/sade/misc.c @@ -1,7 +1,7 @@ /* * Miscellaneous support routines.. * - * $Id: misc.c,v 1.18 1996/04/28 03:27:21 jkh Exp $ + * $Id: misc.c,v 1.19 1996/06/17 21:48:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -255,7 +255,7 @@ Mkdir(char *ipath, void *data) int final=0; char *p, *path; - if (file_readable(ipath)) + if (file_readable(ipath) || Fake) return DITEM_SUCCESS; path = strdup(ipath); @@ -295,6 +295,9 @@ Mount(char *mountp, void *dev) char device[80]; char mountpoint[FILENAME_MAX]; + if (Fake) + return DITEM_SUCCESS; + if (*((char *)dev) != '/') { sprintf(device, "/mnt/dev/%s", (char *)dev); sprintf(mountpoint, "/mnt%s", mountp); diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index f6d899d71771..cf8ee980b371 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.50 1996/06/08 09:08:32 jkh Exp $ + * $Id: disks.c,v 1.51 1996/06/11 13:07:57 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -543,12 +543,14 @@ diskPartitionWrite(dialogMenuItem *self) int ret; msgNotify("Running bad block scan on partition %s", c1->name); - ret = vsystem("bad144 -v /dev/r%s 1234", c1->name); - if (ret) - msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret); - ret = vsystem("bad144 -v -s /dev/r%s", c1->name); - if (ret) - msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret); + if (!Fake) { + ret = vsystem("bad144 -v /dev/r%s 1234", c1->name); + if (ret) + msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret); + ret = vsystem("bad144 -v -s /dev/r%s", c1->name); + if (ret) + msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret); + } } } } diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index 17e2442d89f2..5a7252c4b04a 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: install.c,v 1.101 1996/06/13 17:36:28 jkh Exp $ + * $Id: install.c,v 1.102 1996/06/14 14:33:55 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -658,21 +658,21 @@ installFilesystems(dialogMenuItem *self) /* As the very first thing, try to get ourselves some swap space */ sprintf(dname, "/dev/%s", swapdev->name); - if (!MakeDevChunk(swapdev, "/dev") || !file_readable(dname)) { + if (!Fake && (!MakeDevChunk(swapdev, "/dev") || !file_readable(dname))) { msgConfirm("Unable to make device node for %s in /dev!\n" "The creation of filesystems will be aborted.", dname); return DITEM_FAILURE; } - if (!swapon(dname)) + if (!Fake && !swapon(dname)) msgNotify("Added %s as initial swap device", dname); - else + else if (!Fake) msgConfirm("WARNING! Unable to swap to %s: %s\n" "This may cause the installation to fail at some point\n" "if you don't have a lot of memory.", dname, strerror(errno)); /* Next, create and/or mount the root device */ sprintf(dname, "/dev/r%sa", rootdev->disk->name); - if (!MakeDevChunk(rootdev, "/dev") || !file_readable(dname)) { + if (!Fake && (!MakeDevChunk(rootdev, "/dev") || !file_readable(dname))) { msgConfirm("Unable to make device node for %s in /dev!\n" "The creation of filesystems will be aborted.", dname); return DITEM_FAILURE; @@ -723,7 +723,8 @@ installFilesystems(dialogMenuItem *self) } if (root->newfs || upgrade) { Mkdir("/mnt/dev", NULL); - MakeDevDisk(disk, "/mnt/dev"); + if (!Fake) + MakeDevDisk(disk, "/mnt/dev"); } for (c1 = disk->chunks->part; c1; c1 = c1->next) { @@ -749,7 +750,7 @@ installFilesystems(dialogMenuItem *self) if (c2 == swapdev) continue; sprintf(fname, "/mnt/dev/%s", c2->name); - i = swapon(fname); + i = (Fake || swapon(fname)); if (!i) msgNotify("Added %s as an additional swap device", fname); else diff --git a/usr.sbin/sysinstall/misc.c b/usr.sbin/sysinstall/misc.c index 559990a0948c..1c737cb794de 100644 --- a/usr.sbin/sysinstall/misc.c +++ b/usr.sbin/sysinstall/misc.c @@ -1,7 +1,7 @@ /* * Miscellaneous support routines.. * - * $Id: misc.c,v 1.18 1996/04/28 03:27:21 jkh Exp $ + * $Id: misc.c,v 1.19 1996/06/17 21:48:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -255,7 +255,7 @@ Mkdir(char *ipath, void *data) int final=0; char *p, *path; - if (file_readable(ipath)) + if (file_readable(ipath) || Fake) return DITEM_SUCCESS; path = strdup(ipath); @@ -295,6 +295,9 @@ Mount(char *mountp, void *dev) char device[80]; char mountpoint[FILENAME_MAX]; + if (Fake) + return DITEM_SUCCESS; + if (*((char *)dev) != '/') { sprintf(device, "/mnt/dev/%s", (char *)dev); sprintf(mountpoint, "/mnt%s", mountp);