]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/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.
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");
66 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
68 printf("%s is not properly installed.\n", NAME
);
71 findkey(kv
, "LANGUAGE", selectedshortlang
);
73 for (langcounter
= 0; langtrs
[langcounter
]; langcounter
++)
75 if (strcmp(selectedshortlang
, shortlangnames
[langcounter
]) == 0)
77 ctr
= langtrs
[langcounter
];
84 /* zh,lt,ro,ru,th languages not available in setup, so use English */
85 for (choice
= 0; shortlangnames
[choice
]; choice
++)
87 if (strcmp(shortlangnames
[choice
], "en") == 0)
90 if (!shortlangnames
[choice
])
92 ctr
= langtrs
[choice
];
95 sections
[0] = ctr
[TR_KEYBOARD_MAPPING
];
96 sections
[1] = ctr
[TR_TIMEZONE
];
97 sections
[2] = ctr
[TR_HOSTNAME
];
98 sections
[3] = ctr
[TR_DOMAINNAME
];
99 sections
[4] = ctr
[TR_ISDN_CONFIGURATION
];
100 sections
[5] = ctr
[TR_NETWORKING
];
101 sections
[6] = ctr
[TR_ROOT_PASSWORD
];
102 sections
[7] = ctr
[TR_ADMIN_PASSWORD
];
108 if ((f_title
= fopen ("/etc/issue", "r")))
110 fgets (title
, STRING_SIZE
, f_title
);
111 if (title
[strlen(title
) - 1] == '\n')
112 title
[strlen(title
) - 1] = '\0';
115 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
117 newtDrawRootText(14, 0, title
);
118 newtPushHelpLine(ctr
[TR_HELPLINE
]);
125 rc
= newtWinMenu(ctr
[TR_SECTION_MENU
],
126 ctr
[TR_SELECT_THE_ITEM
], 50, 5, 5, 11,
127 sections
, &choice
, ctr
[TR_OK
], ctr
[TR_QUIT
], NULL
);
159 handlerootpassword();
163 handleadminpassword();
173 if (!(handlekeymap()))
175 if (!(handletimezone()))
177 if (!(handlehostname()))
179 if (!(handledomainname()))
183 if (!(handlenetworking()))
187 if (!(handlerootpassword()))
189 if (!(handleadminpassword()))
198 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
200 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
202 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
205 fprintf(flog
, "Setup program ended.\n");