-/* SmoothWall install program.\r
- *\r
- * This program is distributed under the terms of the GNU General Public\r
- * Licence. See the file COPYING for details.\r
- *\r
- * (c) Lawrence Manning, 2001\r
- * Write the config and get password stuff.\r
- * \r
- * $Id: config.c,v 1.6.2.3 2005/12/07 20:42:48 franck78 Exp $\r
- * \r
- */\r
-\r
-#include "install.h"\r
-extern char **ctr; // text translation table\r
-\r
-/* called to write out all config files using the keyvalue interface. */\r
-int write_disk_configs(struct devparams *dp)\r
-{\r
- char devnode[STRING_SIZE];\r
- char partition[STRING_SIZE];\r
- char *messages[5] = { NULL,\r
- ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK1],\r
- ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK2],\r
- ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK3],\r
- ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK4] \r
- };\r
- /* dev node links. */\r
- sprintf(devnode, "%s", dp->devnode_disk_run);\r
- if (symlink(devnode, "/harddisk/dev/harddisk"))\r
- {\r
- errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK]);\r
- return 0;\r
- }\r
- \r
- int j;\r
- for (j=1; j<5; j++) {\r
- sprintf(devnode, "%s%d", dp->devnode_part_run,j);\r
- sprintf(partition,"/harddisk/dev/harddisk%d",j);\r
- if (symlink(devnode, partition))\r
- {\r
- errorbox( messages[j] );\r
- return 0;\r
- }\r
- }\r
-\r
- /* Add /dev/root symlink linking to the root filesystem to \r
- * keep updfstab happy */\r
- sprintf(devnode, "%s4", dp->devnode_part_run);\r
- if (symlink(devnode, "/harddisk/dev/root"))\r
- {\r
- errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_ROOT]);\r
- return 0;\r
- }\r
-\r
- return 1;\r
-}\r
-\r
-int write_lang_configs( char *lang)\r
-{\r
- struct keyvalue *kv = initkeyvalues();\r
- \r
- /* default stuff for main/settings. */\r
- replacekeyvalue(kv, "LANGUAGE", lang);\r
- replacekeyvalue(kv, "HOSTNAME", SNAME);\r
- writekeyvalues(kv, "/harddisk" CONFIG_ROOT "/main/settings");\r
- freekeyvalues(kv);\r
- \r
- return 1;\r
-}\r
-\r
-int write_ethernet_configs(struct keyvalue *ethernetkv)\r
-{\r
- /* Write out the network settings we got from a few mins ago. */\r
- writekeyvalues(ethernetkv, "/harddisk" CONFIG_ROOT "/ethernet/settings");\r
- return 1;\r
-}\r
-\r
-/* Taken from the cdrom one. */\r
-int getpassword(char *password, char *text)\r
-{\r
- char *values[] = { NULL, NULL, NULL }; /* pointers for the values. */\r
- struct newtWinEntry entries[] =\r
- { \r
- { ctr[TR_PASSWORD_PROMPT], &values[0], 2 },\r
- { ctr[TR_AGAIN_PROMPT], &values[1], 2 },\r
- { NULL, NULL, 0 }\r
- };\r
- char title[STRING_SIZE];\r
- int rc;\r
- int done;\r
- \r
- do\r
- {\r
- done = 1;\r
- sprintf (title, "%s v%s - %s", NAME, VERSION, SLOGAN);\r
- rc = newtWinEntries(title, text,\r
- 50, 5, 5, 20, entries, ctr[TR_OK], ctr[TR_CANCEL], NULL);\r
- \r
- if (rc != 2)\r
- {\r
- if (strlen(values[0]) == 0 || strlen(values[1]) == 0)\r
- {\r
- errorbox(ctr[TR_PASSWORD_CANNOT_BE_BLANK]);\r
- done = 0;\r
- strcpy(values[0], "");\r
- strcpy(values[1], ""); \r
- }\r
- else if (strcmp(values[0], values[1]) != 0)\r
- {\r
- errorbox(ctr[TR_PASSWORDS_DO_NOT_MATCH]);\r
- done = 0;\r
- strcpy(values[0], "");\r
- strcpy(values[1], ""); \r
- }\r
- }\r
- }\r
- while (!done);\r
-\r
- strncpy(password, values[0], STRING_SIZE);\r
-\r
- if (values[0]) free(values[0]);\r
- if (values[1]) free(values[1]);\r
-\r
- return rc;\r
-}\r
+/* SmoothWall install program.
+ *
+ * This program is distributed under the terms of the GNU General Public
+ * Licence. See the file COPYING for details.
+ *
+ * (c) Lawrence Manning, 2001
+ * Write the config and get password stuff.
+ *
+ */
+
+#include "install.h"
+
+extern FILE *flog;
+extern char *mylog;
+
+extern char **ctr;
+
+int write_lang_configs( char *lang)
+{
+ struct keyvalue *kv = initkeyvalues();
+
+ /* default stuff for main/settings. */
+ replacekeyvalue(kv, "LANGUAGE", lang);
+ replacekeyvalue(kv, "HOSTNAME", SNAME);
+ replacekeyvalue(kv, "THEME", "ipfire");
+ writekeyvalues(kv, "/harddisk" CONFIG_ROOT "/main/settings");
+ freekeyvalues(kv);
+
+ return 1;
+}
+
+int write_ethernet_configs(struct keyvalue *ethernetkv)
+{
+ /* Write out the network settings we got from a few mins ago. */
+ writekeyvalues(ethernetkv, "/harddisk" CONFIG_ROOT "/ethernet/settings");
+ return 1;
+}
+
+/* Taken from the cdrom one. */
+int getpassword(char *password, char *text)
+{
+ char *values[] = { NULL, NULL, NULL }; /* pointers for the values. */
+ struct newtWinEntry entries[] =
+ {
+ { ctr[TR_PASSWORD_PROMPT], &values[0], 2 },
+ { ctr[TR_AGAIN_PROMPT], &values[1], 2 },
+ { NULL, NULL, 0 }
+ };
+ char title[STRING_SIZE];
+ int rc;
+ int done;
+
+ do
+ {
+ done = 1;
+ sprintf (title, "%s v%s - %s", NAME, VERSION, SLOGAN);
+ rc = newtWinEntries(title, text,
+ 50, 5, 5, 20, entries, ctr[TR_OK], ctr[TR_CANCEL], NULL);
+
+ if (rc != 2)
+ {
+ if (strlen(values[0]) == 0 || strlen(values[1]) == 0)
+ {
+ errorbox(ctr[TR_PASSWORD_CANNOT_BE_BLANK]);
+ done = 0;
+ strcpy(values[0], "");
+ strcpy(values[1], "");
+ }
+ else if (strcmp(values[0], values[1]) != 0)
+ {
+ errorbox(ctr[TR_PASSWORDS_DO_NOT_MATCH]);
+ done = 0;
+ strcpy(values[0], "");
+ strcpy(values[1], "");
+ }
+ }
+ }
+ while (!done);
+
+ strncpy(password, values[0], STRING_SIZE);
+
+ if (values[0]) free(values[0]);
+ if (values[1]) free(values[1]);
+
+ return rc;
+}
+