xbps-{bin,repo}: add -B flag to set default repo if xbps.conf not found.

(cherry picked from commit 75eac1a1426040a833e0b10e208f2e55fa359532)
This commit is contained in:
Juan RP
2012-09-24 12:03:47 +02:00
parent 04fcb19567
commit 54b6cc7ec1
8 changed files with 52 additions and 16 deletions

View File

@@ -47,6 +47,7 @@ usage(bool fail)
"Usage: xbps-bin [options] target [arguments]\n\n"
"[options]\n"
" -A Enable Automatic installation (shown as orphan)\n"
" -B repo Set <repo> as default repository if xbps.conf not found.\n"
" -C file Full path to configuration file\n"
" -c cachedir Full path to cachedir, to store downloaded binpkgs\n"
" -d Debug mode shown to stderr\n"
@@ -111,23 +112,26 @@ main(int argc, char **argv)
struct xferstat xfer;
struct list_pkgver_cb lpc;
struct sigaction sa;
const char *rootdir, *cachedir, *conffile, *option;
const char *rootdir, *cachedir, *conffile, *option, *defrepo;
int i, c, flags, rv;
bool rsync, yes, reqby_force, force_rm_with_deps, recursive_rm;
bool reinstall, show_download_pkglist_url, dry_run;
size_t maxcols;
rootdir = cachedir = conffile = option = NULL;
rootdir = cachedir = conffile = option = defrepo = NULL;
flags = rv = 0;
reqby_force = rsync = yes = dry_run = force_rm_with_deps = false;
recursive_rm = reinstall = show_download_pkglist_url = false;
while ((c = getopt(argc, argv, "AC:c:dDFfhMno:Rr:SVvy")) != -1) {
while ((c = getopt(argc, argv, "AB:C:c:dDFfhMno:Rr:SVvy")) != -1) {
switch (c) {
case 'A':
flags |= XBPS_FLAG_INSTALL_AUTO;
break;
case 'B':
defrepo = optarg;
break;
case 'C':
conffile = optarg;
break;
@@ -210,6 +214,7 @@ main(int argc, char **argv)
xh.cachedir = cachedir;
xh.conffile = conffile;
xh.flags = flags;
xh.repository = defrepo;
if (flags & XBPS_FLAG_VERBOSE)
xh.unpack_cb = unpack_progress_cb_verbose;
else

View File

@@ -1,4 +1,4 @@
.Dd June 5, 2012
.Dd September 24, 2012
.Os Void GNU/Linux
.Dt xbps-bin 8
.Sh NAME
@@ -36,6 +36,9 @@ and
.Em update
targets.
Targetted packages and its required dependencies will be matched.
.It Fl B Ar repository
If a configuration file cannot be found, this repository will be used as
as primary source to install packages.
.It Fl C Ar conffile
Full path to the XBPS configuration file. By default set to
.Pa /etc/xbps/xbps.conf .

View File

@@ -44,6 +44,7 @@ usage(bool fail)
fprintf(stdout,
"Usage: xbps-repo [options] target [arguments]\n\n"
"[options]\n"
" -B repo Set <repo> as default repository if xbps.conf not found.\n"
" -C file Full path to configuration file\n"
" -c cachedir Full path to cachedir to store downloaded binpkgs\n"
" -d Debug mode shown to stderr\n"
@@ -92,13 +93,16 @@ main(int argc, char **argv)
struct xferstat xfer;
struct repo_search_data rsd;
prop_dictionary_t pkgd;
const char *rootdir, *cachedir, *conffile, *option;
const char *rootdir, *cachedir, *conffile, *option, *defrepo;
int flags = 0, c, rv = 0;
rootdir = cachedir = conffile = option = NULL;
rootdir = cachedir = conffile = option = defrepo = NULL;
while ((c = getopt(argc, argv, "C:c:dho:r:V")) != -1) {
while ((c = getopt(argc, argv, "B:C:c:dho:r:V")) != -1) {
switch (c) {
case 'B':
defrepo = optarg;
break;
case 'C':
conffile = optarg;
break;
@@ -144,6 +148,7 @@ main(int argc, char **argv)
xh.rootdir = rootdir;
xh.cachedir = cachedir;
xh.conffile = conffile;
xh.repository = defrepo;
if ((rv = xbps_init(&xh)) != 0) {
xbps_error_printf("xbps-repo: couldn't initialize library: %s\n",

View File

@@ -1,4 +1,4 @@
.Dd July 31, 2012
.Dd September 24, 2012
.Os Void GNU/Linux
.Dt xbps-repo 8
.Sh NAME
@@ -18,6 +18,9 @@ repositories, list repositories, search for packages and show information
of a binary package in repository pool, among other things.
.Sh OPTIONS
.Bl -tag -width Fl
.It Fl B Ar repository
If a configuration file cannot be found, this repository will be used as
as primary source to install packages.
.It Fl C Ar conffile
Full path to the XBPS configuration file. By default set to
.Pa /etc/xbps/xbps.conf .