]>
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 $
46 int main(int argc
, char *argv
[])
49 char *shortlangnames
[] = { "en", NULL
};
50 char **langtrs
[] = { en_tr
, NULL
};
52 char *shortlangnames
[] = { "bz", "cs", "da", "de", "en", "es", "fr", "el", "it", "la", "hu", "nl", "no", "pl", "pt", "sk", "so", "fi", "sv", "tr", "vi", NULL
};
53 char **langtrs
[] = { bz_tr
, cs_tr
, da_tr
, de_tr
, en_tr
, es_tr
, fr_tr
, el_tr
, it_tr
, la_tr
, hu_tr
, nl_tr
, no_tr
, pl_tr
, pt_tr
, sk_tr
, so_tr
, fi_tr
, sv_tr
, tr_tr
, vi_tr
, NULL
};
56 char *sections
[11]; /* need to fill this out AFTER knowning lang */
59 char selectedshortlang
[STRING_SIZE
] = "en";
60 char title
[STRING_SIZE
];
64 /* Log file/terminal stuff. */
68 mylog
= strdup("/root/setup.log");
70 if (!(flog
= fopen(mylog
, "w+")))
72 printf("Couldn't open log terminal\n");
79 fprintf(flog
, "Setup program started.\n");
82 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
84 printf("%s is not properly installed.\n", NAME
);
87 findkey(kv
, "LANGUAGE", selectedshortlang
);
89 for (langcounter
= 0; langtrs
[langcounter
]; langcounter
++)
91 if (strcmp(selectedshortlang
, shortlangnames
[langcounter
]) == 0)
93 ctr
= langtrs
[langcounter
];
100 /* zh,lt,ro,ru,th languages not available in setup, so use English */
101 for (choice
= 0; shortlangnames
[choice
]; choice
++)
103 if (strcmp(shortlangnames
[choice
], "en") == 0)
106 if (!shortlangnames
[choice
])
108 ctr
= langtrs
[choice
];
111 sections
[0] = ctr
[TR_KEYBOARD_MAPPING
];
112 sections
[1] = ctr
[TR_TIMEZONE
];
113 sections
[2] = ctr
[TR_HOSTNAME
];
114 sections
[3] = ctr
[TR_DOMAINNAME
];
115 sections
[4] = ctr
[TR_ISDN_CONFIGURATION
];
116 sections
[5] = ctr
[TR_NETWORKING
];
117 sections
[6] = ctr
[TR_ROOT_PASSWORD
];
118 sections
[7] = ctr
[TR_ADMIN_PASSWORD
];
124 if ((f_title
= fopen ("/etc/issue", "r")))
126 fgets (title
, STRING_SIZE
, f_title
);
127 if (title
[strlen(title
) - 1] == '\n')
128 title
[strlen(title
) - 1] = '\0';
131 sprintf (title
, "%s v%s - %s", NAME
, VERSION
, SLOGAN
);
133 newtDrawRootText(14, 0, title
);
134 newtPushHelpLine(ctr
[TR_HELPLINE
]);
141 rc
= newtWinMenu(ctr
[TR_SECTION_MENU
],
142 ctr
[TR_SELECT_THE_ITEM
], 50, 5, 5, 11,
143 sections
, &choice
, ctr
[TR_OK
], ctr
[TR_QUIT
], NULL
);
175 handlerootpassword();
179 handleadminpassword();
189 if (!(handlekeymap()))
191 if (!(handletimezone()))
193 if (!(handlehostname()))
195 if (!(handledomainname()))
199 if (!(handlenetworking()))
203 if (!(handlerootpassword()))
205 if (!(handleadminpassword()))
214 sprintf (title
, "%s v%s - %s", NAME
, VERSION
, SLOGAN
);
216 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
218 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
221 fprintf(flog
, "Setup program ended.\n");