diff --git a/etc/pacman.conf.in b/etc/pacman.conf.in index b891de1..87b1028 100644 --- a/etc/pacman.conf.in +++ b/etc/pacman.conf.in @@ -34,6 +34,7 @@ Architecture = auto #TotalDownload CheckSpace #VerbosePkgLists +ResumeDls # PGP signature checking #SigLevel = Optional diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index c6d97c5..52ad2f2 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -533,6 +533,11 @@ int alpm_option_get_usesyslog(alpm_handle_t *handle); /** Sets whether to use syslog (0 is FALSE, TRUE otherwise). */ int alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog); +/** Returns whether to resume partial downloads (0 is FALSE, TRUE otherwise). */ +int alpm_option_get_resumedls(alpm_handle_t *handle); +/** Sets whether to resume partial downloads (0 is FALSE, TRUE otherwise). */ +int alpm_option_set_resumedls(alpm_handle_t *handle, int resumedls); + /** @name Accessors to the list of no-upgrade files. * These functions modify the list of files which should * not be updated by package installation. diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index b759c78..04fa57c 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -673,7 +673,7 @@ char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url) filepath = filecache_find_url(handle, url); if(filepath == NULL) { STRDUP(payload.fileurl, url, RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); - payload.allow_resume = 1; + payload.allow_resume = handle->resumedls; payload.handle = handle; /* download the file */ diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 53c86c5..630e633 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -223,6 +223,12 @@ int SYMEXPORT alpm_option_get_usesyslog(alpm_handle_t *handle) return handle->usesyslog; } +int SYMEXPORT alpm_option_get_resumedls(alpm_handle_t *handle) +{ + CHECK_HANDLE(handle, return -1); + return handle->resumedls; +} + alpm_list_t SYMEXPORT *alpm_option_get_noupgrades(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); @@ -464,6 +470,13 @@ int SYMEXPORT alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog) return 0; } +int SYMEXPORT alpm_option_set_resumedls(alpm_handle_t *handle, int resumedls) +{ + CHECK_HANDLE(handle, return -1); + handle->resumedls = resumedls; + return 0; +} + int SYMEXPORT alpm_option_add_noupgrade(alpm_handle_t *handle, const char *pkg) { CHECK_HANDLE(handle, return -1); diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index 5e84d58..3cd9eb1 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -91,6 +91,7 @@ struct __alpm_handle_t { double deltaratio; /* Download deltas if possible; a ratio value */ int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */ int checkspace; /* Check disk space before installing */ + int resumedls; /* Resume partial downloads */ alpm_siglevel_t siglevel; /* Default signature verification level */ alpm_siglevel_t localfilesiglevel; /* Signature verification level for local file upgrade operations */ diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index f9217bd..32cbc4e 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -867,7 +867,7 @@ static int download_single_file(alpm_handle_t *handle, struct dload_payload *pay const alpm_list_t *server; payload->handle = handle; - payload->allow_resume = 1; + payload->allow_resume = handle->resumedls; for(server = payload->servers; server; server = server->next) { const char *server_url = server->data; diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 2985aba..c275b53 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -478,6 +478,9 @@ static int _parse_options(const char *key, char *value, } else if(strcmp(key, "UseDelta") == 0) { config->deltaratio = 0.7; pm_printf(ALPM_LOG_DEBUG, "config: usedelta (default 0.7)\n"); + } else if(strcmp(key, "ResumeDls") == 0) { + config->resumedls = 1; + pm_printf(ALPM_LOG_DEBUG, "config: resumedls\n"); } else if(strcmp(key, "TotalDownload") == 0) { config->totaldownload = 1; pm_printf(ALPM_LOG_DEBUG, "config: totaldownload\n"); @@ -729,6 +732,7 @@ static int setup_libalpm(void) alpm_option_set_checkspace(handle, config->checkspace); alpm_option_set_usesyslog(handle, config->usesyslog); alpm_option_set_deltaratio(handle, config->deltaratio); + alpm_option_set_resumedls(handle, config->resumedls); alpm_option_set_ignorepkgs(handle, config->ignorepkg); alpm_option_set_ignoregroups(handle, config->ignoregrp); diff --git a/src/pacman/conf.h b/src/pacman/conf.h index dcd3204..aee3d46 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -42,6 +42,7 @@ typedef struct __config_t { unsigned short help; unsigned short noconfirm; unsigned short noprogressbar; + unsigned short resumedls; unsigned short logmask; unsigned short print; unsigned short checkspace;