summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sade/variable.c
diff options
context:
space:
mode:
authormurray <murray@FreeBSD.org>2001-09-24 10:16:23 +0000
committermurray <murray@FreeBSD.org>2001-09-24 10:16:23 +0000
commit5db7811e708c1fdf315431ddd6deed09f2cc87b4 (patch)
tree93adea49800e8fdf86444bd44855929cfc0c2970 /usr.sbin/sade/variable.c
parente97a4764bb4efd497473925f8645c948290bd743 (diff)
downloadFreeBSD-src-5db7811e708c1fdf315431ddd6deed09f2cc87b4.zip
FreeBSD-src-5db7811e708c1fdf315431ddd6deed09f2cc87b4.tar.gz
Add a couple of functions to create persistent variables that will
survive a sysinstall Ctrl-C -> 'Restart'. This fixes another annoying bug where restarting sysinstall will try to reload kernel modules and do other external things that have already been done. For now, use these persistent variables to keep track of module, usbd, and pccardd initialization. Bug found by: rwatson MFC after: 1 week
Diffstat (limited to 'usr.sbin/sade/variable.c')
-rw-r--r--usr.sbin/sade/variable.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/usr.sbin/sade/variable.c b/usr.sbin/sade/variable.c
index 2def090..6f896ee 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);
+}
OpenPOWER on IntegriCloud