]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/install+setup/setup/main.c
aaa3147944d9e7da9362b9642bdf791311e280cc
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] = { { "" , "" , "" , "" } };
28 int main(int argc
, char *argv
[])
31 char *shortlangnames
[] = { "en", NULL
};
32 char **langtrs
[] = { en_tr
, NULL
};
34 char *shortlangnames
[] = { "de", "en", "fr", "es", NULL
};
35 char **langtrs
[] = { de_tr
, en_tr
, fr_tr
, es_tr
, NULL
};
38 char *sections
[11]; /* need to fill this out AFTER knowning lang */
41 char selectedshortlang
[STRING_SIZE
] = "en";
42 char title
[STRING_SIZE
];
46 /* Log file/terminal stuff. */
50 mylog
= strdup("/var/log/setup.log");
52 if (!(flog
= fopen(mylog
, "w+")))
54 printf("Couldn't open log terminal\n");
61 fprintf(flog
, "Setup program started.\n");
63 if (!setlocale(LC_CTYPE
,""))
64 fprintf(flog
, "Locale not spezified. Check LANG, LC_CTYPE, RC_ALL.");
67 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
69 printf("%s is not properly installed.\n", NAME
);
72 findkey(kv
, "LANGUAGE", selectedshortlang
);
74 for (langcounter
= 0; langtrs
[langcounter
]; langcounter
++)
76 if (strcmp(selectedshortlang
, shortlangnames
[langcounter
]) == 0)
78 ctr
= langtrs
[langcounter
];
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_NETWORKING
];
100 sections
[5] = ctr
[TR_ISDN
];
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()))
181 if (!(handlerootpassword()))
183 if (!(handleadminpassword()))
187 if (!(handlenetworking()))
198 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
200 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
203 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
205 fprintf(flog
, "Setup has program not finished.\n");
215 fprintf(flog
, "Setup program ended.\n");