diff options
author | flz <flz@FreeBSD.org> | 2006-01-09 18:27:21 +0000 |
---|---|---|
committer | flz <flz@FreeBSD.org> | 2006-01-09 18:27:21 +0000 |
commit | c97d1806500049ffe6c3e8091ab4cfb4c997281e (patch) | |
tree | 1d907422a2b7e64739038fb6d8d33e072dc613d3 /usr.sbin/pkg_install/add | |
parent | 93d7e294fcdb0d064bd15e9208026d662d5c43ce (diff) | |
download | FreeBSD-src-c97d1806500049ffe6c3e8091ab4cfb4c997281e.zip FreeBSD-src-c97d1806500049ffe6c3e8091ab4cfb4c997281e.tar.gz |
Add -K option to pkg_add and pkg_info.
This option saves packages to PKGDIR (if defined or current directory by default)
as they are downloaded.
Silent a warning when -n is used and package has a +DISPLAY file.
Approved by: krion
MFC after: 1 week
Diffstat (limited to 'usr.sbin/pkg_install/add')
-rw-r--r-- | usr.sbin/pkg_install/add/add.h | 1 | ||||
-rw-r--r-- | usr.sbin/pkg_install/add/main.c | 10 | ||||
-rw-r--r-- | usr.sbin/pkg_install/add/perform.c | 11 | ||||
-rw-r--r-- | usr.sbin/pkg_install/add/pkg_add.1 | 14 |
4 files changed, 27 insertions, 9 deletions
diff --git a/usr.sbin/pkg_install/add/add.h b/usr.sbin/pkg_install/add/add.h index c8e8456..654a101 100644 --- a/usr.sbin/pkg_install/add/add.h +++ b/usr.sbin/pkg_install/add/add.h @@ -29,6 +29,7 @@ extern char *Prefix; extern Boolean PrefixRecursive; extern Boolean NoInstall; extern Boolean NoRecord; +extern Boolean KeepPackage; extern char *Mode; extern char *Owner; extern char *Group; diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index 37e0a17..5f689bd 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$"); #include "lib.h" #include "add.h" -static char Options[] = "hvIRfnrp:P:SMt:C:"; +static char Options[] = "hvIRfnrp:P:SMt:C:K"; char *Prefix = NULL; Boolean PrefixRecursive = FALSE; @@ -35,6 +35,7 @@ char *Chroot = NULL; Boolean NoInstall = FALSE; Boolean NoRecord = FALSE; Boolean Remote = FALSE; +Boolean KeepPackage = FALSE; char *Mode = NULL; char *Owner = NULL; @@ -131,9 +132,12 @@ main(int argc, char **argv) Force = TRUE; break; + case 'K': + KeepPackage = TRUE; + break; + case 'n': Fake = TRUE; - Verbose = TRUE; break; case 'r': @@ -317,7 +321,7 @@ static void usage() { fprintf(stderr, "%s\n%s\n", - "usage: pkg_add [-vInrfRMS] [-t template] [-p prefix] [-P prefix] [-C chrootdir]", + "usage: pkg_add [-vInrfRMSK] [-t template] [-p prefix] [-P prefix] [-C chrootdir]", " pkg-name [pkg-name ...]"); exit(1); } diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index 56a06b1..2050e51 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -102,7 +102,7 @@ pkg_do(char *pkg) else { /* Is it an ftp://foo.bar.baz/file.t[bg]z specification? */ if (isURL(pkg)) { - if (!(Home = fileGetURL(NULL, pkg))) { + if (!(Home = fileGetURL(NULL, pkg, KeepPackage))) { warnx("unable to fetch '%s' by URL", pkg); return 1; } @@ -334,7 +334,7 @@ pkg_do(char *pkg) ++code; } } - else if ((cp = fileGetURL(pkg, p->name)) != NULL) { + else if ((cp = fileGetURL(pkg, p->name, KeepPackage)) != NULL) { if (Verbose) printf("Finished loading %s over FTP.\n", p->name); if (!fexists("+CONTENTS")) { @@ -547,8 +547,11 @@ pkg_do(char *pkg) fputs(buf, stdout); putc('\n', stdout); (void) fclose(fp); - } else - warnx("cannot open %s as display file", buf); + } else { + if (!Fake) { + warnx("cannot open %s as display file", buf); + } + } } goto success; diff --git a/usr.sbin/pkg_install/add/pkg_add.1 b/usr.sbin/pkg_install/add/pkg_add.1 index b92518c..26a52fc 100644 --- a/usr.sbin/pkg_install/add/pkg_add.1 +++ b/usr.sbin/pkg_install/add/pkg_add.1 @@ -15,7 +15,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 12, 2005 +.Dd January 9, 2006 .Dt PKG_ADD 1 .Os .Sh NAME @@ -23,7 +23,7 @@ .Nd a utility for installing software package distributions .Sh SYNOPSIS .Nm -.Op Fl vInfrRMS +.Op Fl vInfrRMSK .Op Fl t Ar template .Op Fl p Ar prefix .Op Fl P Ar prefix @@ -83,6 +83,10 @@ will search them in each directory named by .Ev PKG_PATH . .It Fl v Turn on verbose output. +.It Fl K +Keep any downloaded package in +.Ev PKGDIR +if it is defined or in current directory by default. .It Fl I If any installation scripts (pre-install or post-install) exist for a given package, do not execute them. @@ -519,6 +523,12 @@ uses when the .Fl r option is invoked. Thus it should be a complete URL to the remote package file(s). +.Pp +The environment variable +.Ev PKGDIR +Specifies an alternative location to save downloaded packages to when +.Fl K +option is used. .Sh FILES .Bl -tag -width /var/db/pkg -compact .It Pa /var/tmp |