Determine all directories touched in a package install

I want to install PostgreSQL in a thin jail using nullfs, and this requires me to know all the directories that the PostgreSQL package is going to be installed in and write to.

Is there an easy way to determine this for PostgreSQL? For other packages?
 
You can get a list of installed files looking at the pkg-plist in the ports directory. This is also what 'pkg Info xyz' should tell you. That that program creates on first startup is not part of that list.
 
If you want to include dependent pkgs, run pkg shell 'select path from directories' after installing the packages.
Note: I do not checked and do not know if this is sufficient.
 
Hello!
you can list all installed files of a package using
Code:
pkg info -l package

Maybe in some test jail you can install PostgreSQL and run this command.
I have written little bash script to show unique directories of installed package

Bash:
#!/usr/local/bin/bash

if [ -z "$1" ]; then
    echo "usage: script [package-name]"
    exit 1
fi

files=$(pkg info -l $1 | grep '/' | sed s/[[:space:]]//g)

dirs=$(
    for file in $(echo "$files"); do
    dir=$(dirname "$file")
    echo "$dir"
    done)

echo "$dirs" | sort -u
 
… all the directories that the PostgreSQL package is going to be installed in …

FreshPorts lists files (without focusing on directories alone), for example:

1728844439457.png
 
Not all ports have a pkg-plist file and sometimes it may not be complete. The package on the other hand will have a completed list of installed files (and therefore folders) as it uses those details for creation and removal instead of running the build system of the port to perform install+uninstall steps. This excludes things that are created after install like configuration files, directories in user's home folder, temporary folders, etc.

My old notes from following steps from the porter's handbook, and maybe elsewhere, to build and install a portusing a normal user and its writable home directory. It creates and compares a list of files(/folders?) to create a pkg-plist file which is an important step of creating a port but needed manual review. Again, following these steps would not have grabbed configuration changes and such that are done after by the user, running the program, etc. This set of commands would be ran from the port's folder (even if it wasn't inside the port's tree itself); simplification is probably possible by replacing home directory with ~ (untested by me) and I assume it needs to be modified for installs of 14+ that use /home instead of /usr/home.

mkdir /usr/home/mirror176/tmp/`make -V PKGNAME`;mtree -U -f `make -V MTREE_FILE` -d -e -p /usr/home/mirror176/tmp/`make -V PKGNAME`;make depends PREFIX=/usr/home/mirror176/tmp/`make -V PKGNAME`

time make install PREFIX=/usr/home/mirror176/tmp/`make -V PKGNAME`

/usr/ports/Tools/scripts/plist -Md -m `make -V MTREE_FILE` /usr/home/mirror176/tmp/`make -V PKGNAME` > pkg-plist


If you have trouble running the above commands, try installing FreeBSD < 14.0 and adding me as a user and then running it from my user. ;)
 
Thanks. It seems like I was making things more complicated than necessary and the 'thin jails' have local directories that cover pretty much any software installation, e.g. /usr/local, /var, etc. So it appears I don't need to fine tune for a particular package install.

Still good to know how to see what a package install is doing though, thanks.
 
The absense of pkg-plist would be auto-plist or listed PLIST_FILES= line in Makefile. Example: editors/ox/Makefile.
Incomplete pkg-plist would be edited, for example, by ${REINPLACE_CMD} for ${TMPPLIST} in Makefile. Example: x11/nvidia-driver/Makefile.
And there are examples that go outside that. games/warzone2100 (not the only one I've seen with incomplete/no plist creation step) has a pkg-plist file but it doesn't contain all installed files nor does it use auto-plist. It defines PORTDOCS and PORTDATA, but does does as "=*"; I haven't figured out if there is a technical/good reason to it or if it is just a result of lazyness.

I admit there are a number of things I have trouble grasping in the ports frameworkA few that come to mind:
  • When to use USE_CXXSTD=c++17 vs USES=compiler:c++-17-lang vs ignore setting it if the port uses cmake and has it defined there.
  • How do we define a range of acceptable compiler versions? Can that range have specific gaps if there are known issues?
  • Why do compiler ranges, when available, default to oldest compiler before newest compiler (java seems to specifically work this way)? Can we override that while maintaining a list of compilers to use as a range?
  • When should ports start excluding files from extraction if they are not used during build/install steps?
    • Less I/O has benefits for times disk is I/O saturated if doing parallel builds.
    • Not waiting for the disk to write/delete the data.
    • Save RAM consumption if using tmpfs RAM to hold the work directory.
    • Lessen unnecessary drive wear.
    • It could also speed up extraction by ending decompression of a file if only unused content remains to be decompressed at the end of an archive or blocks within it but my testing looks like my system may be using more time to exclude files from extraction than it would have to decompress+write at least for some archive types; likely there would be needed performance improvements for full benefit. Perhaps poudriere can use atime to make it easy to list which files went completely unused during configure/build/install steps.
 
And there are examples that go outside that. games/warzone2100 (not the only one I've seen with incomplete/no plist creation step) has a pkg-plist file but it doesn't contain all installed files nor does it use auto-plist.
Not actually look into it, but possibly it would adding something specific with OPTIONs / FLAVORs and/or environment to base pkg-plist.

x11/nvidia-driver and x11/linux-nvidia-libs are the opposite, If I'm not mis-understanding, their pkg-plist contains everything staged that any of current (including New Feature / Beta branches which are available when the ports are updated, at least by me) and old version. Some are commented out with some reason (not by me). And drop unneeded/nonexistent files for the specific version to be built from TMPPLIST by conditionals and REINPLACE in their Makefiles. Most of them were already there when I first attempted to update the ports and I've followed it.
 
Back
Top