From 590017a61ca58be6918c7060127977c51861c36b Mon Sep 17 00:00:00 2001 From: jkh Date: Sun, 28 Apr 1996 20:54:11 +0000 Subject: Add a new -fake argument to make sysinstall not actually change things while I'm testing it. --- usr.sbin/sade/config.c | 22 +++++++++++----------- usr.sbin/sade/disks.c | 4 ++-- usr.sbin/sade/globals.c | 16 +++++++++------- usr.sbin/sade/install.c | 12 +++++++----- usr.sbin/sade/main.c | 14 ++++++++++---- usr.sbin/sade/sade.h | 3 ++- usr.sbin/sade/system.c | 13 +++++++++++-- usr.sbin/sade/wizard.c | 4 ++-- 8 files changed, 54 insertions(+), 34 deletions(-) (limited to 'usr.sbin/sade') diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c index 22fc801..c195602 100644 --- a/usr.sbin/sade/config.c +++ b/usr.sbin/sade/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.26 1996/04/28 01:07:21 jkh Exp $ + * $Id: config.c,v 1.27 1996/04/28 03:26:46 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -581,16 +581,16 @@ configNFSServer(dialogMenuItem *self) "an /etc/exports file to indicate which hosts are allowed certain\n" "kinds of access to your local file systems.\n" "Press [ENTER] now to invoke an editor on /etc/exports\n"); - system("echo '#The following examples export /usr to 3 machines named after ducks,' > /etc/exports"); - system("echo '#/home and all directories under it to machines named after dead rock stars' >> /etc/exports"); - system("echo '#and, finally, /a to 2 privileged machines allowed to write on it as root.' >> /etc/exports"); - system("echo '#/usr huey louie dewie' >> /etc/exports"); - system("echo '#/home -alldirs janice jimmy frank' >> /etc/exports"); - system("echo '#/a -maproot=0 bill albert' >> /etc/exports"); - system("echo '#' >> /etc/exports"); - system("echo '# You should replace these lines with your actual exported filesystems.' >> /etc/exports"); - system("echo >> /etc/exports"); - sprintf(cmd, "%s /etc/exports", variable_get(VAR_EDITOR)); + vsystem("echo '#The following examples export /usr to 3 machines named after ducks,' > /etc/exports"); + vsystem("echo '#/home and all directories under it to machines named after dead rock stars' >> /etc/exports"); + vsystem("echo '#and, finally, /a to 2 privileged machines allowed to write on it as root.' >> /etc/exports"); + vsystem("echo '#/usr huey louie dewie' >> /etc/exports"); + vsystem("echo '#/home -alldirs janice jimmy frank' >> /etc/exports"); + vsystem("echo '#/a -maproot=0 bill albert' >> /etc/exports"); + vsystem("echo '#' >> /etc/exports"); + vsystem("echo '# You should replace these lines with your actual exported filesystems.' >> /etc/exports"); + vsystem("echo >> /etc/exports"); + vsprintf(cmd, "%s /etc/exports", variable_get(VAR_EDITOR)); dialog_clear(); systemExecute(cmd); restorescr(w); diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c index 0c62dac..79f5881 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.43 1996/04/28 00:37:28 jkh Exp $ + * $Id: disks.c,v 1.44 1996/04/28 03:26:49 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -502,7 +502,7 @@ diskPartitionWrite(dialogMenuItem *self) Set_Boot_Blocks(d, boot1, boot2); msgNotify("Writing partition information to drive %s", d->name); - if (Write_Disk(d)) { + if (!Fake && Write_Disk(d)) { msgConfirm("ERROR: Unable to write data to disk %s!", d->name); return DITEM_FAILURE; } diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c index c528b63..7e10877 100644 --- a/usr.sbin/sade/globals.c +++ b/usr.sbin/sade/globals.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: globals.c,v 1.11 1995/12/07 10:33:50 peter Exp $ + * $Id: globals.c,v 1.12 1996/04/13 13:31:38 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -41,14 +41,15 @@ * whatever values we feel are appropriate. */ -int DebugFD; /* Where diagnostic output goes */ +int DebugFD; /* Where diagnostic output goes */ +Boolean Fake; /* Only pretend to be useful */ Boolean RunningAsInit; /* Are we running as init? */ -Boolean DialogActive; -Boolean ColorDisplay; -Boolean OnVTY; -Variable *VarHead; /* The head of the variable chain */ +Boolean DialogActive; /* Is libdialog initialized? */ +Boolean ColorDisplay; /* Are we on a color display? */ +Boolean OnVTY; /* Are we on a VTY? */ +Variable *VarHead; /* The head of the variable chain */ Device *mediaDevice; /* Where we're installing from */ -int BootMgr; +int BootMgr; /* Which boot manager we're using */ /* * Yes, I know some of these are already automatically initialized as @@ -59,6 +60,7 @@ globalsInit(void) { DebugFD = -1; ColorDisplay = FALSE; + Fake = FALSE; OnVTY = FALSE; DialogActive = FALSE; VarHead = NULL; diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 524b5c1..ce36a3a 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.88 1996/04/28 01:07:22 jkh Exp $ + * $Id: install.c,v 1.89 1996/04/28 03:27:02 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -159,7 +159,8 @@ installInitial(void) return DITEM_SUCCESS; if (!variable_get(DISK_LABELLED)) { - msgConfirm("You need to assign disk labels before you can proceed with\nthe installation."); + msgConfirm("You need to assign disk labels before you can proceed with\n" + "the installation."); return DITEM_FAILURE; } /* If it's labelled, assume it's also partitioned */ @@ -518,7 +519,7 @@ installFixup(dialogMenuItem *self) if (!file_readable("/kernel")) { if (file_readable("/kernel.GENERIC")) { - if (system("cp -p /kernel.GENERIC /kernel")) { + if (vsystem("cp -p /kernel.GENERIC /kernel")) { msgConfirm("Unable to link /kernel into place!"); return DITEM_FAILURE; } @@ -567,8 +568,8 @@ installFixup(dialogMenuItem *self) msgNotify("Fixing permissions.."); /* BOGON #1: XFree86 extracting /usr/X11R6 with root-only perms */ if (directory_exists("/usr/X11R6")) { - system("chmod -R a+r /usr/X11R6"); - system("find /usr/X11R6 -type d | xargs chmod a+x"); + vsystem("chmod -R a+r /usr/X11R6"); + vsystem("find /usr/X11R6 -type d | xargs chmod a+x"); } /* BOGON #2: We leave /etc in a bad state */ chmod("/etc", 0755); @@ -729,6 +730,7 @@ installFilesystems(dialogMenuItem *self) return DITEM_SUCCESS; } +/* Initialize various user-settable values to their defaults */ int installVarDefaults(dialogMenuItem *self) { diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c index f956d13..deb8524 100644 --- a/usr.sbin/sade/main.c +++ b/usr.sbin/sade/main.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated for what's essentially a complete rewrite. * - * $Id: main.c,v 1.16 1996/04/07 03:52:31 jkh Exp $ + * $Id: main.c,v 1.17 1996/04/13 13:31:51 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -65,6 +65,15 @@ main(int argc, char **argv) /* Set up whatever things need setting up */ systemInitialize(argc, argv); + /* Set default flag and variable values */ + installVarDefaults(NULL); + + if (argc > 1 && !strcmp(argv[1], "-fake")) { + variable_set2(VAR_DEBUG, "YES"); + Fake = TRUE; + msgConfirm("I'll be just faking it from here on out, OK?"); + } + /* Try to preserve our scroll-back buffer */ if (OnVTY) for (curr = 0; curr < 25; curr++) @@ -73,9 +82,6 @@ main(int argc, char **argv) /* Probe for all relevant devices on the system */ deviceGetAll(); - /* Set default flag and variable values */ - installVarDefaults(NULL); - /* Begin user dialog at outer menu */ while (1) { choice = scroll = curr = max = 0; diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 6265641..0ae5544 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.53 1996/04/28 00:37:36 jkh Exp $ + * $Id: sysinstall.h,v 1.54 1996/04/28 01:07:26 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -264,6 +264,7 @@ typedef struct _devPriv { /*** Externs ***/ extern int DebugFD; /* Where diagnostic output goes */ +extern Boolean Fake; /* Don't actually modify anything - testing */ extern Boolean SystemWasInstalled; /* Did we install it? */ extern Boolean RunningAsInit; /* Are we running stand-alone? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index adb89e8..ff448eb 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.54 1996/04/28 01:07:27 jkh Exp $ + * $Id: system.c,v 1.55 1996/04/28 03:27:26 jkh Exp $ * * Jordan Hubbard * @@ -109,7 +109,12 @@ systemExecute(char *command) foo.c_cc[VERASE] = '\010'; tcsetattr(0, TCSANOW, &foo); } - status = system(command); + if (!Fake) + status = system(command); + else { + status = 0; + msgDebug("systemExecute: Faked execution of `%s'\n", command); + } DialogActive = TRUE; return status; } @@ -199,6 +204,10 @@ vsystem(char *fmt, ...) va_end(args); omask = sigblock(sigmask(SIGCHLD)); + if (Fake) { + msgDebug("vsystem: Faked execution of `%s'\n", cmd); + return 0; + } if (isDebug()) msgDebug("Executing command `%s'\n", cmd); pid = fork(); diff --git a/usr.sbin/sade/wizard.c b/usr.sbin/sade/wizard.c index 66e2233..ae6dc78 100644 --- a/usr.sbin/sade/wizard.c +++ b/usr.sbin/sade/wizard.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: wizard.c,v 1.6.2.1 1995/09/20 10:43:13 jkh Exp $ + * $Id: wizard.c,v 1.7 1995/12/07 10:34:25 peter Exp $ * */ @@ -208,7 +208,7 @@ slice_wizard(Disk *d) } if (!strcasecmp(*cmds,"write")) { printf("Write=%d\n", - Write_Disk(d)); + Fake ? 0 : Write_Disk(d)); Free_Disk(d); d = Open_Disk(d->name); continue; -- cgit v1.1