This example shows how to use IPS to salvage unpackaged content to another packaged directory.
In this example, the package firstname.lastname@example.org installs the directory /opt/myapp/logfiles. The myapp application writes log files to that directory.
The email@example.com package delivers the /opt/myapp/history directory and does not deliver the /opt/myapp/logfiles directory. Users who update their installed firstname.lastname@example.org package to email@example.com will no longer have an /opt/myapp/logfiles directory. These users will see a message at the end of their pkg update output telling them that content from /opt/myapp/logfiles has been saved in /var/pkg/lost+found/opt/myapp/logfiles.
To use IPS to move the file content from /opt/myapp/logfiles to /opt/myapp/history at the time the myapp package is updated, use the salvage-from attribute on the /opt/myapp/history directory. Your pkgmogrify input file needs the following entry:
<transform dir path=opt/myapp/history -> \ add salvage-from /opt/myapp/logfiles>
After you run pkgmogrify, your package manifest action for this directory will look like the following:
dir path=opt/myapp/history owner=root group=bin mode=0755 \ salvage-from=/opt/myapp/logfiles
After a user runs pkg update myapp, the /opt/myapp/logfiles directory is gone, the new /opt/myapp/history directory is installed, and the file content from /opt/myapp/logfiles is in /opt/myapp/history.
See How to Migrate Unshared Content to a Shared Area shows another example that uses the salvage-from attribute.