]>
git.ipfire.org Git - 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] = { { "" , "" , "" , "" } };
31 int main(int argc
, char *argv
[])
34 char *shortlangnames
[] = { "en", NULL
};
35 char **langtrs
[] = { en_tr
, NULL
};
37 char *shortlangnames
[] = { "de", "en", "fr", "es", "nl", "pl", "ru", NULL
};
38 char **langtrs
[] = { de_tr
, en_tr
, fr_tr
, es_tr
, nl_tr
, pl_tr
, ru_tr
, NULL
};
41 char *sections
[11]; /* need to fill this out AFTER knowning lang */
44 char selectedshortlang
[STRING_SIZE
] = "en";
45 char title
[STRING_SIZE
];
49 /* Log file/terminal stuff. */
53 mylog
= strdup("/var/log/setup.log");
55 if (!(flog
= fopen(mylog
, "w+")))
57 printf("Couldn't open log terminal\n");
64 fprintf(flog
, "Setup program started.\n");
66 if (!setlocale(LC_CTYPE
,""))
67 fprintf(flog
, "Locale not spezified. Check LANG, LC_CTYPE, RC_ALL.");
70 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
72 printf("%s is not properly installed.\n", NAME
);
75 findkey(kv
, "LANGUAGE", selectedshortlang
);
77 for (langcounter
= 0; langtrs
[langcounter
]; langcounter
++)
79 if (strcmp(selectedshortlang
, shortlangnames
[langcounter
]) == 0)
81 ctr
= langtrs
[langcounter
];
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_NETWORKING
];
103 sections
[5] = ctr
[TR_ISDN
];
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 (!(handlerootpassword()))
186 if (!(handleadminpassword()))
190 if (!(handlenetworking()))
201 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
203 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
206 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
208 fprintf(flog
, "Setup program has not finished.\n");
218 fprintf(flog
, "Setup program ended.\n");