Subject: Look for presence of Packages.gz

Accept some APT-compatible repositories.
xasprintf() should be used for error checking now.

Index: choose-mirror-2.79/choose-mirror.c
===================================================================
--- choose-mirror-2.79.orig/choose-mirror.c
+++ choose-mirror-2.79/choose-mirror.c
@@ -910,6 +910,20 @@ int check_arch (void) {
 					valid = 1;
 		}
 		pclose(f);
+
+		if (!valid) {
+			// TODO: Some error checking would be nice
+			asprintf(&command,
+				"wget -q --spider %s://%s%s/dists/%s/main"
+				"/binary-%s/Packages.gz", protocol, hostname,
+				directory, codename, ARCH_TEXT);
+			di_log(DI_LOG_LEVEL_DEBUG, "command: %s", command);
+			int status = system(command);
+			free(command);
+
+			if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
+				valid = 1;
+		}
 	}
 
 	free(hostname);
