2 * Copyright (c) 2000, Red Hat, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by DJ Delorie <dj@cygnus.com>
16 /* The purpose of this file is to download all the files we need to
17 do the installation. */
20 #include <sys/types.h>
36 download_one (char *name, int expected_size)
41 if (stat (local, &s) >= 0)
42 if (s.st_size == expected_size)
47 if (get_url_to_file (concat (MIRROR_SITE, "/", name, 0),
48 concat (local, ".tmp", 0),
51 note (IDS_DOWNLOAD_FAILED, name);
56 stat (concat (local, ".tmp", 0), &s);
57 if (s.st_size == expected_size)
59 log (0, "Downloaded %s", local);
60 rename (concat (local, ".tmp", 0), local);
64 log (0, "Download %s wrong size (%d actual vs %d expected)",
65 local, s.st_size, expected_size);
66 note (IDS_DOWNLOAD_SHORT, local, s.st_size, expected_size);
75 do_download (HINSTANCE h)
80 for (i=0; i<npackages; i++)
81 if (package[i].action == ACTION_NEW || package[i].action == ACTION_UPGRADE)
83 int e = download_one (pi.install, pi.install_size);
84 if (package[i].srcaction == SRCACTION_YES && pi.source)
85 e += download_one (pi.source, pi.source_size);
88 package[i].action = ACTION_ERROR;
91 dismiss_url_status_dialog ();
95 if (yesno (IDS_DOWNLOAD_INCOMPLETE) == IDYES)
97 next_dialog = IDD_SITE;
102 if (source == IDC_SOURCE_DOWNLOAD)
105 exit_msg = IDS_DOWNLOAD_INCOMPLETE;
107 exit_msg = IDS_DOWNLOAD_COMPLETE;
111 next_dialog = IDD_S_INSTALL;