]>
Commit | Line | Data |
---|---|---|
d6aaa55d MT |
1 | /* SmoothWall install program. |
2 | * | |
3 | * This program is distributed under the terms of the GNU General Public | |
4 | * Licence. See the file COPYING for details. | |
5 | * | |
6 | * (c) Lawrence Manning, 2001 | |
7 | * Write the config and get password stuff. | |
8 | * | |
d6aaa55d MT |
9 | */ |
10 | ||
11 | #include "install.h" | |
10bc6f06 MT |
12 | |
13 | extern FILE *flog; | |
14 | extern char *mylog; | |
15 | ||
16 | extern char **ctr; | |
17 | ||
d6aaa55d MT |
18 | int write_lang_configs( char *lang) |
19 | { | |
20 | struct keyvalue *kv = initkeyvalues(); | |
21 | ||
22 | /* default stuff for main/settings. */ | |
23 | replacekeyvalue(kv, "LANGUAGE", lang); | |
24 | replacekeyvalue(kv, "HOSTNAME", SNAME); | |
406f019f | 25 | replacekeyvalue(kv, "THEME", "ipfire"); |
d6aaa55d MT |
26 | writekeyvalues(kv, "/harddisk" CONFIG_ROOT "/main/settings"); |
27 | freekeyvalues(kv); | |
28 | ||
29 | return 1; | |
30 | } | |
31 | ||
32 | int write_ethernet_configs(struct keyvalue *ethernetkv) | |
33 | { | |
34 | /* Write out the network settings we got from a few mins ago. */ | |
35 | writekeyvalues(ethernetkv, "/harddisk" CONFIG_ROOT "/ethernet/settings"); | |
36 | return 1; | |
37 | } | |
38 | ||
39 | /* Taken from the cdrom one. */ | |
40 | int getpassword(char *password, char *text) | |
41 | { | |
42 | char *values[] = { NULL, NULL, NULL }; /* pointers for the values. */ | |
43 | struct newtWinEntry entries[] = | |
44 | { | |
45 | { ctr[TR_PASSWORD_PROMPT], &values[0], 2 }, | |
46 | { ctr[TR_AGAIN_PROMPT], &values[1], 2 }, | |
47 | { NULL, NULL, 0 } | |
48 | }; | |
49 | char title[STRING_SIZE]; | |
50 | int rc; | |
51 | int done; | |
52 | ||
53 | do | |
54 | { | |
55 | done = 1; | |
56 | sprintf (title, "%s v%s - %s", NAME, VERSION, SLOGAN); | |
57 | rc = newtWinEntries(title, text, | |
58 | 50, 5, 5, 20, entries, ctr[TR_OK], ctr[TR_CANCEL], NULL); | |
59 | ||
60 | if (rc != 2) | |
61 | { | |
62 | if (strlen(values[0]) == 0 || strlen(values[1]) == 0) | |
63 | { | |
64 | errorbox(ctr[TR_PASSWORD_CANNOT_BE_BLANK]); | |
65 | done = 0; | |
66 | strcpy(values[0], ""); | |
67 | strcpy(values[1], ""); | |
68 | } | |
69 | else if (strcmp(values[0], values[1]) != 0) | |
70 | { | |
71 | errorbox(ctr[TR_PASSWORDS_DO_NOT_MATCH]); | |
72 | done = 0; | |
73 | strcpy(values[0], ""); | |
74 | strcpy(values[1], ""); | |
75 | } | |
76 | } | |
77 | } | |
78 | while (!done); | |
79 | ||
80 | strncpy(password, values[0], STRING_SIZE); | |
81 | ||
82 | if (values[0]) free(values[0]); | |
83 | if (values[1]) free(values[1]); | |
84 | ||
85 | return rc; | |
86 | } | |
10bc6f06 | 87 |