xbps-install(1): added -D, --download-only.

Added `-D, --download-only` flag to allow downloading
packages to the cache without attempting to install them.

Contributed by Toyam Cox via #9

Adapted to master by yours truly.

Close #9
This commit is contained in:
Juan RP
2019-06-21 15:57:25 +02:00
parent 4f717dc597
commit fe943eb7d2
5 changed files with 29 additions and 5 deletions

View File

@@ -47,6 +47,7 @@ usage(bool fail)
" -C --config <dir> Path to confdir (xbps.d)\n"
" -c --cachedir <dir> Path to cachedir\n"
" -d --debug Debug mode shown to stderr\n"
" -D --download-only Download packages and check integrity, nothing else.\n"
" -f --force Force package re-installation\n"
" If specified twice, all files will be\n"
" overwritten.\n"
@@ -95,12 +96,13 @@ repo_import_key_cb(struct xbps_repo *repo, void *arg UNUSED, bool *done UNUSED)
int
main(int argc, char **argv)
{
const char *shortopts = "AC:c:dfhIiMnR:r:SuUVvy";
const char *shortopts = "AC:c:DdfhIiMnR:r:SuUVvy";
const struct option longopts[] = {
{ "automatic", no_argument, NULL, 'A' },
{ "config", required_argument, NULL, 'C' },
{ "cachedir", required_argument, NULL, 'c' },
{ "debug", no_argument, NULL, 'd' },
{ "download-only", no_argument, NULL, 'D' },
{ "force", no_argument, NULL, 'f' },
{ "help", no_argument, NULL, 'h' },
{ "ignore-conf-repos", no_argument, NULL, 'i' },
@@ -144,6 +146,9 @@ main(int argc, char **argv)
case 'd':
flags |= XBPS_FLAG_DEBUG;
break;
case 'D':
flags |= XBPS_FLAG_DOWNLOAD_ONLY;
break;
case 'f':
fflag++;
if (fflag > 1)

View File

@@ -72,6 +72,11 @@ If the first character is not '/' then it's a relative path of
.Ar rootdir .
.It Fl d, Fl -debug
Enables extra debugging shown to stderr.
.It Fl D, Fl -download-only
Only download packages to the cache, do not do any other installation steps.
This may be useful for doing system upgrades while offline, or automatically
downloading updates while leaving you with the option of still manually running
the update.
.It Fl f, Fl -force
Force downgrade installation (if package version in repos is less than installed version),
or reinstallation (if package version in repos is the same) to the target