Go to main content

Packaging and Delivering Software With the Image Packaging System in Oracle® Solaris 11.4

Exit Print View

Updated: November 2018
 
 

Delivering a File That Is Also Delivered by Another Package

You might want to use an IPS package to provide a customized version of a file that is already delivered by another package. By default, only one IPS package can deliver a file to any particular location. To use an IPS package to deliver a custom version of a file that is delivered by another IPS package, make sure the following attributes are set on the file action:

  • The overlay=allow and preserve=true attributes are set on the file you want to replace.

  • The overlay=true attribute and the preserve attribute with any value are set on the replacement file.

See the descriptions of the overlay and preserve attributes in File Actions.

The version of the file with the overlay=true attribute replaces the version with the overlay=allow attribute, and the version of the file with the overlay=allow attribute is saved in /var/pkg/lost+found/.

For example, suppose you install a package named isvapp that has the following file action:

file opt/isvapp/isvconf path=opt/isvapp/isvconf owner=root group=bin mode=0644 \
    overlay=allow preserve=true

The package installs the following file:

-rw-r--r--   1 root     bin        11358 Apr 17 18:44 /opt/isvapp/isvconf

You want a site-specific version of this file on all of your systems. You create a package named isvconf with the following file action to deliver the new version of the file:

file opt/isvapp/isvconf path=opt/isvapp/isvconf owner=root group=bin mode=0644 \
    overlay=true preserve=renameold

After isvconf is installed, the following files are on the system:

$ ls -l /opt/isvapp/isvconf
-rw-r--r--   1 root     bin        72157 Apr 17 18:47 /opt/isvapp/isvconf
$ ls -l /var/pkg/lost+found/opt/isvapp
total 24
-rw-r--r--   1 root     bin        11358 Apr 17 18:44 isvconf-20140417T184756Z

If you attempt to install another package, isvconf2 in this example, that would deliver a file with the same path, the installation fails with the following explanation:

Creating Plan (Checking for conflicting actions): -
pkg install: The following packages all deliver file actions to opt/isvapp/isvconf:

  pkg://site/isvconf2@1.0,5.11:20140417T190405Z
  pkg://site/isvapp@1.0,5.11:20140417T182316Z
  pkg://site/isvconf@1.0,5.11:20140417T185420Z

These packages may not be installed together. Any non-conflicting set may
be, or the packages must be corrected before they can be installed.

You can deliver a new version of the file in an update of the package that delivered the first replacement file. After isvconf@2.0 is installed, the following files are on the system:

$ ls -l /opt/isvapp/isvconf*
-rw-r--r--   1 root     bin        64064 Apr 17 18:52 /opt/isvapp/isvconf
-rw-r--r--   1 root     bin        54365 Apr 17 18:47 /opt/isvapp/isvconf.old
$ ls -l /var/pkg/lost+found/opt/isvapp
total 24
-rw-r--r--   1 root     bin        11358 Apr 17 18:44 isvconf-20140417T184756Z

The existing file was saved in isvconf.old because both of the following two conditions exist:

  • The isvconf package specifies preserve=renameold.

  • The file was edited after isvconf@1.0 was installed and before isvconf@2.0 was installed.

The lost+found area has not changed and still contains the original file delivered by isvapp.