*/
#include <curl/curl.h>
+#ifdef HAVE_GPGME
#include <gpgme.h>
+#endif
#include "opkg.h"
#include "opkg_download.h"
#include "opkg_message.h"
+#include "opkg_state.h"
#include "sprintf_alloc.h"
#include "xsystem.h"
double ulnow)
{
int i;
- int p = d*100/t;
+ int p = (t) ? d*100/t : 0;
#ifdef OPKG_LIB
if (opkg_cb_download_progress)
}
#endif
+ /* skip progress bar if we haven't done started yet
+ * this prevents drawing the progress bar if we receive an error such as
+ * file not found */
+ if (t == 0)
+ return 0;
+
printf ("\r%3d%% |", p);
for (i = 1; i < 73; i++)
{
curl_easy_cleanup (curl);
fclose (file);
if (res)
+ {
+ long error_code;
+ curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &error_code);
+ opkg_message(conf, OPKG_ERROR, "Failed to download %s, error %d\n", src, error_code);
return res;
+ }
}
else
{
int err;
char *url;
+ char *pkgid;
if (pkg->src == NULL) {
opkg_message(conf,OPKG_ERROR, "ERROR: Package %s (parent %s) is not available from any configured src.\n",
return -1;
}
+ sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture);
+ opkg_set_current_state (OPKG_STATE_DOWNLOADING_PKG, pkgid);
+ free (pkgid);
+
sprintf_alloc(&url, "%s/%s", pkg->src->value, pkg->filename);
/* XXX: BUG: The pkg->filename might be something like
err = opkg_download(conf, url, pkg->local_filename);
free(url);
+ opkg_set_current_state (OPKG_STATE_NONE, NULL);
return err;
}
int
opkg_verify_file (char *text_file, char *sig_file)
{
+#ifdef HAVE_GPGME
int status = -1;
gpgme_ctx_t ctx;
gpgme_data_t sig, text;
gpgme_release (ctx);
return status;
+#else
+ printf ("Signature check skipped because GPG support was not enabled in this build\n");
+ return 0;
+#endif
}