On Sun, 23 Jul 2000, John Baldwin wrote: > No, he's right. sysinstall is definitely broken in this respect, and > I'm definitely interested in your patches to fix it. :) The patches are attached... In either the case that no make.conf exists, or one exists without a USA_RESIDENT line in it, the line is added, regardless of if I have confirmed that the default NO is correct or not. In the case that make.conf has a USA_RESIDENT line, I only overwrite that line if the user has answered the question 'are you really a us resident'. Let me know if you have any questions. Thanks. - Tim
Index: config.c =================================================================== RCS file: /usr/CVS/src/release/sysinstall/config.c,v retrieving revision 1.156.2.3 diff -c -r1.156.2.3 config.c *** config.c 2000/07/16 17:29:58 1.156.2.3 --- config.c 2000/07/23 22:38:29 *************** *** 371,378 **** 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; --- 371,379 ---- char *lines[MAX_LINES]; int i, nlines; FILE *fp; + bool needResLine=TRUE; ! if (!file_readable(config)) { /* create initial file */ char *line = malloc(21); sprintf(line, "USA_RESIDENT=%s\n", USAResident ? "YES" : "NO"); lines[0] = line; *************** *** 384,393 **** 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) { --- 385,402 ---- return; for (i = 0; i < nlines; i++) { if (!strncmp(lines[i], "USA_RESIDENT", 12)) { ! if (USAResValid) { /* we have asked, so lets overwrite */ ! free(lines[i]); ! lines[i] = malloc(21); /* big enough */ ! sprintf(lines[i], "USA_RESIDENT=%s\n", USAResident ? "YES" : "NO"); ! } ! needResLine=FALSE; } + } + if (needResLine) { /* add USA_RESIDENT line to existing file */ + char *line = malloc(21); + sprintf(line, "USA_RESIDENT=%s\n", USAResident ? "YES" : "NO"); + lines[nlines++] = line; } } if ((fp = fopen(config, "w")) != NULL) { Index: dist.c =================================================================== RCS file: /usr/CVS/src/release/sysinstall/dist.c,v retrieving revision 1.175.2.2 diff -c -r1.175.2.2 dist.c *** dist.c 2000/07/20 01:53:39 1.175.2.2 --- dist.c 2000/07/23 06:21:01 *************** *** 405,410 **** --- 405,411 ---- dialog_clear_norefresh(); USAResident = !msgYesNo("Are you actually resident in the United States?"); + USAResValid = TRUE; distVerifyFlags(); return i | DITEM_REDRAW | DITEM_RESTORE; Index: globals.c =================================================================== RCS file: /usr/CVS/src/release/sysinstall/globals.c,v retrieving revision 1.24 diff -c -r1.24 globals.c *** globals.c 2000/03/12 03:57:25 1.24 --- globals.c 2000/07/23 06:20:24 *************** *** 48,53 **** --- 48,54 ---- Boolean ColorDisplay; /* Are we on a color display? */ Boolean OnVTY; /* Are we on a VTY? */ Boolean USAResident; /* Are we cryptographically challenged? */ + Boolean USAResValid; /* Have we asked yet? */ Variable *VarHead; /* The head of the variable chain */ Device *mediaDevice; /* Where we're installing from */ int BootMgr; /* Which boot manager we're using */ *************** *** 70,73 **** --- 71,75 ---- mediaDevice = NULL; RunningAsInit = FALSE; USAResident = FALSE; + USAResValid = FALSE; } Index: sysinstall.h =================================================================== RCS file: /usr/CVS/src/release/sysinstall/sysinstall.h,v retrieving revision 1.186.2.6 diff -c -r1.186.2.6 sysinstall.h *** sysinstall.h 2000/07/21 20:43:48 1.186.2.6 --- sysinstall.h 2000/07/23 06:24:46 *************** *** 347,352 **** --- 347,353 ---- extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ Boolean USAResident; /* Are we cryptographically challenged? */ + Boolean USAResValid; /* Have we asked yet? */ 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 */