Home Index Changes Prefs Log in »
version 0.7

1.0 User Image Actuators

Many traditional packaging systems support package scripts -- free form scripts that are invoked at specific points during package operations. For very good reasons OpenSolaris pkg(5) does not support package scripts. Instead it supports well defined package actions plus a feature known as Actuators.

Actuators are used to trigger SMF services when a file is installed, updated or removed. This provides a way for packages to trigger some logic that is executed when a file's state changes, but have that execution occur outside of the install context -- and instead occur inside the context of a running OS image. It's an alternative to package scripting that is more robust in the OS context.

The current Actuator implementation supports OpenSolaris system images. It was not designed to support cross-platform user images. An Actuator implementation for user images has some unique requirements:

  1. It must not rely on SMF (which does not exist on all platforms)
  2. It must support non-root users.
  3. It must not rely on files being installed outside of the user image
  4. It must be implementable on a variety of OS platforms

The UC project needs an implementation of Actuators that supports user images. This proposal is to create a new class of Actuator that would be used when operating on a user image: UserImageActuator.

Some example uses of UserImageActuators:

  • Install a menu item in the user's "Start" menu
  • Add a start-at-login task for a user
  • Deploy a plug-in into a framework that requires additional operations beyond simply placing a file in a well known location

Related Issues

205 install-time config support via IPS
6994(IPS) Need actuator implementation for user images
577 (IPS) need service action for smf(5) manifests
578 (IPS) need restart action or equivalent to poke smf(5) services

2.0 Requirements For UserImageActuator

#DescriptionPriorityRationale
1.0User Image Support
1.1Must not require super user privilegesP1User images support non-root users.
1.2Must not require SMFP1User images are supported on multiple platforms -- most of which do not support SMF
1.3Must optimize the case where files are installed by pkg(5) exclusively into a User imageP1User images are self-contained install images -- files are not installed by pkg(5) outside of the user image.
1.4Must support Windows, Linux, MacOS X, WindowsP1User images are supported on multiple platforms.
2.0OpenSolaris Integrity
2.1Must not alter the current Actuator behavior when operating on a system imageP1Must not alter the current Actuator implementation for OpenSolaris.
2.2Must only be used when operating on a user imageP1 Ditto
3.0General
3.1Must provide a pre-remove hookP1To handle operations that need to be performed before a file is removed
3.2Must provide a post-install/update hookP1To handle operations that need to be performed after a file is modified
3.3Any failure of a UserImageAcutator hook must not cause an imageplan evaluation to failP1Configuration operations must not impact package operations. This is also consistent with the current SMF Actuator implementation where hook failures occur in the context of the running SMF service and do not impact imageplan evaluation.
3.4Any output from a UserImageAcutator hook must be captured and displayed to the user and logged to the IPS log fileP2For diagnosis
3.5Must not support actuator hooks that perform any form of user interactionP1Hooks may not block package installation for an indefinite period of time.
3.6Need not support SMF Actuator attributesP1

3.0 Current SMF Actuator Implementation

The current OpenSolaris/SMF implementation of Actuators support the following file action attributes:

AttributeBehavior
disable_fmri=service fmriRun 'svcadm disable -t service_fmri' before file is removed
suspend_fmri=service fmriRun 'svcadm disable -t service_fmri' beforefile is installed, updated or removed, and then run 'svcadm enable service_fmri' after file is installed, updated, or removed
restart_fmri=service fmriRun 'svcadm restart service_fmri' after file is installed, updated or removed
refresh_fmri=service fmriRun 'svcadm refresh service_fmri' after file is installed, updated or removed

Notes:

  1. before and after is before and after the imageplan is executed
  2. If a service is not loaded or running then the service fmri is ignored
  3. If the same attribute and service fmri is specified for multiple files in an imageplan, those multiple occurences are coalesced and the service operation is only triggered once.

4.0 UserImageActuator Implementation

To generalize this for UserImageActuator the proposal is to replace the service fmri's with a path to a command. The command is passed a single parameter that reflects the disposition of the hook.

AttributeBehavior
user_disable_cmd=cmdRun 'cmd disable' before file is removed
user_suspend_cmd=cmdRun 'cmd disable' before file is installed, updated or removed, and then run 'cmd enable' after file is installed, updated, or removed
user_restart_cmd=cmdRun 'cmd restart' after file is installed, updated or removed
user_refresh_cmd=cmdRun 'cmd refresh' after file is installed, updated or removed

Notes:

  1. cmd is relative to the User image root
  2. cmd is run synchronously before or after the imageplan is evaluated. If cmd does not return within a specified threshold it will be abandoned and the package operation will continue.
  3. If cmd does not exist or is not executable then it is ignored
  4. An imageplan for a User Image will use the UserImageActuator. An imageplan for a system image will use the current Actuator implementation
  5. If the same attribute/cmd is specified for multiple file actions it is only executed once either before or after the imageplan is evaluated.

4.1 Alternative UserImageActuator Implementation

The approach described in section 4.0 attempts to maintain some consistency with the SMF Actuator implementation. This may be misleading since the UserImageActuator is not providing an interface to a service framework. The following attributes represent an alternative that may be a bit more straightforward:

AttributeBehavior
user_preremove_cmd=cmdRun 'cmd preremove' before file is removed
user_postinstall_cmd=cmdRun 'cmd postinstall' after file is installed
user_postupdate_cmd=cmdRun 'cmd postupdate' after file is updated

The same notes that apply in 4.0 also apply here.

« Home Attachments Info Index Changes
This page (revision-28) was last changed on 02-Mar-09 09:30 AM, -0800 by DiPol