diff options
author | jkh <jkh@FreeBSD.org> | 1997-06-13 07:11:57 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1997-06-13 07:11:57 +0000 |
commit | 73c96a1380ede1b7dc15e8114e47cc49317c5846 (patch) | |
tree | 100aca573ab1a6364a2714f7913a1a3c3a4254b3 | |
parent | 6e0b43d4642048cb4c9976ee9d554af5368a9f04 (diff) | |
download | FreeBSD-src-73c96a1380ede1b7dc15e8114e47cc49317c5846.zip FreeBSD-src-73c96a1380ede1b7dc15e8114e47cc49317c5846.tar.gz |
YAMF22
-rw-r--r-- | release/sysinstall/install.c | 3 | ||||
-rw-r--r-- | release/sysinstall/misc.c | 4 | ||||
-rw-r--r-- | release/sysinstall/variable_load.c | 102 | ||||
-rw-r--r-- | usr.sbin/sade/install.c | 3 | ||||
-rw-r--r-- | usr.sbin/sade/misc.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/install.c | 3 | ||||
-rw-r--r-- | usr.sbin/sysinstall/misc.c | 4 |
7 files changed, 80 insertions, 43 deletions
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c index ac46c65..0557f21 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.186 1997/05/22 04:04:30 jkh Exp $ + * $Id: install.c,v 1.187 1997/05/30 01:03:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -968,6 +968,7 @@ installVarDefaults(dialogMenuItem *self) variable_set2(VAR_CPIO_VERBOSITY, "high"); variable_set2(VAR_TAPE_BLOCKSIZE, DEFAULT_TAPE_BLOCKSIZE); variable_set2(VAR_INSTALL_ROOT, "/"); + variable_set2(VAR_INSTALL_CFG, "install.cfg"); cp = getenv("EDITOR"); if (!cp) cp = "/usr/bin/ee"; diff --git a/release/sysinstall/misc.c b/release/sysinstall/misc.c index 93835fc..c5d7316 100644 --- a/release/sysinstall/misc.c +++ b/release/sysinstall/misc.c @@ -1,7 +1,7 @@ /* * Miscellaneous support routines.. * - * $Id: misc.c,v 1.33 1997/03/09 22:25:47 jkh Exp $ + * $Id: misc.c,v 1.34 1997/04/03 13:44:59 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -227,7 +227,7 @@ root_bias(char *path) } /* - * These next routines are kind of specialized just for building string lists + * These next routines are kind of specialized just for building item lists * for dialog_menu(). */ diff --git a/release/sysinstall/variable_load.c b/release/sysinstall/variable_load.c index b221441..f48e4a5 100644 --- a/release/sysinstall/variable_load.c +++ b/release/sysinstall/variable_load.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: variable_load.c,v 1.5 1997/05/22 22:11:17 pst Exp $ + * $Id: variable_load.c,v 1.6 1997/06/05 09:48:03 jkh Exp $ * * Copyright (c) 1997 * Paul Traina. All rights reserved. @@ -38,14 +38,41 @@ #include <sys/signal.h> #include <sys/fcntl.h> +/* Add a string to a string list */ +static char ** +string_add(char **list, char *str, int *curr, int *max) +{ + + if (*curr == *max) { + *max += 20; + list = (char **)realloc(list, sizeof(char *) * *max); + } + list[(*curr)++] = strdup(str); + return list; +} + +/* Toss the strings out */ +static void +strings_free(char **list, int *curr, int *max) +{ + int i; + + for (i = 0; i < *curr; i++) + free(list[i]); + free(list); + *curr = *max = 0; +} + int -variableLoad(dialogMenuItem * self) +variableLoad(dialogMenuItem *self) { - int what = DITEM_RESTORE; + int what = DITEM_RESTORE | DITEM_SUCCESS; char buf[BUFSIZ]; extern char *distWanted; char *cp; FILE *fp; + int i, curr, max; + char **list; mediaClose(); dialog_clear_norefresh(); @@ -55,54 +82,61 @@ variableLoad(dialogMenuItem * self) "residing on a MSDOS or UFS floppy."); if (!cp || !*cp) { variable_unset(VAR_INSTALL_CFG); - return DITEM_FAILURE | what; + what |= DITEM_FAILURE; + return what; } - distWanted = cp = variable_get(VAR_INSTALL_CFG); - - /* Try to open the floppy drive if we can do that first */ + distWanted = cp; + /* Try to open the floppy drive */ if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE) { msgConfirm("Unable to set media device to floppy."); what |= DITEM_FAILURE; - goto terminate_device; + mediaClose(); + return what; } if (!mediaDevice->init(mediaDevice)) { msgConfirm("Unable to mount floppy filesystem."); what |= DITEM_FAILURE; - goto terminate_device; + mediaClose(); + return what; } fp = mediaDevice->get(mediaDevice, cp, TRUE); - if (!fp) { - msgConfirm("Configuration file '%s' not found.", cp); - variable_unset(VAR_INSTALL_CFG); - what |= DITEM_FAILURE; - goto terminate_device; - } + if (fp) { + msgNotify("Loading %s pre-configuration file", cp); - msgNotify("Loading %s pre-configuration file", cp); + /* Hint to others that we're running from a script, should they care */ + variable_set2(VAR_NONINTERACTIVE, "YES"); - /* Hint to others that we're running from a script, should they care */ - variable_set2(VAR_NONINTERACTIVE, "YES"); - while (fgets(buf, sizeof buf, fp)) { - if ((cp = strchr(buf, '\n')) != NULL) - *cp = '\0'; - if (*buf == '\0' || *buf == '#') - continue; - if (DITEM_STATUS(dispatchCommand(buf)) != DITEM_SUCCESS) { - msgConfirm("Command `%s' failed - rest of script aborted.\n", buf); - what |= DITEM_FAILURE; - goto terminate_file; + /* Now suck in the lot to execute later */ + curr = max = 0; + list = NULL; + while (fgets(buf, sizeof buf, fp)) { + if ((cp = strchr(buf, '\n')) != NULL) + *cp = '\0'; + if (*buf == '\0' || *buf == '#') + continue; + list = string_add(list, buf, &curr, &max); } - } - what |= DITEM_SUCCESS; - -terminate_file: - fclose(fp); + fclose(fp); + mediaClose(); -terminate_device: - mediaClose(); + for (i = 0; i < curr; i++) { + if (DITEM_STATUS(dispatchCommand(list[i])) != DITEM_SUCCESS) { + msgConfirm("Command `%s' failed - rest of script aborted.\n", buf); + what |= DITEM_FAILURE; + break; + } + } + strings_free(list, &curr, &max); + } + else { + msgConfirm("Configuration file '%s' not found.", cp); + variable_unset(VAR_INSTALL_CFG); + what |= DITEM_FAILURE; + mediaClose(); + } variable_unset(VAR_NONINTERACTIVE); return what; diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index ac46c65..0557f21 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.186 1997/05/22 04:04:30 jkh Exp $ + * $Id: install.c,v 1.187 1997/05/30 01:03:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -968,6 +968,7 @@ installVarDefaults(dialogMenuItem *self) variable_set2(VAR_CPIO_VERBOSITY, "high"); variable_set2(VAR_TAPE_BLOCKSIZE, DEFAULT_TAPE_BLOCKSIZE); variable_set2(VAR_INSTALL_ROOT, "/"); + variable_set2(VAR_INSTALL_CFG, "install.cfg"); cp = getenv("EDITOR"); if (!cp) cp = "/usr/bin/ee"; diff --git a/usr.sbin/sade/misc.c b/usr.sbin/sade/misc.c index 93835fc..c5d7316 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.33 1997/03/09 22:25:47 jkh Exp $ + * $Id: misc.c,v 1.34 1997/04/03 13:44:59 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -227,7 +227,7 @@ root_bias(char *path) } /* - * These next routines are kind of specialized just for building string lists + * These next routines are kind of specialized just for building item lists * for dialog_menu(). */ diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index ac46c65..0557f21 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.186 1997/05/22 04:04:30 jkh Exp $ + * $Id: install.c,v 1.187 1997/05/30 01:03:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -968,6 +968,7 @@ installVarDefaults(dialogMenuItem *self) variable_set2(VAR_CPIO_VERBOSITY, "high"); variable_set2(VAR_TAPE_BLOCKSIZE, DEFAULT_TAPE_BLOCKSIZE); variable_set2(VAR_INSTALL_ROOT, "/"); + variable_set2(VAR_INSTALL_CFG, "install.cfg"); cp = getenv("EDITOR"); if (!cp) cp = "/usr/bin/ee"; diff --git a/usr.sbin/sysinstall/misc.c b/usr.sbin/sysinstall/misc.c index 93835fc..c5d7316 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.33 1997/03/09 22:25:47 jkh Exp $ + * $Id: misc.c,v 1.34 1997/04/03 13:44:59 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -227,7 +227,7 @@ root_bias(char *path) } /* - * These next routines are kind of specialized just for building string lists + * These next routines are kind of specialized just for building item lists * for dialog_menu(). */ |