To keep the unpackaged content where it is, even though all packaged content is uninstalled from that directory, package and install the directory separately. The directory remains installed as long as the package that installed the directory remains installed, even if all other packaged content is uninstalled from that directory.
For example, if you perform the following steps, and if no other installed IPS package delivers content to dir, the content of the dir directory is salvaged to /var/pkg/lost+found, including the application that was not delivered by IPS:
Install an application that is not delivered as an IPS package into dir.
Install an IPS package that installs content into dir.
Uninstall the IPS package that installs content into dir.
To maintain the unpackaged software you installed in dir, package the dir directory in its own IPS package.
Create an IPS package that delivers the directory or directory structure that you want. Install that package. That directory structure remains in place until you uninstall that package. Uninstalling a different package that delivers content to that directory will not remove the directory.
You should not create a package that delivers a directory that IPS already delivers. If an update would install the directory with different ownership, permissions, or other attributes, the update might not succeed. See the pkgmogrify step in the following procedure.
This example shows /usr/local. You can easily expand this to include /usr/local/bin or different directory structures that are not delivered by IPS packages.
$ mkdir -p usrlocal/usr/local
$ pkgsend generate usrlocal | pkgfmt > usrlocal.p5m.1 $ cat usrlocal.p5m.1 dir path=usr owner=root group=bin mode=0755 dir path=usr/local owner=root group=bin mode=0755
Create a pkgmogrify input file to add metadata and to exclude delivering /usr since that directory is already delivered by Oracle Solaris. You might also want to add transforms to change directory ownership or permissions from the default.
$ cat usrlocal.mog set name=pkg.fmri value=pkg://email@example.com set name=pkg.summary value="Create the /usr/local directory." set name=pkg.description value="This package installs the /usr/local \ directory so that /usr/local remains available for unpackaged files." set name=variant.arch value=$(ARCH) <transform dir path=usr$->drop>
$ pkgmogrify -DARCH=`uname -p` usrlocal.p5m.1 usrlocal.mog | \ pkgfmt > usrlocal.p5m.2 $ cat usrlocal.p5m.2 set name=pkg.fmri value=pkg://firstname.lastname@example.org set name=pkg.summary value="Create the /usr/local directory." set name=pkg.description \ value="This package installs the /usr/local directory so that /usr/local remains available for unpackaged files." set name=variant.arch value=i386 dir path=usr/local owner=root group=bin mode=0755
$ pkglint usrlocal.p5m.2 Lint engine setup... Starting lint run... $
In this example, the default publisher for the yourlocalrepo repository has already been set to site.
$ pkgsend -s yourlocalrepo publish -d usrlocal usrlocal.p5m.2 pkg://email@example.com,5.11:20140303T180555Z PUBLISHED
$ pkg refresh site $ pkg list -a usrlocal NAME (PUBLISHER) VERSION IFO usrlocal (site) 1.0 ---
$ pkg install -v usrlocal Packages to install: 1 Estimated space available: 20.66 GB Estimated space to be consumed: 454.42 MB Create boot environment: No Create backup boot environment: No Rebuild boot archive: No Changed packages: site usrlocal None -> 1.0,5.11:20140303T180555Z PHASE ITEMS Installing new actions 5/5 Updating package state database Done Updating package cache 0/0 Updating image state Done Creating fast lookup database Done Reading search index Done Updating search index 1/1
$ pkg list usrlocal NAME (PUBLISHER) VERSION IFO usrlocal (site) 1.0 i-- $ pkg info usrlocal Name: usrlocal Summary: Create the /usr/local directory. Description: This package installs the /usr/local directory so that /usr/local remains available for unpackaged files. State: Installed Publisher: site Version: 1.0 Build Release: 5.11 Branch: None Packaging Date: March 3, 2014 06:05:55 PM Size: 0.00 B FMRI: pkg://firstname.lastname@example.org,5.11:20140303T180555Z $ ls -ld /usr/local drwxr-xr-x 2 root bin 2 Mar 3 10:17 /usr/local/