]>
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.
9 * modified 16/11/2002 eoberlander - French language added
11 * $Id: main.c,v 1.4.2.7 2005/12/01 20:13:08 eoberlander Exp $
27 int main(int argc
, char *argv
[])
30 char *shortlangnames
[] = { "en", NULL
};
31 char **langtrs
[] = { en_tr
, NULL
};
33 char *shortlangnames
[] = { "de", "en", NULL
};
34 char **langtrs
[] = { de_tr
, en_tr
, NULL
};
37 char *sections
[11]; /* need to fill this out AFTER knowning lang */
40 char selectedshortlang
[STRING_SIZE
] = "en";
41 char title
[STRING_SIZE
];
45 /* Log file/terminal stuff. */
49 mylog
= strdup("/var/log/setup.log");
51 if (!(flog
= fopen(mylog
, "w+")))
53 printf("Couldn't open log terminal\n");
60 fprintf(flog
, "Setup program started.\n");
63 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
65 printf("%s is not properly installed.\n", NAME
);
68 findkey(kv
, "LANGUAGE", selectedshortlang
);
70 for (langcounter
= 0; langtrs
[langcounter
]; langcounter
++)
72 if (strcmp(selectedshortlang
, shortlangnames
[langcounter
]) == 0)
74 ctr
= langtrs
[langcounter
];
81 /* zh,lt,ro,ru,th languages not available in setup, so use English */
82 for (choice
= 0; shortlangnames
[choice
]; choice
++)
84 if (strcmp(shortlangnames
[choice
], "en") == 0)
87 if (!shortlangnames
[choice
])
89 ctr
= langtrs
[choice
];
92 sections
[0] = ctr
[TR_KEYBOARD_MAPPING
];
93 sections
[1] = ctr
[TR_TIMEZONE
];
94 sections
[2] = ctr
[TR_HOSTNAME
];
95 sections
[3] = ctr
[TR_DOMAINNAME
];
96 sections
[4] = ctr
[TR_ISDN_CONFIGURATION
];
97 sections
[5] = ctr
[TR_NETWORKING
];
98 sections
[6] = ctr
[TR_ROOT_PASSWORD
];
99 sections
[7] = ctr
[TR_ADMIN_PASSWORD
];
105 if ((f_title
= fopen ("/etc/issue", "r")))
107 fgets (title
, STRING_SIZE
, f_title
);
108 if (title
[strlen(title
) - 1] == '\n')
109 title
[strlen(title
) - 1] = '\0';
112 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
114 newtDrawRootText(14, 0, title
);
115 newtPushHelpLine(ctr
[TR_HELPLINE
]);
122 rc
= newtWinMenu(ctr
[TR_SECTION_MENU
],
123 ctr
[TR_SELECT_THE_ITEM
], 50, 5, 5, 11,
124 sections
, &choice
, ctr
[TR_OK
], ctr
[TR_QUIT
], NULL
);
156 handlerootpassword();
160 handleadminpassword();
170 if (!(handlekeymap()))
172 if (!(handletimezone()))
174 if (!(handlehostname()))
176 if (!(handledomainname()))
180 if (!(handlenetworking()))
184 if (!(handlerootpassword()))
186 if (!(handleadminpassword()))
195 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
197 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
199 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
202 fprintf(flog
, "Setup program ended.\n");