]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/setup/main.c
3e272716dc1af998eee6ef89a46a83746879e65e
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.
9 * modified 16/11/2002 eoberlander - French language added
11 * $Id: main.c,v 1.4.2.7 2005/12/01 20:13:08 eoberlander Exp $
24 struct nic nics
[20] = { { "" , "" , "" , "" } };
25 struct knic knics
[20] = { { "" , "" , "" , "" } };
30 int main(int argc
, char *argv
[])
33 char *shortlangnames
[] = { "en", NULL
};
34 char **langtrs
[] = { en_tr
, NULL
};
36 char *shortlangnames
[] = { "de", "en", NULL
};
37 char **langtrs
[] = { de_tr
, en_tr
, NULL
};
40 char *sections
[11]; /* need to fill this out AFTER knowning lang */
43 char selectedshortlang
[STRING_SIZE
] = "en";
44 char title
[STRING_SIZE
];
48 /* Log file/terminal stuff. */
52 mylog
= strdup("/var/log/setup.log");
54 if (!(flog
= fopen(mylog
, "w+")))
56 printf("Couldn't open log terminal\n");
63 fprintf(flog
, "Setup program started.\n");
65 if (!setlocale(LC_CTYPE
,""))
66 fprintf(flog
, "Locale not spezified. Check LANG, LC_CTYPE, RC_ALL.");
69 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
71 printf("%s is not properly installed.\n", NAME
);
74 findkey(kv
, "LANGUAGE", selectedshortlang
);
76 for (langcounter
= 0; langtrs
[langcounter
]; langcounter
++)
78 if (strcmp(selectedshortlang
, shortlangnames
[langcounter
]) == 0)
80 ctr
= langtrs
[langcounter
];
87 /* zh,lt,ro,ru,th languages not available in setup, so use English */
88 for (choice
= 0; shortlangnames
[choice
]; choice
++)
90 if (strcmp(shortlangnames
[choice
], "en") == 0)
93 if (!shortlangnames
[choice
])
95 ctr
= langtrs
[choice
];
98 sections
[0] = ctr
[TR_KEYBOARD_MAPPING
];
99 sections
[1] = ctr
[TR_TIMEZONE
];
100 sections
[2] = ctr
[TR_HOSTNAME
];
101 sections
[3] = ctr
[TR_DOMAINNAME
];
102 sections
[4] = ctr
[TR_ISDN_CONFIGURATION
];
103 sections
[5] = ctr
[TR_NETWORKING
];
104 sections
[6] = ctr
[TR_ROOT_PASSWORD
];
105 sections
[7] = ctr
[TR_ADMIN_PASSWORD
];
111 if ((f_title
= fopen ("/etc/issue", "r")))
113 fgets (title
, STRING_SIZE
, f_title
);
114 if (title
[strlen(title
) - 1] == '\n')
115 title
[strlen(title
) - 1] = '\0';
118 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
120 newtDrawRootText(14, 0, title
);
121 newtPushHelpLine(ctr
[TR_HELPLINE
]);
128 rc
= newtWinMenu(ctr
[TR_SECTION_MENU
],
129 ctr
[TR_SELECT_THE_ITEM
], 50, 5, 5, 11,
130 sections
, &choice
, ctr
[TR_OK
], ctr
[TR_QUIT
], NULL
);
162 handlerootpassword();
166 handleadminpassword();
176 if (!(handlekeymap()))
178 if (!(handletimezone()))
180 if (!(handlehostname()))
182 if (!(handledomainname()))
184 // if (!(handleisdn()))
186 if (!(handlenetworking()))
190 if (!(handlerootpassword()))
192 if (!(handleadminpassword()))
201 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
203 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
205 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
208 fprintf(flog
, "Setup program ended.\n");