Page MenuHomeFreeBSD

pkg: Add -j and -r options
Needs ReviewPublic

Authored by des on Fri, Jul 10, 7:54 PM.
Tags
None
Referenced Files
F163542930: D58165.id182291.diff
Fri, Jul 24, 7:42 AM
F163489346: D58165.id182202.diff
Thu, Jul 23, 5:40 PM
F163487823: D58165.id182252.diff
Thu, Jul 23, 5:14 PM
Unknown Object (File)
Wed, Jul 22, 7:58 PM
Unknown Object (File)
Tue, Jul 21, 1:39 PM
Unknown Object (File)
Sun, Jul 19, 9:22 PM
Unknown Object (File)
Sun, Jul 19, 4:32 PM
Unknown Object (File)
Sun, Jul 19, 4:32 PM
Subscribers

Details

Summary

This allows pkg(7) to be used to bootstrap a chroot or jail, and to
recognize the -j and -r options and pass them through to pkg(8) if
already bootstrapped.

Note that this does not address the issue of repository keys. If using
a signed package repository, you will still need to copy /usr/share/keys
into the target environment before or after bootstrapping, or pkg will
be unable to verify package signatures.

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 74984
Build 71867: arc lint + arc unit

Event Timeline

des requested review of this revision.Fri, Jul 10, 7:54 PM
This revision is now accepted and ready to land.Sun, Jul 12, 5:16 PM
des retitled this revision from pkg: Add support for -r option to pkg: Add support for -r and -j.Mon, Jul 13, 12:57 PM
des edited the summary of this revision. (Show Details)
This revision now requires review to proceed.Mon, Jul 13, 12:57 PM
This revision is now accepted and ready to land.Mon, Jul 13, 2:59 PM
This revision was automatically updated to reflect the committed changes.
markj added inline comments.
usr.sbin/pkg/pkg.c
96

Why is rootd a global variable? And shouldn't it be initialized to AT_FDCWD?

des retitled this revision from pkg: Add support for -r and -j to pkg: Add -j and -r options.
des edited the summary of this revision. (Show Details)
des marked an inline comment as done.Sun, Jul 19, 7:07 AM
usr.sbin/pkg/pkg.c
96

It still doesn't need to be global AFAICS.

264

If the assertion is false, then the program has already triggered some memory corruption and the assertion might not catch it.

285–286
286

This will always be zero.

1145

What if localbase is just "/"? I think this construction doesn't quite work in that case, pkgpatch will contain "//sbin/pkg" and the +1 in the faccessat() call below won't behave as you want.

If localbase is the empty string, this also doesn't work, but I think that probably shouldn't happen.

Turns out this is a lot more complicated than I thought

des marked 2 inline comments as done.Mon, Jul 20, 5:19 PM

remove unnecessary exit status checks

des marked 2 inline comments as done.Mon, Jul 20, 5:28 PM
usr.sbin/pkg/pkg.c
1145

If localbase is an empty string then pkgpath will be /sbin/pkg which is fine, I guess. See also D58362 which adds basic normalization to getlocalbase().

markj added inline comments.
usr.sbin/pkg/pkg.c
1139
1343

In pkg(8), -d isn't a boolean flag, repeating it increments DEBUG_LEVEL.

This revision is now accepted and ready to land.Tue, Jul 21, 2:05 PM
This revision now requires review to proceed.Tue, Jul 21, 4:38 PM
This revision is now accepted and ready to land.Tue, Jul 21, 4:40 PM
des marked 3 inline comments as done.Tue, Jul 21, 4:47 PM

getlocalbase() normalizes now

This revision now requires review to proceed.Tue, Jul 21, 4:49 PM

copy argv while parsing it instead of trying to reconstruct it later