Page MenuHomeFreeBSD

xinstall: add -P/-F to create parent directories.
Needs ReviewPublic

Authored by will on Feb 3 2018, 1:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 5:23 AM
Unknown Object (File)
Oct 28 2023, 4:57 PM
Unknown Object (File)
Apr 7 2023, 4:18 PM
Unknown Object (File)
Mar 21 2023, 11:48 AM
Unknown Object (File)
Jan 17 2023, 9:02 AM
Unknown Object (File)
Jan 5 2023, 5:18 PM
Unknown Object (File)
Dec 25 2022, 6:30 AM
Subscribers

Details

Reviewers
bdrewery
brd
Summary

This takes the form of two separate arguments, which differ in usage,
but have the same effect.

-P: Similar to GNU install -D, except the last argument is treated as a
full directory path, and is created (including any parent directories)
if it does not already exist. This is most similar to cp a b c dir
usage, which is different than GNU install -D's usage.

-F: Same as -P, but only takes two arguments, both of which are files.
In effect, it performs mkdir -p $(dirname arg2); cp $arg1 $arg2.
This is required in addition to -P, because install(1) is unable
to disambiguate between these usages:

install ... -P file1 file2
install ... -P file1 ... fileN directory

...where, in the second case, only one file is specified. In FreeBSD's
source build system, both of these use cases are used in many areas.
xinstall itself uses the first use case, to rename itself as install.

Include man page and test updates to validate these changes.

This change allows tracking, in the metalog, on a per package basis, which
directories are required for which package. It also removes the need to
run mtree in a target DESTDIR to install just one directory.

Test Plan

Run ATF tests.
Build using the etc branch at https://github.com/brd/freebsd/

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14752
Build 14873: arc lint + arc unit

Event Timeline

imp added inline comments.
usr.bin/xinstall/xinstall.c
359–360

strlcpy here is safer, shorter and less cumbersome.