If user says they're in the USA, record that fact in /etc/make.conf

This commit is contained in:
Jordan K. Hubbard
2000-02-19 23:22:22 +00:00
parent 677e00c04e
commit da8a39382b
14 changed files with 128 additions and 0 deletions
+35
View File
@@ -364,6 +364,41 @@ configEnvironmentResolv(char *config)
}
}
/* Set up the make.conf file */
void
configMake_conf(char *config)
{
char *lines[MAX_LINES];
int i, nlines;
FILE *fp;
if (!file_readable(config)) {
char *line = malloc(21);
sprintf(line, "USA_RESIDENT=\"%s\"\n", USAResident ? "YES" : "NO");
lines[0] = line;
nlines = 1;
}
else {
nlines = readConfig(config, lines, MAX_LINES);
if (nlines == -1)
return;
for (i = 0; i < nlines; i++) {
if (!strncmp(lines[i], "USA_RESIDENT", 12)) {
free(lines[i]);
lines[i] = malloc(21); /* big enough */
sprintf(lines[i], "USA_RESIDENT=\"%s\"\n", USAResident ? "YES" : "NO");
}
}
}
if ((fp = fopen(config, "w")) != NULL) {
for (i = 0; i < nlines; i++) {
fprintf(fp, "%s", lines[i]);
free(lines[i]);
}
fclose(fp);
}
}
/* Version of below for dispatch routines */
int
configRC(dialogMenuItem *unused)
+4
View File
@@ -404,7 +404,11 @@ distMaybeSetDES(dialogMenuItem *self)
"a second pass using the Custom Installation option.")) {
if (!dmenuOpenSimple(&MenuDESDistributions, FALSE))
i = DITEM_FAILURE;
else
USAResident = TRUE;
}
else
USAResident = FALSE;
distVerifyFlags();
return i | DITEM_REDRAW | DITEM_RESTORE;
}
+2
View File
@@ -47,6 +47,7 @@ Boolean RunningAsInit; /* Are we running as init? */
Boolean DialogActive; /* Is libdialog initialized? */
Boolean ColorDisplay; /* Are we on a color display? */
Boolean OnVTY; /* Are we on a VTY? */
Boolean USAResident; /* Are we cryptographically challenged? */
Variable *VarHead; /* The head of the variable chain */
Device *mediaDevice; /* Where we're installing from */
int BootMgr; /* Which boot manager we're using */
@@ -68,4 +69,5 @@ globalsInit(void)
VarHead = NULL;
mediaDevice = NULL;
RunningAsInit = FALSE;
USAResident = TRUE;
}
+1
View File
@@ -1061,6 +1061,7 @@ installEnvironment(void)
configEnvironmentRC_conf();
if (file_readable("/etc/resolv.conf"))
configEnvironmentResolv("/etc/resolv.conf");
configMake_conf("/etc/make.conf");
}
/* Copy the boot floppy contents into /stand */
+2
View File
@@ -340,6 +340,7 @@ extern Boolean RunningAsInit; /* Are we running stand-alone? */
extern Boolean DialogActive; /* Is the dialog() stuff up? */
extern Boolean ColorDisplay; /* Are we on a color display? */
extern Boolean OnVTY; /* On a syscons VTY? */
Boolean USAResident; /* Are we cryptographically challenged? */
extern Variable *VarHead; /* The head of the variable chain */
extern Device *mediaDevice; /* Where we're getting our distribution from */
extern unsigned int Dists; /* Which distributions we want */
@@ -420,6 +421,7 @@ extern void command_func_add(char *key, commandFunc func, void *data);
extern void configEnvironmentRC_conf(void);
extern void configEnvironmentResolv(char *config);
extern void configRC_conf(void);
extern void configMake_conf(char *config);
extern int configFstab(dialogMenuItem *self);
extern int configRC(dialogMenuItem *self);
extern int configResolv(dialogMenuItem *self);
+35
View File
@@ -364,6 +364,41 @@ configEnvironmentResolv(char *config)
}
}
/* Set up the make.conf file */
void
configMake_conf(char *config)
{
char *lines[MAX_LINES];
int i, nlines;
FILE *fp;
if (!file_readable(config)) {
char *line = malloc(21);
sprintf(line, "USA_RESIDENT=\"%s\"\n", USAResident ? "YES" : "NO");
lines[0] = line;
nlines = 1;
}
else {
nlines = readConfig(config, lines, MAX_LINES);
if (nlines == -1)
return;
for (i = 0; i < nlines; i++) {
if (!strncmp(lines[i], "USA_RESIDENT", 12)) {
free(lines[i]);
lines[i] = malloc(21); /* big enough */
sprintf(lines[i], "USA_RESIDENT=\"%s\"\n", USAResident ? "YES" : "NO");
}
}
}
if ((fp = fopen(config, "w")) != NULL) {
for (i = 0; i < nlines; i++) {
fprintf(fp, "%s", lines[i]);
free(lines[i]);
}
fclose(fp);
}
}
/* Version of below for dispatch routines */
int
configRC(dialogMenuItem *unused)
+2
View File
@@ -47,6 +47,7 @@ Boolean RunningAsInit; /* Are we running as init? */
Boolean DialogActive; /* Is libdialog initialized? */
Boolean ColorDisplay; /* Are we on a color display? */
Boolean OnVTY; /* Are we on a VTY? */
Boolean USAResident; /* Are we cryptographically challenged? */
Variable *VarHead; /* The head of the variable chain */
Device *mediaDevice; /* Where we're installing from */
int BootMgr; /* Which boot manager we're using */
@@ -68,4 +69,5 @@ globalsInit(void)
VarHead = NULL;
mediaDevice = NULL;
RunningAsInit = FALSE;
USAResident = TRUE;
}
+1
View File
@@ -1061,6 +1061,7 @@ installEnvironment(void)
configEnvironmentRC_conf();
if (file_readable("/etc/resolv.conf"))
configEnvironmentResolv("/etc/resolv.conf");
configMake_conf("/etc/make.conf");
}
/* Copy the boot floppy contents into /stand */
+2
View File
@@ -340,6 +340,7 @@ extern Boolean RunningAsInit; /* Are we running stand-alone? */
extern Boolean DialogActive; /* Is the dialog() stuff up? */
extern Boolean ColorDisplay; /* Are we on a color display? */
extern Boolean OnVTY; /* On a syscons VTY? */
Boolean USAResident; /* Are we cryptographically challenged? */
extern Variable *VarHead; /* The head of the variable chain */
extern Device *mediaDevice; /* Where we're getting our distribution from */
extern unsigned int Dists; /* Which distributions we want */
@@ -420,6 +421,7 @@ extern void command_func_add(char *key, commandFunc func, void *data);
extern void configEnvironmentRC_conf(void);
extern void configEnvironmentResolv(char *config);
extern void configRC_conf(void);
extern void configMake_conf(char *config);
extern int configFstab(dialogMenuItem *self);
extern int configRC(dialogMenuItem *self);
extern int configResolv(dialogMenuItem *self);
+35
View File
@@ -364,6 +364,41 @@ configEnvironmentResolv(char *config)
}
}
/* Set up the make.conf file */
void
configMake_conf(char *config)
{
char *lines[MAX_LINES];
int i, nlines;
FILE *fp;
if (!file_readable(config)) {
char *line = malloc(21);
sprintf(line, "USA_RESIDENT=\"%s\"\n", USAResident ? "YES" : "NO");
lines[0] = line;
nlines = 1;
}
else {
nlines = readConfig(config, lines, MAX_LINES);
if (nlines == -1)
return;
for (i = 0; i < nlines; i++) {
if (!strncmp(lines[i], "USA_RESIDENT", 12)) {
free(lines[i]);
lines[i] = malloc(21); /* big enough */
sprintf(lines[i], "USA_RESIDENT=\"%s\"\n", USAResident ? "YES" : "NO");
}
}
}
if ((fp = fopen(config, "w")) != NULL) {
for (i = 0; i < nlines; i++) {
fprintf(fp, "%s", lines[i]);
free(lines[i]);
}
fclose(fp);
}
}
/* Version of below for dispatch routines */
int
configRC(dialogMenuItem *unused)
+4
View File
@@ -404,7 +404,11 @@ distMaybeSetDES(dialogMenuItem *self)
"a second pass using the Custom Installation option.")) {
if (!dmenuOpenSimple(&MenuDESDistributions, FALSE))
i = DITEM_FAILURE;
else
USAResident = TRUE;
}
else
USAResident = FALSE;
distVerifyFlags();
return i | DITEM_REDRAW | DITEM_RESTORE;
}
+2
View File
@@ -47,6 +47,7 @@ Boolean RunningAsInit; /* Are we running as init? */
Boolean DialogActive; /* Is libdialog initialized? */
Boolean ColorDisplay; /* Are we on a color display? */
Boolean OnVTY; /* Are we on a VTY? */
Boolean USAResident; /* Are we cryptographically challenged? */
Variable *VarHead; /* The head of the variable chain */
Device *mediaDevice; /* Where we're installing from */
int BootMgr; /* Which boot manager we're using */
@@ -68,4 +69,5 @@ globalsInit(void)
VarHead = NULL;
mediaDevice = NULL;
RunningAsInit = FALSE;
USAResident = TRUE;
}
+1
View File
@@ -1061,6 +1061,7 @@ installEnvironment(void)
configEnvironmentRC_conf();
if (file_readable("/etc/resolv.conf"))
configEnvironmentResolv("/etc/resolv.conf");
configMake_conf("/etc/make.conf");
}
/* Copy the boot floppy contents into /stand */
+2
View File
@@ -340,6 +340,7 @@ extern Boolean RunningAsInit; /* Are we running stand-alone? */
extern Boolean DialogActive; /* Is the dialog() stuff up? */
extern Boolean ColorDisplay; /* Are we on a color display? */
extern Boolean OnVTY; /* On a syscons VTY? */
Boolean USAResident; /* Are we cryptographically challenged? */
extern Variable *VarHead; /* The head of the variable chain */
extern Device *mediaDevice; /* Where we're getting our distribution from */
extern unsigned int Dists; /* Which distributions we want */
@@ -420,6 +421,7 @@ extern void command_func_add(char *key, commandFunc func, void *data);
extern void configEnvironmentRC_conf(void);
extern void configEnvironmentResolv(char *config);
extern void configRC_conf(void);
extern void configMake_conf(char *config);
extern int configFstab(dialogMenuItem *self);
extern int configRC(dialogMenuItem *self);
extern int configResolv(dialogMenuItem *self);