diff options
author | tcely <tcely@users.noreply.github.com> | 2019-05-08 12:47:06 -0400 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2019-07-17 12:02:13 +0000 |
commit | 7bd32679b3cf4d2fe1238759e67b43a69bfb41bf (patch) | |
tree | 99a22adb75037dfa63a736a8059d186ade136c5f | |
parent | b7fd57f681099095f193a64f95a066a7a1ac8180 (diff) | |
download | abuild-7bd32679b3cf4d2fe1238759e67b43a69bfb41bf.tar.bz2 abuild-7bd32679b3cf4d2fe1238759e67b43a69bfb41bf.tar.xz |
abuild-fetch: add -k (insecure as in curl) option
-rw-r--r-- | abuild-fetch.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/abuild-fetch.c b/abuild-fetch.c index 7145d7e..1b9e4d0 100644 --- a/abuild-fetch.c +++ b/abuild-fetch.c @@ -29,11 +29,13 @@ THE SOFTWARE. #include <errno.h> #include <fcntl.h> #include <limits.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +bool insecure = false; static char *program; static char lockfile[PATH_MAX] = ""; @@ -133,6 +135,11 @@ int fetch(char *url, const char *destdir) if (access(outfile, F_OK) == 0) goto fetch_done; + if (insecure) { + add_opt(&curlcmd, "--insecure"); + add_opt(&wgetcmd, "--no-check-certificate"); + } + if (access(partfile, F_OK) == 0) { printf("Partial download found. Trying to resume.\n"); add_opt(&curlcmd, "-C"); @@ -192,7 +199,7 @@ int main(int argc, char *argv[]) char *destdir = "/var/cache/distfiles"; program = argv[0]; - while ((opt = getopt(argc, argv, "hd:")) != -1) { + while ((opt = getopt(argc, argv, "hd:k")) != -1) { switch (opt) { case 'h': return usage(0); @@ -200,6 +207,9 @@ int main(int argc, char *argv[]) case 'd': destdir = optarg; break; + case 'k': + insecure = true; + break; default: printf("Unknown option '%c'\n", opt); return usage(1); |