]>
git.ipfire.org Git - 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
};
55 char *shortlangnames
[] = { "de", "en", NULL
};
56 char **langtrs
[] = { de_tr
, en_tr
, NULL
};
59 char *sections
[11]; /* need to fill this out AFTER knowning lang */
62 char selectedshortlang
[STRING_SIZE
] = "en";
63 char title
[STRING_SIZE
];
67 /* Log file/terminal stuff. */
71 mylog
= strdup("/root/setup.log");
73 if (!(flog
= fopen(mylog
, "w+")))
75 printf("Couldn't open log terminal\n");
82 fprintf(flog
, "Setup program started.\n");
85 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
87 printf("%s is not properly installed.\n", NAME
);
90 findkey(kv
, "LANGUAGE", selectedshortlang
);
92 for (langcounter
= 0; langtrs
[langcounter
]; langcounter
++)
94 if (strcmp(selectedshortlang
, shortlangnames
[langcounter
]) == 0)
96 ctr
= langtrs
[langcounter
];
103 /* zh,lt,ro,ru,th languages not available in setup, so use English */
104 for (choice
= 0; shortlangnames
[choice
]; choice
++)
106 if (strcmp(shortlangnames
[choice
], "en") == 0)
109 if (!shortlangnames
[choice
])
111 ctr
= langtrs
[choice
];
114 sections
[0] = ctr
[TR_KEYBOARD_MAPPING
];
115 sections
[1] = ctr
[TR_TIMEZONE
];
116 sections
[2] = ctr
[TR_HOSTNAME
];
117 sections
[3] = ctr
[TR_DOMAINNAME
];
118 sections
[4] = ctr
[TR_ISDN_CONFIGURATION
];
119 sections
[5] = ctr
[TR_NETWORKING
];
120 sections
[6] = ctr
[TR_ROOT_PASSWORD
];
121 sections
[7] = ctr
[TR_ADMIN_PASSWORD
];
127 if ((f_title
= fopen ("/etc/issue", "r")))
129 fgets (title
, STRING_SIZE
, f_title
);
130 if (title
[strlen(title
) - 1] == '\n')
131 title
[strlen(title
) - 1] = '\0';
134 sprintf (title
, "%s v%s - %s", NAME
, VERSION
, SLOGAN
);
136 newtDrawRootText(14, 0, title
);
137 newtPushHelpLine(ctr
[TR_HELPLINE
]);
144 rc
= newtWinMenu(ctr
[TR_SECTION_MENU
],
145 ctr
[TR_SELECT_THE_ITEM
], 50, 5, 5, 11,
146 sections
, &choice
, ctr
[TR_OK
], ctr
[TR_QUIT
], NULL
);
178 handlerootpassword();
182 handleadminpassword();
192 if (!(handlekeymap()))
194 if (!(handletimezone()))
196 if (!(handlehostname()))
198 if (!(handledomainname()))
202 if (!(handlenetworking()))
206 if (!(handlerootpassword()))
208 if (!(handleadminpassword()))
217 sprintf (title
, "%s v%s - %s", NAME
, VERSION
, SLOGAN
);
219 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
221 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
224 fprintf(flog
, "Setup program ended.\n");