]>
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.
20 struct nic nics
[20] = { { "" , "" , "" , "" } };
21 struct knic knics
[20] = { { "" , "" , "" , "" } };
32 int main(int argc
, char *argv
[])
35 char *shortlangnames
[] = { "en", NULL
};
36 char **langtrs
[] = { en_tr
, NULL
};
38 char *shortlangnames
[] = { "de", "en", "fr", "es", "nl", "pl", "ru", "tr", NULL
};
39 char **langtrs
[] = { de_tr
, en_tr
, fr_tr
, es_tr
, nl_tr
, pl_tr
, ru_tr
, tr_tr
, NULL
};
42 char *sections
[11]; /* need to fill this out AFTER knowning lang */
45 char selectedshortlang
[STRING_SIZE
] = "en";
46 char title
[STRING_SIZE
];
50 /* Log file/terminal stuff. */
54 mylog
= strdup("/var/log/setup.log");
56 if (!(flog
= fopen(mylog
, "w+")))
58 printf("Couldn't open log terminal\n");
65 fprintf(flog
, "Setup program started.\n");
67 if (!setlocale(LC_CTYPE
,""))
68 fprintf(flog
, "Locale not spezified. Check LANG, LC_CTYPE, RC_ALL.");
71 if (!(readkeyvalues(kv
, CONFIG_ROOT
"/main/settings")))
73 printf("%s is not properly installed.\n", NAME
);
76 findkey(kv
, "LANGUAGE", selectedshortlang
);
78 for (langcounter
= 0; langtrs
[langcounter
]; langcounter
++)
80 if (strcmp(selectedshortlang
, shortlangnames
[langcounter
]) == 0)
82 ctr
= langtrs
[langcounter
];
89 for (choice
= 0; shortlangnames
[choice
]; choice
++)
91 if (strcmp(shortlangnames
[choice
], "en") == 0)
94 if (!shortlangnames
[choice
])
96 ctr
= langtrs
[choice
];
99 sections
[0] = ctr
[TR_KEYBOARD_MAPPING
];
100 sections
[1] = ctr
[TR_TIMEZONE
];
101 sections
[2] = ctr
[TR_HOSTNAME
];
102 sections
[3] = ctr
[TR_DOMAINNAME
];
103 sections
[4] = ctr
[TR_NETWORKING
];
104 sections
[5] = ctr
[TR_ISDN
];
105 sections
[6] = ctr
[TR_ROOT_PASSWORD
];
106 sections
[7] = ctr
[TR_ADMIN_PASSWORD
];
112 if ((f_title
= fopen ("/etc/issue", "r")))
114 fgets (title
, STRING_SIZE
, f_title
);
115 if (title
[strlen(title
) - 1] == '\n')
116 title
[strlen(title
) - 1] = '\0';
119 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
121 newtDrawRootText(14, 0, title
);
122 newtPushHelpLine(ctr
[TR_HELPLINE
]);
129 rc
= newtWinMenu(ctr
[TR_SECTION_MENU
],
130 ctr
[TR_SELECT_THE_ITEM
], 50, 5, 5, 11,
131 sections
, &choice
, ctr
[TR_OK
], ctr
[TR_QUIT
], NULL
);
163 handlerootpassword();
167 handleadminpassword();
177 if (!(handlekeymap()))
179 if (!(handletimezone()))
181 if (!(handlehostname()))
183 if (!(handledomainname()))
185 if (!(handlerootpassword()))
187 if (!(handleadminpassword()))
191 if (!(handlenetworking()))
202 sprintf (title
, "%s %s - %s", NAME
, VERSION
, SLOGAN
);
204 newtWinMessage(title
, ctr
[TR_OK
], ctr
[TR_SETUP_FINISHED
]);
207 newtWinMessage(ctr
[TR_WARNING
], ctr
[TR_OK
], ctr
[TR_SETUP_NOT_COMPLETE
]);
209 fprintf(flog
, "Setup program has not finished.\n");
219 fprintf(flog
, "Setup program ended.\n");