summaryrefslogtreecommitdiffstats
path: root/libopkg/opkg_download.c
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-27 12:26:46 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-27 12:26:46 (EST)
commitdd36f3cc97446d704474366e711fa0cc6ffe0917 (patch)
treef9791e612775fb3af0b9e3d5535a1e5276f2daff /libopkg/opkg_download.c
parent47daab916286d7ac837ecaadb607b09797822fc2 (diff)
adding --enable-curl configuation to configure.ac
Basically it apply opkg_wget.patch from OE but I add something to the configure.ac http://cgit.openembedded.net/cgit.cgi?url=openembedded/tree/packages/opkg/files/opkg_wget.patch&id=1bbdc74a5384c81d0bdeb96f6acdfef91430d35d Thanks Mike Westerhof <mwester@dls.net> git-svn-id: http://opkg.googlecode.com/svn/trunk@191 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/opkg_download.c')
-rw-r--r--libopkg/opkg_download.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c
index bc1cfaf..93b5084 100644
--- a/libopkg/opkg_download.c
+++ b/libopkg/opkg_download.c
@@ -17,7 +17,9 @@
General Public License for more details.
*/
#include "config.h"
+#ifdef HAVE_CURL
#include <curl/curl.h>
+#endif
#ifdef HAVE_GPGME
#include <gpgme.h>
#endif
@@ -77,6 +79,7 @@ int opkg_download(opkg_conf_t *conf, const char *src,
setenv("no_proxy", conf->no_proxy, 1);
}
+#ifdef HAVE_CURL
CURL *curl;
CURLcode res;
FILE * file = fopen (tmp_file_location, "w");
@@ -123,6 +126,27 @@ int opkg_download(opkg_conf_t *conf, const char *src,
free(src_basec);
return -1;
}
+#else
+ {
+ int res;
+ char *wgetcmd;
+ char *wgetopts;
+ wgetopts = getenv("OPKG_WGETOPTS");
+ sprintf_alloc(&wgetcmd, "wget -q %s%s -O \"%s\" \"%s\"",
+ (conf->http_proxy || conf->ftp_proxy) ? "-Y on " : "",
+ (wgetopts!=NULL) ? wgetopts : "",
+ tmp_file_location, src);
+ opkg_message(conf, OPKG_INFO, "Executing: %s\n", wgetcmd);
+ res = xsystem(wgetcmd);
+ free(wgetcmd);
+ if (res) {
+ opkg_message(conf, OPKG_ERROR, "Failed to download %s, error %d\n", src, res);
+ free(tmp_file_location);
+ free(src_basec);
+ return res;
+ }
+ }
+#endif
err = file_move(tmp_file_location, dest_file_name);