]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/setup/main.c
1 /* SmoothWall setup program.
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
6 * (c) Lawrence Manning, 2001
7 * Contains main entry point, and misc functions.
13 #define _(x) dgettext("setup", x)
22 struct nic nics
[20] = { { "" , "" , "" , "" } };
23 struct knic knics
[20] = { { "" , "" , "" , "" } };
25 int main(int argc
, char *argv
[])
28 char *sections
[11]; /* need to fill this out AFTER knowning lang */
31 char lang
[STRING_SIZE
] = "en_US.utf8";
32 char title
[STRING_SIZE
];
36 /* Log file/terminal stuff. */
40 mylog
= strdup("/var/log/setup.log");
42 if (!(flog
= fopen(mylog
, "w+")))
44 printf("Couldn't open log terminal\n");
51 fprintf(flog
, "Setup program started.\n");
53 if (!setlocale(LC_CTYPE
,""))
54 fprintf(flog
, "Locale not spezified. Check LANG, LC_CTYPE, RC_ALL.");
57 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
59 printf("%s is not properly installed.\n", NAME
);
62 findkey(kv
, "LANGUAGE", lang
);
64 setlocale(LC_ALL
, lang
);
65 setenv("LANGUAGE", lang
, 1);
67 sections
[0] = _("Keyboard mapping");
68 sections
[1] = _("Timezone");
69 sections
[2] = _("Hostname");
70 sections
[3] = _("Domain name");
71 sections
[4] = _("Networking");
72 sections
[5] = _("ISDN");
73 sections
[6] = _("'root' password");
74 sections
[7] = _("'admin' password");
80 if ((f_title
= fopen ("/etc/issue", "r")))
82 fgets (title
, STRING_SIZE
, f_title
);
83 if (title
[strlen(title
) - 1] == '\n')
84 title
[strlen(title
) - 1] = '\0';
87 sprintf (title
, "%s - %s", NAME
, SLOGAN
);
89 newtDrawRootText(14, 0, title
);
90 newtPushHelpLine(_(" <Tab>/<Alt-Tab> between elements | <Space> selects"));
97 rc
= newtWinMenu(_("Section menu"),
98 _("Select the item you wish to configure."), 50, 5, 5, 11,
99 sections
, &choice
, _("OK"), _("Quit"), NULL
);
131 handlerootpassword();
135 handleadminpassword();
145 if (!(handlekeymap()))
147 if (!(handletimezone()))
149 if (!(handlehostname()))
151 if (!(handledomainname()))
153 if (!(handlerootpassword()))
155 if (!(handleadminpassword()))
159 if (!(handlenetworking()))
170 sprintf (title
, "%s - %s", NAME
, SLOGAN
);
172 newtWinMessage(title
, _("OK"), _("Setup is complete."));
174 newtWinMessage(_("Warning"), _("OK"),
175 _("Initial setup was not entirely complete. "
176 "You must ensure that Setup is properly finished by running "
177 "setup again at the shell."));
179 fprintf(flog
, "Setup program has not finished.\n");
189 fprintf(flog
, "Setup program ended.\n");