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

Exit Print View

Updated: July 2014
 
 

Examples of Software Self-Assembly in Oracle Solaris

The following examples describe packages that are delivered as part of Oracle Solaris.

Apache Web Server Configuration

The Oracle Solaris package for Apache Web Server, pkg:/web/server/apache-22, delivers an httpd.conf file that contains the following Include directive referencing configuration files in the /etc/apache2/2.2/conf.d directory:

Include /etc/apache2/2.2/conf.d/*.conf

To apply custom configuration, you can create one or more packages that deliver custom .conf files to that conf.d directory and use a refresh_fmri actuator to automatically refresh the Apache instance whenever a package that delivers a new .conf file is installed, updated, or removed.

file etc/apache2/2.2/conf.d/custom.conf path=etc/apache2/2.2/conf.d/custom.conf \
    owner=root group=bin mode=0644 refresh_fmri=svc:/network/http:apache22

See Add Any Facets or Actuators That Are Needed and Chapter 7, Automating System Change as Part of Package Installation for information about how to use the refresh_fmri actuator.

Refreshing the Apache service instance causes the web server to rebuild its configuration. To verify this, use the following command to show the name of the method that runs when the Apache service instance is refreshed:

$ svcprop -p refresh/exec http:apache22
/lib/svc/method/http-apache\ refresh

A look at the method shows that refreshing the http:apache22 instance restarts the Apache httpd daemon by invoking apachectl with the graceful command.

User Attributes Configuration

User attributes are configured in /etc/user_attr and in additional configuration files in /etc/user_attr.d.

The /etc/user_attr configuration file is used to configure extended attributes for roles and users on the system. In Oracle Solaris 11, the /etc/user_attr file is used for local changes only. Complete configuration is read from the separate files delivered into the /etc/user_attr.d directory. Multiple packages deliver fragments of the complete configuration. For example, /etc/user_attr.d/core-os is delivered by the system/core-os package, and /etc/user_attr.d/ikev2-daemon is delivered by the system/network/ike package.

No services are restarted or refreshed as a result of installing these configuration files. No scripting is needed when these files are installed, uninstalled, or updated. The files in /etc/user_attr.d are composed by the name service cache daemon, nscd. The behavior of the nscd daemon is managed by the svc:/system/name-service/cache service.

$ svcs -p cache
STATE          STIME    FMRI
online         15:54:24 svc:/system/name-service/cache:default
               15:54:24     1000 nscd

The name service cache daemon provides configuration composition for most name service requests in the same way as described for user_attr. See the nscd(1M) man page.

Security Configuration

The /etc/security/exec_attr.d/ directory stores security configuration files.

In earlier Oracle Solaris releases, an SMF service merged the files delivered in exec_attr.d into a single database, /etc/security/exec_attr. In Oracle Solaris 11, functions in the security attributes database library, libsecdb, read the fragments in exec_attr.d directly, eliminating the need for a service to perform the merge.

Other directories in /etc/security that contain fragments of configuration, such as auth_attr.d and prof_attr.d, are handled in a similar way.