diff options
| author | Ken Smith <kensmith@FreeBSD.org> | 2004-03-01 21:58:21 +0000 |
|---|---|---|
| committer | Ken Smith <kensmith@FreeBSD.org> | 2004-03-01 21:58:21 +0000 |
| commit | e77e03a08a0f3d0f08d307fec424f4b2e402c132 (patch) | |
| tree | 0b5a288636fb6557d262c44562a8be7517333ef3 /usr.sbin/pkg_install | |
| parent | c15f03d3813778530988ebaae098cf7d5a1fe9e5 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/pkg_install')
| -rw-r--r-- | usr.sbin/pkg_install/add/main.c | 16 | ||||
| -rw-r--r-- | usr.sbin/pkg_install/add/pkg_add.1 | 26 |
2 files changed, 39 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index b39a5474a629..a993f091e657 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -27,9 +27,10 @@ __FBSDID("$FreeBSD$"); #include "lib.h" #include "add.h" -static char Options[] = "hvIRfnrp:SMt:"; +static char Options[] = "hvIRfnrp:SMt:C:"; char *Prefix = NULL; +char *Chroot = NULL; Boolean NoInstall = FALSE; Boolean NoRecord = FALSE; Boolean Remote = FALSE; @@ -129,6 +130,10 @@ main(int argc, char **argv) AddMode = MASTER; break; + case 'C': + Chroot = optarg; + break; + case 'h': case '?': default: @@ -210,6 +215,11 @@ main(int argc, char **argv) warnx("only one package name may be specified with master mode"); usage(); } + /* Perform chroot if requested */ + if (Chroot != NULL) { + if (chroot(Chroot)) + errx(1, "chroot to %s failed", Chroot); + } /* Make sure the sub-execs we invoke get found */ setenv("PATH", "/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin", @@ -280,7 +290,7 @@ static void usage() { fprintf(stderr, "%s\n%s\n", - "usage: pkg_add [-vInrfRMS] [-t template] [-p prefix]", - " pkg-name [pkg-name ...]"); + "usage: pkg_add [-vInrfRMS] [-t template] [-p prefix] [-C chrootdir]", + " pkg-name [pkg-name ...]"); exit(1); } diff --git a/usr.sbin/pkg_install/add/pkg_add.1 b/usr.sbin/pkg_install/add/pkg_add.1 index 794048261cb3..e12278b1e7f0 100644 --- a/usr.sbin/pkg_install/add/pkg_add.1 +++ b/usr.sbin/pkg_install/add/pkg_add.1 @@ -28,6 +28,7 @@ .Op Fl vInfrRMS .Op Fl t Ar template .Op Fl p Ar prefix +.Op Fl C Ar chrootdir .Ar pkg-name Op Ar pkg-name ... .Sh DESCRIPTION The @@ -188,6 +189,31 @@ in the staging area, the location of which is read as a string from stdin. The complete packing list is also read from stdin, and the contents then acted on as normal. +.It Fl C Ar chrootdir +Before doing any operations +.Xr chroot 2 +to the +.Ar chrootdir +directory so that all package files, and the package database, are +installed to +.Ar chrootdir . +Note that +.Ar chrootdir +needs to be a fairly complete file system, including everything normally +needed by +.Xr pkg_add 8 +to run. +This flag was added to help support operations done by +.Xr sysinstall 8 +and is not expected to be useful for much else. +Be careful that +.Ar chrootdir +is properly configured and can not be modified by normal users, +versions of commands like +.Xr fetch 1 +may be run inside +.Ar chrootdir +as a side-effect. .El .Pp One or more |
