DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Custom Distribution Mastering Toolkit

Component script structure

As the developer, you control the structure of the ccs and cqs scripts. However, for consistency, we suggest this general structure for your scripts:

  1. Global component initialization actions

  2. Loop to call each package script

  3. Global component cleanup actions

Create separate package scripts for each package-specific action. Package scripts should be passed the same argument list and should return the same range of exit values as its parent ccs or cqs. Place package-specific ccs and cqs scripts in the subdirectory specified by packageCode of the SSOroot directory.


NOTE: Before the top-level ccs or cqs creates the package directory, it must convert the fully-qualified package name to the short name. Use getPackageCode in ccsSetup(CDMT).

This structure makes it easier to treat packages as modular units that can be added to components.

For an example ccs script, see ``Example ccs script''.

See also:


Example ccs script

#!/ibin/sh
#************************************************************************
#                      XClients ccs script
#------------------------------------------------------------------------
#  Top-level component control script (ccs) for the XClients component.
#------------------------------------------------------------------------
#       input:
#           $1 is the name of the step
#           $2 is the keyword list (e.g., UPGRADE )
#           $3 is the package list
#========================================================================

# Read arguments into variables scriptname="$0" step="$1" keywords="$2" pkglist="$3"

# Source in the standard functions library, ccsSetup.sh . ccsSetup.sh

# Set global variables indicating whether this is an upgrade or removal.

sso_upgrade= old_upgrade= for word in $keywords do case "$word" in UPGRADE) sso_upgrade=TRUE ;; OLD_CUSTOM_UPGRADE) old_upgrade=TRUE ;; esac done

# Set the appropriate NLSPATH to enable the "dspmsg" utility to work later # in this script. Note that pkg scripts should not have to worry about # NLSPATH, as they should inherit the copy set by the top-level ccs script.

NLSPATH="${SSO_SHARED_ROOT}/cntl/msg/%L/%N.cat":"${NLSPATH}" export NLSPATH

#================================================================= INT === # doPostattach -- # # In the case of an upgrade of an old component, doPostattach merges the # saved files (in CCS_PERSISTENT_STORAGE) into the new # configuration files (located under SSO_CLIENT_ROOT). #------------------------------------------------------------------------- doPostattach() { # if it's not an upgrade, we're done. [ "$upgrade" ] || return }

#================================================================= INT === # doPostconfig -- # # doPostconfig performs inter-component tasks, such as setting up # cron jobs, desktop customizations, and installing drivers into # the link kit. #------------------------------------------------------------------------- doPostconfig() { # ... change the cron file using configuration information # supplied in installation

# ... install cron file with crontab

# ... schedule a kernel relink using customSched(CDMT) : }

#================================================================= INT === # main -- # # Based on step specified, perform actions of the general form: # Global initialization # Loop to call each package script for package-specific actions # Global cleanup #-------------------------------------------------------------------------

# the exit value from this script ccs_return_value=0

# These fns get called prior to running package-specific scripts. case "$step" in POST_ATTACH) doPostattach ;; POST_CONFIGURE) doPostconfig ;; esac

# the directory containing whatever package scripts we've got pkgscripts=${SSO_SHARED_ROOT}/cntl/packages

# For each package, run that package's package script with # the same arguments as this script got. # Record any exit values from the package scripts. for pkg in $pkglist do short_pkg_name=`getPackageCode $pkg` [ -f ${pkgscripts}/${short_pkg_name}/ccs ] && { ${pkgscripts}/${short_pkg_name}/ccs $step $keywords "$pkglist"

# This script exits with the most severe of exit code of any of # its package scripts. An exit of 1 means "fail", which is more # severe than an exit of 2, which means "warning". An exit of 0 # (success) is the least severe. case "$?" in 1) ccs_return_value=1 ;; 2) [ "$ccs_return_value" -eq 0 ] && ccs_return_value=2 esac } done

exit $ccs_return_value


Next topic: Component script environment variables
Previous topic: Component script guidelines

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003