[syslinux] fix tails breakage and add support for fine grained versions

* With that obscene an amount of pre-releases of 6.03 (seriously, how
  many more YEARS pre-release of the same version do you actually need?),
  of course the syslinux people have managed to break the last remnants
  of compatibility they had between a single major version, so we are now
  forced to provide a smorgasbord of pre-release and out of band syslinux
  binaries on our server, and make sure we detect and handle incompatible
  syslinux versions clientside...
  For instance, even after fixing the EFI vs isolinux issue, we find
  that tails 1.1 is incompatible with 'pre19'. But it also uses its own
  '20131220' extended identifier, instead of 'pre1', its closest
  relative. So we have to multiply files and symbolic links to try to
  keep everybody happy.
  Talk about a MAJOR LETDOWN from the syslinux project...
* Closes #363
This commit is contained in:
Pete Batard 2014-08-06 00:57:32 +01:00
parent 60c66ef813
commit 0fceb38433
7 changed files with 167 additions and 75 deletions

View file

@ -41,6 +41,9 @@
/* Default delay between update checks (1 day) */
#define DEFAULT_UPDATE_INTERVAL (24*3600)
DWORD DownloadStatus;
BOOL PromptOnError = TRUE;
extern BOOL force_update;
static DWORD error_code;
static BOOL update_check_in_progress = FALSE;
@ -243,7 +246,7 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog)
{
HWND hProgressBar = NULL;
BOOL r = FALSE;
DWORD dwFlags, dwSize, dwDownloaded, dwTotalSize, dwStatus;
DWORD dwFlags, dwSize, dwDownloaded, dwTotalSize;
FILE* fd = NULL;
LONG progress_style;
const char* accept_types[] = {"*/*\0", NULL};
@ -255,6 +258,7 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog)
size_t last_slash;
int i;
DownloadStatus = 0;
if (hProgressDialog != NULL) {
// Use the progress control provided, if any
hProgressBar = GetDlgItem(hProgressDialog, IDC_PROGRESS);
@ -320,12 +324,12 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog)
}
// Get the file size
dwSize = sizeof(dwStatus);
dwStatus = 404;
HttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwStatus, &dwSize, NULL);
if (dwStatus != 200) {
dwSize = sizeof(DownloadStatus);
DownloadStatus = 404;
HttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&DownloadStatus, &dwSize, NULL);
if (DownloadStatus != 200) {
error_code = ERROR_INTERNET_ITEM_NOT_FOUND;
uprintf("Unable to access file: Server status %d\n", dwStatus);
uprintf("Unable to access file: Server status %d\n", DownloadStatus);
goto out;
}
dwSize = sizeof(dwTotalSize);
@ -373,10 +377,12 @@ out:
if (fd != NULL) fclose(fd);
if (!r) {
_unlink(file);
PrintStatus(0, FALSE, MSG_242);
SetLastError(error_code);
MessageBoxU(hMainDialog, IS_ERROR(FormatStatus)?StrError(FormatStatus, FALSE):WinInetErrorString(),
lmprintf(MSG_044), MB_OK|MB_ICONERROR|MB_IS_RTL);
if (PromptOnError) {
PrintStatus(0, FALSE, MSG_242);
SetLastError(error_code);
MessageBoxU(hMainDialog, IS_ERROR(FormatStatus)?StrError(FormatStatus, FALSE):WinInetErrorString(),
lmprintf(MSG_044), MB_OK|MB_ICONERROR|MB_IS_RTL);
}
}
if (hRequest) InternetCloseHandle(hRequest);
if (hConnection) InternetCloseHandle(hConnection);