]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/install+setup/setup/main.c
d59e9ca044a45cf68b87153962647c0213a840d9
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] = { { "" , "" , "" , "" } };
26 int main(int argc
, char *argv
[])
29 char *shortlangnames
[] = { "en", NULL
};
30 char **langtrs
[] = { en_tr
, NULL
};
32 char *shortlangnames
[] = { "de", "en", NULL
};
33 char **langtrs
[] = { de_tr
, en_tr
, NULL
};
36 char *sections
[11]; /* need to fill this out AFTER knowning lang */
39 char selectedshortlang
[STRING_SIZE
] = "en";
40 char title
[STRING_SIZE
];
44 /* Log file/terminal stuff. */
48 mylog
= strdup("/var/log/setup.log");
50 if (!(flog
= fopen(mylog
, "w+")))
52 printf("Couldn't open log terminal\n");
59 fprintf(flog
, "Setup program started.\n");
61 if (!setlocale(LC_CTYPE
,""))
62 fprintf(flog
, "Locale not spezified. Check LANG, LC_CTYPE, RC_ALL.");
65 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
67 printf("%s is not properly installed.\n", NAME
);
70 findkey(kv
, "LANGUAGE", selectedshortlang
);
72 for (langcounter
= 0; langtrs
[langcounter
]; langcounter
++)
74 if (strcmp(selectedshortlang
, shortlangnames
[langcounter
]) == 0)
76 ctr
= langtrs
[langcounter
];
83 for (choice
= 0; shortlangnames
[choice
]; choice
++)
85 if (strcmp(shortlangnames
[choice
], "en") == 0)
88 if (!shortlangnames
[choice
])
90 ctr
= langtrs
[choice
];
93 sections
[0] = ctr
[TR_KEYBOARD_MAPPING
];
94 sections
[1] = ctr
[TR_TIMEZONE
];
95 sections
[2] = ctr
[TR_HOSTNAME
];
96 sections
[3] = ctr
[TR_DOMAINNAME
];
97 sections
[4] = ctr
[TR_NETWORKING
];
98 sections
[5] = ctr
[TR_ISDN
];
99 sections
[6] = ctr
[TR_ROOT_PASSWORD
];
100 sections
[7] = ctr
[TR_ADMIN_PASSWORD
];
106 if ((f_title
= fopen ("/etc/issue", "r")))
108 fgets (title
, STRING_SIZE
, f_title
);
109 if (title
[strlen(title
) - 1] == '\n')
110 title
[strlen(title
) - 1] = '\0';
113 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
115 newtDrawRootText(14, 0, title
);
116 newtPushHelpLine(ctr
[TR_HELPLINE
]);
123 rc
= newtWinMenu(ctr
[TR_SECTION_MENU
],
124 ctr
[TR_SELECT_THE_ITEM
], 50, 5, 5, 11,
125 sections
, &choice
, ctr
[TR_OK
], ctr
[TR_QUIT
], NULL
);
157 handlerootpassword();
161 handleadminpassword();
171 if (!(handlekeymap()))
173 if (!(handletimezone()))
175 if (!(handlehostname()))
177 if (!(handledomainname()))
179 if (!(handlerootpassword()))
181 if (!(handleadminpassword()))
185 if (!(handlenetworking()))
196 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
198 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
200 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
203 fprintf(flog
, "Setup program ended.\n");