xbps-fetch(1): new utility that replaces 'xbps-uhelper fetch'.
xbps-install(1): document all libfetch env vars. Signed-off-by: Juan RP <xtraeme@gmail.com>
This commit is contained in:
parent
9cda7ef72a
commit
8cea3e351b
@ -13,6 +13,7 @@ SUBDIRS += xbps-uhelper
|
|||||||
SUBDIRS += xbps-checkvers
|
SUBDIRS += xbps-checkvers
|
||||||
SUBDIRS += xbps-fbulk
|
SUBDIRS += xbps-fbulk
|
||||||
SUBDIRS += xbps-digest
|
SUBDIRS += xbps-digest
|
||||||
|
SUBDIRS += xbps-fetch
|
||||||
|
|
||||||
ifeq (${XBPS_OS},linux)
|
ifeq (${XBPS_OS},linux)
|
||||||
SUBDIRS += xbps-uchroot
|
SUBDIRS += xbps-uchroot
|
||||||
|
@ -75,6 +75,7 @@ Default cache directory to store downloaded binary packages.
|
|||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
|
@ -53,6 +53,7 @@ Show the version information.
|
|||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
|
@ -95,6 +95,7 @@ The package changelog string.
|
|||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
|
@ -122,11 +122,11 @@ Default package database (0.38 format). Keeps track of installed packages and pr
|
|||||||
Default cache directory to store downloaded binary packages.
|
Default cache directory to store downloaded binary packages.
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr xbps.d 5 ,
|
|
||||||
.Xr xbps-checkvers 1 ,
|
.Xr xbps-checkvers 1 ,
|
||||||
.Xr xbps-create 1 ,
|
.Xr xbps-create 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
@ -134,7 +134,8 @@ Default cache directory to store downloaded binary packages.
|
|||||||
.Xr xbps-remove 1 ,
|
.Xr xbps-remove 1 ,
|
||||||
.Xr xbps-rindex 1 ,
|
.Xr xbps-rindex 1 ,
|
||||||
.Xr xbps-uchroot 1 ,
|
.Xr xbps-uchroot 1 ,
|
||||||
.Xr xbps-uunshare 1
|
.Xr xbps-uunshare 1 ,
|
||||||
|
.Xr xbps.d 5
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An Juan Romero Pardines <xtraeme@gmail.com>
|
.An Juan Romero Pardines <xtraeme@gmail.com>
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
|
@ -29,11 +29,11 @@ Show the help message.
|
|||||||
Show the version information.
|
Show the version information.
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr xbps.d 5 ,
|
|
||||||
.Xr xbps-checkvers 1 ,
|
.Xr xbps-checkvers 1 ,
|
||||||
.Xr xbps-create 1 ,
|
.Xr xbps-create 1 ,
|
||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
@ -41,7 +41,8 @@ Show the version information.
|
|||||||
.Xr xbps-remove 1 ,
|
.Xr xbps-remove 1 ,
|
||||||
.Xr xbps-rindex 1 ,
|
.Xr xbps-rindex 1 ,
|
||||||
.Xr xbps-uchroot 1 ,
|
.Xr xbps-uchroot 1 ,
|
||||||
.Xr xbps-uunshare 1
|
.Xr xbps-uunshare 1 ,
|
||||||
|
.Xr xbps.d 5
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An Juan Romero Pardines <xtraeme@gmail.com>
|
.An Juan Romero Pardines <xtraeme@gmail.com>
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
|
@ -89,6 +89,7 @@ and the kernel supports the overlay filesystem, introduced in 4.0.
|
|||||||
.Xr xbps-create 1 ,
|
.Xr xbps-create 1 ,
|
||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
|
7
bin/xbps-fetch/Makefile
Normal file
7
bin/xbps-fetch/Makefile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
TOPDIR = ../..
|
||||||
|
-include $(TOPDIR)/config.mk
|
||||||
|
|
||||||
|
BIN = xbps-fetch
|
||||||
|
OBJS = main.o ../xbps-install/fetch_cb.o
|
||||||
|
|
||||||
|
include $(TOPDIR)/mk/prog.mk
|
134
bin/xbps-fetch/main.c
Normal file
134
bin/xbps-fetch/main.c
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 2019 Juan Romero Pardines.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
|
||||||
|
#include <xbps.h>
|
||||||
|
#include "../xbps-install/defs.h"
|
||||||
|
|
||||||
|
static void __attribute__((noreturn))
|
||||||
|
usage(void)
|
||||||
|
{
|
||||||
|
fprintf(stdout,
|
||||||
|
"Usage: xbps-fetch [options] <url> <url+N>\n\n"
|
||||||
|
"OPTIONS:\n"
|
||||||
|
" -d\t\tEnable debug messages to stderr\n"
|
||||||
|
" -h\t\tShow usage()\n"
|
||||||
|
" -o <file>\tRename downloaded file to <file>\n"
|
||||||
|
" -v\t\tEnable verbose output\n"
|
||||||
|
" -V\t\tPrints the xbps release version\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
fname(char *url)
|
||||||
|
{
|
||||||
|
char *filename;
|
||||||
|
|
||||||
|
if ((filename = strrchr(url, '>'))) {
|
||||||
|
*filename = '\0';
|
||||||
|
} else {
|
||||||
|
filename = strrchr(url, '/');
|
||||||
|
}
|
||||||
|
if (filename == NULL)
|
||||||
|
return NULL;
|
||||||
|
return filename + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int flags = 0, c = 0, rv = 0;
|
||||||
|
bool verbose = false;
|
||||||
|
struct xbps_handle xh = {};
|
||||||
|
struct xferstat xfer = {};
|
||||||
|
const char *filename = NULL, *progname = argv[0];
|
||||||
|
const struct option longopts[] = {
|
||||||
|
{ NULL, 0, NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
while ((c = getopt_long(argc, argv, "o:dhVv", longopts, NULL)) != -1) {
|
||||||
|
switch (c) {
|
||||||
|
case 'o':
|
||||||
|
filename = optarg;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
flags |= XBPS_FLAG_DEBUG;
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
verbose = true;
|
||||||
|
break;
|
||||||
|
case 'V':
|
||||||
|
printf("%s\n", XBPS_RELVER);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
case '?':
|
||||||
|
case 'h':
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
argc -= optind;
|
||||||
|
argv += optind;
|
||||||
|
|
||||||
|
if (!argc)
|
||||||
|
usage();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize libxbps.
|
||||||
|
*/
|
||||||
|
xh.flags = flags;
|
||||||
|
xh.fetch_cb = fetch_file_progress_cb;
|
||||||
|
xh.fetch_cb_data = &xfer;
|
||||||
|
if ((rv = xbps_init(&xh)) != 0) {
|
||||||
|
xbps_error_printf("%s: failed to initialize libxbps: %s\n",
|
||||||
|
progname, strerror(rv));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < argc; i++) {
|
||||||
|
if ((argc == 1) && !filename)
|
||||||
|
filename = fname(argv[i]);
|
||||||
|
|
||||||
|
rv = xbps_fetch_file_dest(&xh, argv[i], filename, verbose ? "v" : "");
|
||||||
|
|
||||||
|
if (rv == -1) {
|
||||||
|
fprintf(stderr, "%s: %s\n", argv[i], xbps_fetch_error_string());
|
||||||
|
} else if (rv == 0) {
|
||||||
|
printf("%s: file is identical with remote.\n", argv[i]);
|
||||||
|
} else {
|
||||||
|
rv = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xbps_end(&xh);
|
||||||
|
exit(rv ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||||
|
}
|
101
bin/xbps-fetch/xbps-fetch.1
Normal file
101
bin/xbps-fetch/xbps-fetch.1
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
.Dd June 12, 2019
|
||||||
|
.Dt XBPS-FETCH 1
|
||||||
|
.Sh NAME
|
||||||
|
.Nm xbps-fetch
|
||||||
|
.Nd XBPS utility to fetch files from URLs
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm xbps-fetch
|
||||||
|
.Op OPTIONS
|
||||||
|
.Ar <URL>
|
||||||
|
.Ar <URL+N>
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
utility downloads files from specified URLs.
|
||||||
|
Multiple protocols are supported:
|
||||||
|
.Ar ftp ,
|
||||||
|
.Ar http ,
|
||||||
|
.Ar https ,
|
||||||
|
.Ar socks5 .
|
||||||
|
.Sh OPTIONS
|
||||||
|
.Bl -tag -width -x
|
||||||
|
.It Fl d
|
||||||
|
Enables debug messages on stderr.
|
||||||
|
.It Fl h
|
||||||
|
Show the help message.
|
||||||
|
.It Fl o Ar output
|
||||||
|
Rename file from specified URL to
|
||||||
|
.Ar output .
|
||||||
|
.It Fl v
|
||||||
|
Enables verbose messages.
|
||||||
|
.It Fl V
|
||||||
|
Show the version information.
|
||||||
|
.El
|
||||||
|
.Sh ENVIRONMENT
|
||||||
|
.Bl -tag -width -x
|
||||||
|
.It Sy FTP_PASSIVE_MODE
|
||||||
|
If set to anything else than
|
||||||
|
.Ar "no"
|
||||||
|
passive mode will be set for the ftp connection.
|
||||||
|
.It Sy FTP_LOGIN
|
||||||
|
User name to be set for ftp authentication.
|
||||||
|
.It Sy FTP_PASSWORD
|
||||||
|
Password to be set for ftp authentication.
|
||||||
|
.It Sy FTP_PROXY
|
||||||
|
Proxy URL that will be used to establish a ftp connection.
|
||||||
|
.It Sy HTTP_PROXY
|
||||||
|
Proxy URL that will be used to establish a http connection.
|
||||||
|
.It Sy HTTP_PROXY_AUTH
|
||||||
|
Sets the credentials to authenticate a user agent to a proxy server, in the form
|
||||||
|
.Ar user:pass .
|
||||||
|
.It Sy HTTP_AUTH
|
||||||
|
Sets the credentials to authenticate to a http server, in the form
|
||||||
|
.Ar user:pass .
|
||||||
|
.It Sy HTTP_REFERER
|
||||||
|
Overrides the default Referer http header.
|
||||||
|
.It Sy HTTP_USER_AGENT
|
||||||
|
Override the default User-Agent http header.
|
||||||
|
.It Sy NO_PROXY
|
||||||
|
Specifies a set of domains for which the proxy should not be consulted.
|
||||||
|
The contents is a comma-, or space-separated list of domain names.
|
||||||
|
A single asterisk will override all proxy variables and no transactions
|
||||||
|
will be proxied.
|
||||||
|
.It Sy SOCKS_PROXY
|
||||||
|
Proxy URL that will be used to establish a socks connection.
|
||||||
|
.It Sy SSL_NO_VERIFY_HOSTNAME
|
||||||
|
Disables SSL/TLS hostname verification.
|
||||||
|
.It Sy SSL_NO_VERIFY_PEER
|
||||||
|
Disables SSL/TLS peer verification.
|
||||||
|
.It Sy SSL_CA_CERT_FILE
|
||||||
|
Overrides the default CA certificates file, by default set to
|
||||||
|
.Ar /etc/ssl/certs/ca-certificates.crt .
|
||||||
|
.It Sy SSL_CA_CERT_PATH
|
||||||
|
Overrides the default CA certificates path, by default set to
|
||||||
|
.Ar /etc/ssl/certs .
|
||||||
|
.It Sy SSL_CLIENT_CERT_FILE
|
||||||
|
Sets the SSL/TLS client verification certificate file.
|
||||||
|
.It Sy SSL_CLIENT_KEY_FILE
|
||||||
|
Sets the SSL/TLS client verification key file.
|
||||||
|
.El
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Xr xbps-checkvers 1 ,
|
||||||
|
.Xr xbps-create 1 ,
|
||||||
|
.Xr xbps-dgraph 1 ,
|
||||||
|
.Xr xbps-digest 1 ,
|
||||||
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-install 1 ,
|
||||||
|
.Xr xbps-pkgdb 1 ,
|
||||||
|
.Xr xbps-query 1 ,
|
||||||
|
.Xr xbps-reconfigure 1 ,
|
||||||
|
.Xr xbps-remove 1 ,
|
||||||
|
.Xr xbps-rindex 1 ,
|
||||||
|
.Xr xbps-uchroot 1 ,
|
||||||
|
.Xr xbps-uunshare 1 ,
|
||||||
|
.Xr xbps.d 5
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Juan Romero Pardines <xtraeme@gmail.com>
|
||||||
|
.Sh BUGS
|
||||||
|
Probably, but I try to make this not happen.
|
||||||
|
Use it under your own responsibility and enjoy your life.
|
||||||
|
.Pp
|
||||||
|
Report bugs at https://github.com/void-linux/xbps/issues
|
@ -15,7 +15,9 @@ The argument
|
|||||||
.Ar PKG
|
.Ar PKG
|
||||||
is a package expression, which is explained in the
|
is a package expression, which is explained in the
|
||||||
.Em PACKAGE EXPRESSION
|
.Em PACKAGE EXPRESSION
|
||||||
section. If package is installed, it will be updated to the version available in repositories
|
section.
|
||||||
|
.Pp
|
||||||
|
If package is installed, it will be updated to the version available in repositories
|
||||||
matching the
|
matching the
|
||||||
.Em PACKAGE EXPRESSION .
|
.Em PACKAGE EXPRESSION .
|
||||||
Otherwise it will be installed, or reinstalled/downgraded if
|
Otherwise it will be installed, or reinstalled/downgraded if
|
||||||
@ -125,7 +127,50 @@ Assume yes to all questions and avoid interactive questions.
|
|||||||
Show the version information.
|
Show the version information.
|
||||||
.El
|
.El
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
.Bl -tag -width XBPS_TARGET_ARCH
|
.Bl -tag -width SSL_NO_VERIFY_HOSTNAME
|
||||||
|
.It Sy FTP_PASSIVE_MODE
|
||||||
|
If set to anything else than
|
||||||
|
.Ar "no"
|
||||||
|
passive mode will be set for the ftp connection.
|
||||||
|
.It Sy FTP_LOGIN
|
||||||
|
User name to be set for ftp authentication.
|
||||||
|
.It Sy FTP_PASSWORD
|
||||||
|
Password to be set for ftp authentication.
|
||||||
|
.It Sy FTP_PROXY
|
||||||
|
Proxy URL that will be used to establish a ftp connection.
|
||||||
|
.It Sy HTTP_PROXY
|
||||||
|
Proxy URL that will be used to establish a http connection.
|
||||||
|
.It Sy HTTP_PROXY_AUTH
|
||||||
|
Sets the credentials to authenticate a user agent to a proxy server, in the form
|
||||||
|
.Ar user:pass .
|
||||||
|
.It Sy HTTP_AUTH
|
||||||
|
Sets the credentials to authenticate to a http server, in the form
|
||||||
|
.Ar user:pass .
|
||||||
|
.It Sy HTTP_REFERER
|
||||||
|
Overrides the default Referer http header.
|
||||||
|
.It Sy HTTP_USER_AGENT
|
||||||
|
Override the default User-Agent http header.
|
||||||
|
.It Sy NO_PROXY
|
||||||
|
Specifies a set of domains for which the proxy should not be consulted.
|
||||||
|
The contents is a comma-, or space-separated list of domain names.
|
||||||
|
A single asterisk will override all proxy variables and no transactions
|
||||||
|
will be proxied.
|
||||||
|
.It Sy SOCKS_PROXY
|
||||||
|
Proxy URL that will be used to establish a socks connection.
|
||||||
|
.It Sy SSL_NO_VERIFY_HOSTNAME
|
||||||
|
Disables SSL/TLS hostname verification.
|
||||||
|
.It Sy SSL_NO_VERIFY_PEER
|
||||||
|
Disables SSL/TLS peer verification.
|
||||||
|
.It Sy SSL_CA_CERT_FILE
|
||||||
|
Overrides the default CA certificates file, by default set to
|
||||||
|
.Ar /etc/ssl/certs/ca-certificates.crt .
|
||||||
|
.It Sy SSL_CA_CERT_PATH
|
||||||
|
Overrides the default CA certificates path, by default set to
|
||||||
|
.Ar /etc/ssl/certs .
|
||||||
|
.It Sy SSL_CLIENT_CERT_FILE
|
||||||
|
Sets the SSL/TLS client verification certificate file.
|
||||||
|
.It Sy SSL_CLIENT_KEY_FILE
|
||||||
|
Sets the SSL/TLS client verification key file.
|
||||||
.It Sy XBPS_ARCH
|
.It Sy XBPS_ARCH
|
||||||
Overrides
|
Overrides
|
||||||
.Xr uname 2
|
.Xr uname 2
|
||||||
@ -157,6 +202,7 @@ Default cache directory to store downloaded binary packages.
|
|||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
.Xr xbps-reconfigure 1 ,
|
.Xr xbps-reconfigure 1 ,
|
||||||
|
@ -127,6 +127,7 @@ Default cache directory to store downloaded binary packages.
|
|||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
.Xr xbps-reconfigure 1 ,
|
.Xr xbps-reconfigure 1 ,
|
||||||
|
@ -270,6 +270,8 @@ Default cache directory to store downloaded binary packages.
|
|||||||
.Xr xbps-create 1 ,
|
.Xr xbps-create 1 ,
|
||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-reconfigure 1 ,
|
.Xr xbps-reconfigure 1 ,
|
||||||
|
@ -80,6 +80,7 @@ Default cache directory to store downloaded binary packages.
|
|||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
|
@ -116,6 +116,7 @@ Default cache directory to store downloaded binary packages.
|
|||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
|
@ -98,6 +98,7 @@ a repository. Otherwise it will ask you to enter the passphrase on the terminal.
|
|||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
|
@ -77,6 +77,7 @@ other Operating Systems. The following kernel options must be enabled:
|
|||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
|
@ -2,7 +2,7 @@ TOPDIR = ../..
|
|||||||
-include $(TOPDIR)/config.mk
|
-include $(TOPDIR)/config.mk
|
||||||
|
|
||||||
BIN = xbps-uhelper
|
BIN = xbps-uhelper
|
||||||
OBJS = main.o ../xbps-install/fetch_cb.o
|
OBJS = main.o
|
||||||
MAN =
|
MAN =
|
||||||
|
|
||||||
include $(TOPDIR)/mk/prog.mk
|
include $(TOPDIR)/mk/prog.mk
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#include <xbps.h>
|
#include <xbps.h>
|
||||||
#include "../xbps-install/defs.h"
|
|
||||||
|
|
||||||
static void __attribute__((noreturn))
|
static void __attribute__((noreturn))
|
||||||
usage(void)
|
usage(void)
|
||||||
@ -52,7 +51,6 @@ usage(void)
|
|||||||
" binpkgarch\t<binpkg>\n"
|
" binpkgarch\t<binpkg>\n"
|
||||||
" binpkgver\t<binpkg>\n"
|
" binpkgver\t<binpkg>\n"
|
||||||
" cmpver\t\t<instver> <reqver>\n"
|
" cmpver\t\t<instver> <reqver>\n"
|
||||||
" fetch\t\t<URL[>filename]> <URL1+N[>filename]>\n"
|
|
||||||
" getpkgdepname\t<string>\n"
|
" getpkgdepname\t<string>\n"
|
||||||
" getpkgdepversion\t<string>\n"
|
" getpkgdepversion\t<string>\n"
|
||||||
" getpkgname\t\t<string>\n"
|
" getpkgname\t\t<string>\n"
|
||||||
@ -70,7 +68,6 @@ usage(void)
|
|||||||
"\n"
|
"\n"
|
||||||
" Examples:\n"
|
" Examples:\n"
|
||||||
" $ xbps-uhelper cmpver 'foo-1.0_1' 'foo-2.1_1'\n"
|
" $ xbps-uhelper cmpver 'foo-1.0_1' 'foo-2.1_1'\n"
|
||||||
" $ xbps-uhelper fetch http://www.foo.org/file.blob ...\n"
|
|
||||||
" $ xbps-uhelper getpkgdepname 'foo>=0'\n"
|
" $ xbps-uhelper getpkgdepname 'foo>=0'\n"
|
||||||
" $ xbps-uhelper getpkgdepversion 'foo>=0'\n"
|
" $ xbps-uhelper getpkgdepversion 'foo>=0'\n"
|
||||||
" $ xbps-uhelper getpkgname foo-2.0_1\n"
|
" $ xbps-uhelper getpkgname foo-2.0_1\n"
|
||||||
@ -82,28 +79,13 @@ usage(void)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char*
|
|
||||||
fname(char *url) {
|
|
||||||
char *filename;
|
|
||||||
|
|
||||||
if( (filename = strrchr(url, '>')) ) {
|
|
||||||
*filename = '\0';
|
|
||||||
} else {
|
|
||||||
filename = strrchr(url, '/');
|
|
||||||
}
|
|
||||||
if(filename == NULL)
|
|
||||||
return NULL;
|
|
||||||
return filename + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
xbps_dictionary_t dict;
|
xbps_dictionary_t dict;
|
||||||
struct xbps_handle xh;
|
struct xbps_handle xh;
|
||||||
struct xferstat xfer;
|
|
||||||
const char *version, *rootdir = NULL, *confdir = NULL;
|
const char *version, *rootdir = NULL, *confdir = NULL;
|
||||||
char *pkgname, *filename;
|
char *pkgname;
|
||||||
int flags = 0, c, rv = 0;
|
int flags = 0, c, rv = 0;
|
||||||
const struct option longopts[] = {
|
const struct option longopts[] = {
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
@ -141,14 +123,11 @@ main(int argc, char **argv)
|
|||||||
if ((strcmp(argv[0], "version") == 0) ||
|
if ((strcmp(argv[0], "version") == 0) ||
|
||||||
(strcmp(argv[0], "real-version") == 0) ||
|
(strcmp(argv[0], "real-version") == 0) ||
|
||||||
(strcmp(argv[0], "arch") == 0) ||
|
(strcmp(argv[0], "arch") == 0) ||
|
||||||
(strcmp(argv[0], "getsystemdir") == 0) ||
|
(strcmp(argv[0], "getsystemdir") == 0)) {
|
||||||
(strcmp(argv[0], "fetch") == 0)) {
|
|
||||||
/*
|
/*
|
||||||
* Initialize libxbps.
|
* Initialize libxbps.
|
||||||
*/
|
*/
|
||||||
xh.flags = flags;
|
xh.flags = flags;
|
||||||
xh.fetch_cb = fetch_file_progress_cb;
|
|
||||||
xh.fetch_cb_data = &xfer;
|
|
||||||
if (rootdir)
|
if (rootdir)
|
||||||
xbps_strlcpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
|
xbps_strlcpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
|
||||||
if (confdir)
|
if (confdir)
|
||||||
@ -289,24 +268,6 @@ main(int argc, char **argv)
|
|||||||
usage();
|
usage();
|
||||||
|
|
||||||
printf("%s\n", XBPS_SYSDEFCONF_PATH);
|
printf("%s\n", XBPS_SYSDEFCONF_PATH);
|
||||||
} else if (strcmp(argv[0], "fetch") == 0) {
|
|
||||||
/* Fetch a file from specified URL */
|
|
||||||
if (argc < 2)
|
|
||||||
usage();
|
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++) {
|
|
||||||
filename = fname(argv[i]);
|
|
||||||
rv = xbps_fetch_file_dest(&xh, argv[i], filename, "v");
|
|
||||||
|
|
||||||
if (rv == -1) {
|
|
||||||
fprintf(stderr, "%s: %s\n", argv[i],
|
|
||||||
xbps_fetch_error_string());
|
|
||||||
} else if (rv == 0) {
|
|
||||||
printf("%s: file is identical with remote.\n",
|
|
||||||
argv[i]);
|
|
||||||
} else
|
|
||||||
rv = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ other Operating Systems. The following kernel options must be enabled:
|
|||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
.Xr xbps-fbulk 1 ,
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
|
@ -142,6 +142,8 @@ Default cache directory to store downloaded binary packages.
|
|||||||
.Xr xbps-create 1 ,
|
.Xr xbps-create 1 ,
|
||||||
.Xr xbps-dgraph 1 ,
|
.Xr xbps-dgraph 1 ,
|
||||||
.Xr xbps-digest 1 ,
|
.Xr xbps-digest 1 ,
|
||||||
|
.Xr xbps-fbulk 1 ,
|
||||||
|
.Xr xbps-fetch 1 ,
|
||||||
.Xr xbps-install 1 ,
|
.Xr xbps-install 1 ,
|
||||||
.Xr xbps-pkgdb 1 ,
|
.Xr xbps-pkgdb 1 ,
|
||||||
.Xr xbps-query 1 ,
|
.Xr xbps-query 1 ,
|
||||||
|
Loading…
Reference in New Issue
Block a user