]>
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.
20 struct nic nics
[20] = { { "" , "" , "" , "" } };
21 struct knic knics
[20] = { { "" , "" , "" , "" } };
29 int main(int argc
, char *argv
[])
32 char *shortlangnames
[] = { "en", NULL
};
33 char **langtrs
[] = { en_tr
, NULL
};
35 char *shortlangnames
[] = { "de", "en", "fr", "es", "pl", NULL
};
36 char **langtrs
[] = { de_tr
, en_tr
, fr_tr
, es_tr
, pl_tr
, NULL
};
39 char *sections
[11]; /* need to fill this out AFTER knowning lang */
42 char selectedshortlang
[STRING_SIZE
] = "en";
43 char title
[STRING_SIZE
];
47 /* Log file/terminal stuff. */
51 mylog
= strdup("/var/log/setup.log");
53 if (!(flog
= fopen(mylog
, "w+")))
55 printf("Couldn't open log terminal\n");
62 fprintf(flog
, "Setup program started.\n");
64 if (!setlocale(LC_CTYPE
,""))
65 fprintf(flog
, "Locale not spezified. Check LANG, LC_CTYPE, RC_ALL.");
68 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
70 printf("%s is not properly installed.\n", NAME
);
73 findkey(kv
, "LANGUAGE", selectedshortlang
);
75 for (langcounter
= 0; langtrs
[langcounter
]; langcounter
++)
77 if (strcmp(selectedshortlang
, shortlangnames
[langcounter
]) == 0)
79 ctr
= langtrs
[langcounter
];
86 for (choice
= 0; shortlangnames
[choice
]; choice
++)
88 if (strcmp(shortlangnames
[choice
], "en") == 0)
91 if (!shortlangnames
[choice
])
93 ctr
= langtrs
[choice
];
96 sections
[0] = ctr
[TR_KEYBOARD_MAPPING
];
97 sections
[1] = ctr
[TR_TIMEZONE
];
98 sections
[2] = ctr
[TR_HOSTNAME
];
99 sections
[3] = ctr
[TR_DOMAINNAME
];
100 sections
[4] = ctr
[TR_NETWORKING
];
101 sections
[5] = ctr
[TR_ISDN
];
102 sections
[6] = ctr
[TR_ROOT_PASSWORD
];
103 sections
[7] = ctr
[TR_ADMIN_PASSWORD
];
109 if ((f_title
= fopen ("/etc/issue", "r")))
111 fgets (title
, STRING_SIZE
, f_title
);
112 if (title
[strlen(title
) - 1] == '\n')
113 title
[strlen(title
) - 1] = '\0';
116 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
118 newtDrawRootText(14, 0, title
);
119 newtPushHelpLine(ctr
[TR_HELPLINE
]);
126 rc
= newtWinMenu(ctr
[TR_SECTION_MENU
],
127 ctr
[TR_SELECT_THE_ITEM
], 50, 5, 5, 11,
128 sections
, &choice
, ctr
[TR_OK
], ctr
[TR_QUIT
], NULL
);
160 handlerootpassword();
164 handleadminpassword();
174 if (!(handlekeymap()))
176 if (!(handletimezone()))
178 if (!(handlehostname()))
180 if (!(handledomainname()))
182 if (!(handlerootpassword()))
184 if (!(handleadminpassword()))
188 if (!(handlenetworking()))
199 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
201 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
204 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
206 fprintf(flog
, "Setup program has not finished.\n");
216 fprintf(flog
, "Setup program ended.\n");