url: try wget from $PATH first and fallback to busybox wget

If GNU wget is available, then we want use it as it gives the user
possibility to set misc options, such as bandwidth limit in wgetrc.

It might also be that busybox is not available in case bootstrapping
alpine from other distros (think debian vserver host creating an
alpine guest)

In any case we, fall back to busybox wget in case wget libs are getting
upgraded. (see http://redmine.alpinelinux.org/issues/347)
cute-signatures
Natanael Copa 2011-03-11 08:34:42 +00:00
parent 1c6ab67984
commit ca85bcb7bd
1 changed files with 4 additions and 0 deletions

View File

@ -70,6 +70,10 @@ static int fork_wget(const char *url, pid_t *ppid)
close(fds[0]); close(fds[0]);
dup2(open("/dev/null", O_RDONLY), STDIN_FILENO); dup2(open("/dev/null", O_RDONLY), STDIN_FILENO);
dup2(fds[1], STDOUT_FILENO); dup2(fds[1], STDOUT_FILENO);
execlp("wget", "wget", "-q", "-O", "-", url, NULL);
/* fall back to busybox wget
* See http://redmine.alpinelinux.org/issues/347
*/
execlp("busybox", "wget", "-q", "-O", "-", url, NULL); execlp("busybox", "wget", "-q", "-O", "-", url, NULL);
exit(0); exit(0);
} }