diff options
| author | Murray Stokely <murray@FreeBSD.org> | 2001-09-24 10:16:23 +0000 |
|---|---|---|
| committer | Murray Stokely <murray@FreeBSD.org> | 2001-09-24 10:16:23 +0000 |
| commit | a0769a8d73f90103518a032a5cc50c80a4139027 (patch) | |
| tree | 93adea49800e8fdf86444bd44855929cfc0c2970 /usr.sbin | |
| parent | 946b7fa17e444cf0508c8e46736dabf454f01f60 (diff) | |
Notes
Diffstat (limited to 'usr.sbin')
| -rw-r--r-- | usr.sbin/sade/main.c | 22 | ||||
| -rw-r--r-- | usr.sbin/sade/sade.h | 2 | ||||
| -rw-r--r-- | usr.sbin/sade/variable.c | 37 | ||||
| -rw-r--r-- | usr.sbin/sysinstall/main.c | 22 | ||||
| -rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 2 | ||||
| -rw-r--r-- | usr.sbin/sysinstall/variable.c | 37 |
6 files changed, 110 insertions, 12 deletions
diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c index 19d1c0a3395e7..a5620298206b5 100644 --- a/usr.sbin/sade/main.c +++ b/usr.sbin/sade/main.c @@ -101,14 +101,24 @@ main(int argc, char **argv) if (DebugFD) dup2(DebugFD, 2); - /* Initialize driver modules */ - moduleInitialize(); + /* Initialize driver modules, if we haven't already done so (ie, + the user hit Ctrl-C -> Restart. */ + if (!pvariable_get("modulesInitialize")) { + moduleInitialize(); + pvariable_set("modulesInitialize=1"); + } - /* Initialize PC-card */ - pccardInitialize(); + /* Initialize PC-card, if we haven't already done so. */ + if (!pvariable_get("pccardInitialize")) { + pccardInitialize(); + pvariable_set("pccardInitialize=1"); + } - /* Initialize USB */ - usbInitialize(); + /* Initialize USB, if we haven't already done so. */ + if (!pvariable_get("usbInitialize")) { + usbInitialize(); + pvariable_set("usbInitialize=1"); + } /* Probe for all relevant devices on the system */ deviceGetAll(); diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index c6e2b9b9c01a7..fb764b84ab6eb 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -772,6 +772,8 @@ extern char *variable_get_value(char *var, char *prompt, int dirty); extern int variable_check(char *data); extern int dump_variables(dialogMenuItem *self); extern void free_variables(void); +extern void pvariable_set(char *var); +extern char *pvariable_get(char *var); /* wizard.c */ extern void slice_wizard(Disk *d); diff --git a/usr.sbin/sade/variable.c b/usr.sbin/sade/variable.c index 2def090ac272f..6f896ee8a7e4f 100644 --- a/usr.sbin/sade/variable.c +++ b/usr.sbin/sade/variable.c @@ -8,6 +8,8 @@ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. + * Copyright (c) 2001 + * Murray Stokely. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -257,3 +259,38 @@ free_variables(void) VarHead = NULL; } } + +/* + * Persistent variables. The variables modified by these functions + * are not cleared between invocations of sysinstall. This is useful + * to allow the user to completely restart sysinstall, without having + * it load all of the modules again from the installation media which + * are still in memory. + */ + +void +pvariable_set(char *var) +{ + char tmp[1024]; + + if (!var) + msgFatal("NULL variable name & value passed."); + else if (!*var) + msgDebug("Warning: Zero length name & value passed to variable_set()\n"); + /* Add a trivial namespace to whatever name the caller chooses. */ + SAFE_STRCPY(tmp, "SYSINSTALL_PVAR"); + if (index(var, '=') == NULL) + msgFatal("Invalid variable format: %s", var); + strlcat(tmp, var, 1024); + putenv(tmp); +} + +char * +pvariable_get(char *var) +{ + char tmp[1024]; + + SAFE_STRCPY(tmp, "SYSINSTALL_PVAR"); + strlcat(tmp, var, 1024); + return getenv(tmp); +} diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c index 19d1c0a3395e7..a5620298206b5 100644 --- a/usr.sbin/sysinstall/main.c +++ b/usr.sbin/sysinstall/main.c @@ -101,14 +101,24 @@ main(int argc, char **argv) if (DebugFD) dup2(DebugFD, 2); - /* Initialize driver modules */ - moduleInitialize(); + /* Initialize driver modules, if we haven't already done so (ie, + the user hit Ctrl-C -> Restart. */ + if (!pvariable_get("modulesInitialize")) { + moduleInitialize(); + pvariable_set("modulesInitialize=1"); + } - /* Initialize PC-card */ - pccardInitialize(); + /* Initialize PC-card, if we haven't already done so. */ + if (!pvariable_get("pccardInitialize")) { + pccardInitialize(); + pvariable_set("pccardInitialize=1"); + } - /* Initialize USB */ - usbInitialize(); + /* Initialize USB, if we haven't already done so. */ + if (!pvariable_get("usbInitialize")) { + usbInitialize(); + pvariable_set("usbInitialize=1"); + } /* Probe for all relevant devices on the system */ deviceGetAll(); diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index c6e2b9b9c01a7..fb764b84ab6eb 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -772,6 +772,8 @@ extern char *variable_get_value(char *var, char *prompt, int dirty); extern int variable_check(char *data); extern int dump_variables(dialogMenuItem *self); extern void free_variables(void); +extern void pvariable_set(char *var); +extern char *pvariable_get(char *var); /* wizard.c */ extern void slice_wizard(Disk *d); diff --git a/usr.sbin/sysinstall/variable.c b/usr.sbin/sysinstall/variable.c index 2def090ac272f..6f896ee8a7e4f 100644 --- a/usr.sbin/sysinstall/variable.c +++ b/usr.sbin/sysinstall/variable.c @@ -8,6 +8,8 @@ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. + * Copyright (c) 2001 + * Murray Stokely. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -257,3 +259,38 @@ free_variables(void) VarHead = NULL; } } + +/* + * Persistent variables. The variables modified by these functions + * are not cleared between invocations of sysinstall. This is useful + * to allow the user to completely restart sysinstall, without having + * it load all of the modules again from the installation media which + * are still in memory. + */ + +void +pvariable_set(char *var) +{ + char tmp[1024]; + + if (!var) + msgFatal("NULL variable name & value passed."); + else if (!*var) + msgDebug("Warning: Zero length name & value passed to variable_set()\n"); + /* Add a trivial namespace to whatever name the caller chooses. */ + SAFE_STRCPY(tmp, "SYSINSTALL_PVAR"); + if (index(var, '=') == NULL) + msgFatal("Invalid variable format: %s", var); + strlcat(tmp, var, 1024); + putenv(tmp); +} + +char * +pvariable_get(char *var) +{ + char tmp[1024]; + + SAFE_STRCPY(tmp, "SYSINSTALL_PVAR"); + strlcat(tmp, var, 1024); + return getenv(tmp); +} |
