]>
git.ipfire.org Git - people/teissler/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] = { { "" , "" , "" , "" } };
30 int main(int argc
, char *argv
[])
33 char *shortlangnames
[] = { "en", NULL
};
34 char **langtrs
[] = { en_tr
, NULL
};
36 char *shortlangnames
[] = { "de", "en", "fr", "es", "pl", "ru", NULL
};
37 char **langtrs
[] = { de_tr
, en_tr
, fr_tr
, es_tr
, pl_tr
, ru_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 for (choice
= 0; shortlangnames
[choice
]; choice
++)
89 if (strcmp(shortlangnames
[choice
], "en") == 0)
92 if (!shortlangnames
[choice
])
94 ctr
= langtrs
[choice
];
97 sections
[0] = ctr
[TR_KEYBOARD_MAPPING
];
98 sections
[1] = ctr
[TR_TIMEZONE
];
99 sections
[2] = ctr
[TR_HOSTNAME
];
100 sections
[3] = ctr
[TR_DOMAINNAME
];
101 sections
[4] = ctr
[TR_NETWORKING
];
102 sections
[5] = ctr
[TR_ISDN
];
103 sections
[6] = ctr
[TR_ROOT_PASSWORD
];
104 sections
[7] = ctr
[TR_ADMIN_PASSWORD
];
110 if ((f_title
= fopen ("/etc/issue", "r")))
112 fgets (title
, STRING_SIZE
, f_title
);
113 if (title
[strlen(title
) - 1] == '\n')
114 title
[strlen(title
) - 1] = '\0';
117 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
119 newtDrawRootText(14, 0, title
);
120 newtPushHelpLine(ctr
[TR_HELPLINE
]);
127 rc
= newtWinMenu(ctr
[TR_SECTION_MENU
],
128 ctr
[TR_SELECT_THE_ITEM
], 50, 5, 5, 11,
129 sections
, &choice
, ctr
[TR_OK
], ctr
[TR_QUIT
], NULL
);
161 handlerootpassword();
165 handleadminpassword();
175 if (!(handlekeymap()))
177 if (!(handletimezone()))
179 if (!(handlehostname()))
181 if (!(handledomainname()))
183 if (!(handlerootpassword()))
185 if (!(handleadminpassword()))
189 if (!(handlenetworking()))
200 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
202 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
205 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
207 fprintf(flog
, "Setup program has not finished.\n");
217 fprintf(flog
, "Setup program ended.\n");