]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/install+setup/install/net.c
PXE Boot integriert.
[people/teissler/ipfire-2.x.git] / src / install+setup / install / net.c
CommitLineData
d6aaa55d
MT
1/* SmoothWall install program.
2 *
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
5 *
6 * (c) Lawrence Manning, 2001
7 * Stuff for downloading the smoothwall tarball using wget.
8 *
d6aaa55d
MT
9 */
10
11#include "install.h"
12
13extern FILE *flog;
14extern char *mylog;
15
16extern char **ctr;
17
18static int got_url = 0;
19
9607771a 20char url[STRING_SIZE] = "http://";;
d6aaa55d 21
9607771a 22static int gettarballurl(char *url, char *message);
d6aaa55d 23
9607771a 24int checktarball(char *file, char *message)
d6aaa55d
MT
25{
26 int done;
27 int tries = 0;
28 char commandstring[STRING_SIZE];
29
30 done = 0;
31 while (!done)
32 {
9607771a 33 if (!got_url && gettarballurl(url, message) != 1)
d6aaa55d
MT
34 return 0;
35
36 /* remove any successive /'s */
37 while (url[strlen(url)-1] == '/') { url[strlen(url)-1] = '\0'; }
38
39 snprintf(commandstring, STRING_SIZE, "/bin/wget -s -O /dev/null %s/%s", url, file);
40 if (!(runcommandwithstatus(commandstring, ctr[TR_CHECKING])))
41 {
42 done = 1;
43 got_url = 1;
44 }
45 else
46 {
47 errorbox(ctr[TR_FAILED_TO_FIND]);
48 got_url = 0;
49 if (tries == 3)
9607771a 50 return 1; /* failure */
d6aaa55d
MT
51 }
52 tries++;
53 }
54
9607771a 55 return 0;
d6aaa55d
MT
56}
57
9607771a 58static int gettarballurl(char *url, char *message)
d6aaa55d 59{
9607771a 60 char *values[] = { url, NULL }; /* pointers for the values. */
d6aaa55d
MT
61 struct newtWinEntry entries[] =
62 { { "", &values[0], 0,}, { NULL, NULL, 0 } };
63 char title[STRING_SIZE];
d6aaa55d
MT
64 int rc;
65
d6aaa55d
MT
66 sprintf (title, "%s v%s - %s", NAME, VERSION, SLOGAN);
67 rc = newtWinEntries(title, message,
68 60, 5, 5, 50, entries, ctr[TR_OK], ctr[TR_CANCEL], NULL);
69
70 strncpy(url, values[0], STRING_SIZE);
71
72 return rc;
73}